mirror of
https://github.com/atuinsh/atuin.git
synced 2024-11-08 09:25:33 +01:00
Add test for extended parsing
This commit is contained in:
parent
bae59474ee
commit
3323b3079a
@ -93,3 +93,29 @@ impl Iterator for Zsh {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::parse_extended;
|
||||
|
||||
#[test]
|
||||
fn test_parse_extended_simple() {
|
||||
let parsed = parse_extended(": 1613322469:0;cargo install atuin");
|
||||
|
||||
assert_eq!(parsed.command, "cargo install atuin");
|
||||
assert_eq!(parsed.duration, 0);
|
||||
assert_eq!(parsed.timestamp, 1_613_322_469_000_000_000);
|
||||
|
||||
let parsed = parse_extended(": 1613322469:10;cargo install atuin;cargo update");
|
||||
|
||||
assert_eq!(parsed.command, "cargo install atuin;cargo update");
|
||||
assert_eq!(parsed.duration, 10_000_000_000);
|
||||
assert_eq!(parsed.timestamp, 1_613_322_469_000_000_000);
|
||||
|
||||
let parsed = parse_extended(": 1613322469:10;cargo :b̷i̶t̴r̵o̴t̴ ̵i̷s̴ ̷r̶e̵a̸l̷");
|
||||
|
||||
assert_eq!(parsed.command, "cargo :b̷i̶t̴r̵o̴t̴ ̵i̷s̴ ̷r̶e̵a̸l̷");
|
||||
assert_eq!(parsed.duration, 10_000_000_000);
|
||||
assert_eq!(parsed.timestamp, 1_613_322_469_000_000_000);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user