forked from ordinals/ord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse.rs
32 lines (29 loc) Β· 772 Bytes
/
parse.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use {super::*, ord::subcommand::parse::Output, ord::Object};
#[test]
fn name() {
assert_eq!(
CommandBuilder::new("parse a").run_and_deserialize_output::<Output>(),
Output {
object: Object::Integer(2099999997689999),
}
);
}
#[test]
fn hash() {
assert_eq!(
CommandBuilder::new("parse 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
.run_and_deserialize_output::<Output>(),
Output {
object: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
.parse::<Object>()
.unwrap(),
}
);
}
#[test]
fn unrecognized_object() {
CommandBuilder::new("parse Az")
.stderr_regex(r"error: .*: Unrecognized representation.*")
.expected_exit_code(2)
.run_and_extract_stdout();
}