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

Add test of escape sequences in strings #357

Merged
merged 1 commit into from
Mar 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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