Merge branch 'hoodie-bug/syntax_error_panic'
This commit is contained in:
commit
1973bc9ed3
2 changed files with 8 additions and 1 deletions
|
@ -949,7 +949,7 @@ impl<T: Iterator<Item=char>> Scanner<T> {
|
||||||
self.roll_indent(mark.col, None, TokenType::BlockSequenceStart, mark);
|
self.roll_indent(mark.col, None, TokenType::BlockSequenceStart, mark);
|
||||||
} else {
|
} else {
|
||||||
// - * only allowed in block
|
// - * only allowed in block
|
||||||
unreachable!();
|
return Err(ScanError::new(self.mark, r#""-" is only valid inside a block"#))
|
||||||
}
|
}
|
||||||
try!(self.remove_simple_key());
|
try!(self.remove_simple_key());
|
||||||
self.allow_simple_key();
|
self.allow_simple_key();
|
||||||
|
|
|
@ -469,4 +469,11 @@ a1: &DEFAULT
|
||||||
assert!(doc[25][0].as_bool().unwrap());
|
assert!(doc[25][0].as_bool().unwrap());
|
||||||
assert!(!doc[25][1].as_bool().unwrap());
|
assert!(!doc[25][1].as_bool().unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_bad_hypen() {
|
||||||
|
// See: https://github.com/chyh1990/yaml-rust/issues/23
|
||||||
|
let s = "{-";
|
||||||
|
assert!(YamlLoader::load_from_str(&s).is_err());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue