Merge branch 'hoodie-bug/syntax_error_panic'
This commit is contained in:
commit
a853ff3c94
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);
|
||||
} else {
|
||||
// - * only allowed in block
|
||||
unreachable!();
|
||||
return Err(ScanError::new(self.mark, r#""-" is only valid inside a block"#))
|
||||
}
|
||||
try!(self.remove_simple_key());
|
||||
self.allow_simple_key();
|
||||
|
|
|
@ -469,4 +469,11 @@ a1: &DEFAULT
|
|||
assert!(doc[25][0].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