Skip to content

Commit 0746190

Browse files
committed
cargo: Add test for is_uuid
1 parent 94ac30c commit 0746190

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/cargo/cargo.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ fn is_uuid(id: str) -> bool {
134134
false
135135
}
136136

137+
#[test]
138+
fn test_is_uuid() {
139+
assert is_uuid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa");
140+
assert is_uuid("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA");
141+
assert is_uuid("0AAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAA0");
142+
assert !is_uuid("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa");
143+
assert !is_uuid("aaaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaaaaaa");
144+
assert !is_uuid("");
145+
}
146+
137147
// FIXME: implement URI/URL parsing so we don't have to resort to weak checks
138148

139149
fn is_archive_uri(uri: str) -> bool {

0 commit comments

Comments
 (0)