scalar/flow: add unit test for escaped double quote

This commit is contained in:
Paul Stemmet 2021-09-17 15:28:42 +00:00 committed by Paul Stemmet
parent 0c38dda908
commit 1cdad01126
1 changed files with 19 additions and 0 deletions

View File

@ -698,4 +698,23 @@ rst \
Ok(())
}
#[test]
fn flow_double_escape_quote() -> TestResult
{
let data = r#""a quote \" here""#;
let stats = &mut MStats::new();
let cmp = "a quote \" here";
let expected = Token::Scalar(cow!(cmp), ScalarStyle::DoubleQuote);
let (scalar, _read) =
scan_flow_scalar(TEST_FLAGS, data, stats, false).and_then(normalize)?;
if !(scalar == expected)
{
bail!("\nexpected: {:?}\nbut got: {:?}", expected, &scalar)
}
Ok(())
}
}