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

Commit

Permalink
Merge pull request #357 from dtolnay/stringescape
Browse files Browse the repository at this point in the history
Add test of escape sequences in strings
  • Loading branch information
dtolnay authored Mar 5, 2023
2 parents 73bf2c3 + 08b8aa7 commit eac69a2
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 eac69a2

Please sign in to comment.