Skip to content

Commit 70c5ea8

Browse files
committed
Add some tests
1 parent e770bad commit 70c5ea8

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bitwarden-uuid/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ bitwarden-uuid-macro = { workspace = true }
2121
workspace = true
2222

2323
[dev-dependencies]
24+
serde = { workspace = true }
25+
uuid = { workspace = true }

crates/bitwarden-uuid/tests/uuid.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![allow(unexpected_cfgs)]
2+
3+
use bitwarden_uuid::uuid;
4+
5+
uuid!(TestId);
6+
7+
#[test]
8+
fn test_parse_string() {
9+
use uuid::Uuid;
10+
11+
let id: TestId = "12345678-1234-5678-1234-567812345678".parse().unwrap();
12+
let uuid: Uuid = id.into();
13+
14+
assert_eq!(uuid.to_string(), "12345678-1234-5678-1234-567812345678");
15+
}
16+
17+
#[test]
18+
fn test_new() {
19+
use uuid::Uuid;
20+
21+
let uuid = Uuid::new_v4();
22+
let id = TestId::new(uuid);
23+
24+
assert_eq!(uuid, Into::<Uuid>::into(id));
25+
}

0 commit comments

Comments
 (0)