chyh1990 / yaml-rust

A pure rust YAML implementation.
Apache License 2.0
609 stars 140 forks source link

"-(tab)string" is incorrectly parsed #149

Open ExpHP opened 4 years ago

ExpHP commented 4 years ago

Found this while modifying the tests for https://github.com/chyh1990/yaml-rust/issues/148. The current implementation incorrectly parses examples 6.2 and 6.3 in the spec.

#[test]
fn ex() {
    use yaml_rust::YamlLoader;

    let docs = YamlLoader::load_from_str("-\tb").unwrap();
    assert_eq!(docs[0].as_vec().unwrap()[0].as_str().unwrap(), "b");
}
thread 'ex' panicked at 'assertion failed: `(left == right)`
  left: `"\tb"`,
 right: `"b"`', src\main.rs:100:5