Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Add test of escape sequences in strings
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 5, 2023
1 parent 73bf2c3 commit 08b8aa7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,27 @@ fn test_basic_struct() {
test_serde(&thing, yaml);
}

#[test]
fn test_string_escapes() {
let yaml = indoc! {r#"
ascii
"#};
test_serde(&"ascii".to_owned(), yaml);

let yaml = indoc! {r#"
"\0\a\b\t\n\v\f\r\e\"\\\N\L\P"
"#};
test_serde(
&"\0\u{7}\u{8}\t\n\u{b}\u{c}\r\u{1b}\"\\\u{85}\u{2028}\u{2029}".to_owned(),
yaml,
);

let yaml = indoc! {r#"
"\x1F\uFEFF"
"#};
test_serde(&"\u{1f}\u{feff}".to_owned(), yaml);
}

#[test]
fn test_multiline_string() {
#[derive(Serialize, Deserialize, PartialEq, Debug)]
Expand Down

0 comments on commit 08b8aa7

Please sign in to comment.