Skip to content

Commit

Permalink
Use .expect() in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bash committed May 17, 2024
1 parent b11beae commit bf990cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/xterm/quirks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,16 @@ mod screen {
fn wraps_query_between_dcs_and_st() {
let expected = b"\x1bP\x1b[c\x1b\\";
let mut actual = Vec::new();
write_to_host_terminal(&mut actual, b"\x1b[c").unwrap();
write_to_host_terminal(&mut actual, b"\x1b[c").unwrap_or_else(|_| unreachable!());
assert_eq!(to_string(expected.as_slice()), to_string(&actual));
}

#[test]
fn splits_st_among_multiple_dcs_and_st_pairs() {
let expected = b"\x1bP\x1b]11;?\x1b\\\x1bP\x1b\x1b\\\x1bP\\\x1b\\";
let mut actual = Vec::new();
write_to_host_terminal(&mut actual, b"\x1b]11;?\x1b\\").unwrap();
write_to_host_terminal(&mut actual, b"\x1b]11;?\x1b\\")
.unwrap_or_else(|_| unreachable!());
assert_eq!(to_string(expected.as_slice()), to_string(&actual));
}

Expand All @@ -155,7 +156,10 @@ mod screen {

fn to_string(input: &[u8]) -> String {
use std::str::from_utf8;
format!("{}", CaretNotation(from_utf8(input).unwrap()))
format!(
"{}",
CaretNotation(from_utf8(input).expect("valid utf-8 data"))
)
}
}
}

0 comments on commit bf990cf

Please sign in to comment.