parent
028176a4b6
commit
a3ecc9f2d4
2 changed files with 9 additions and 2 deletions
|
@ -124,8 +124,7 @@ impl<T: Iterator<Item=char>> Parser<T> {
|
||||||
|
|
||||||
fn parse<R: EventReceiver>(&mut self, recv: &mut R)
|
fn parse<R: EventReceiver>(&mut self, recv: &mut R)
|
||||||
-> ParseResult {
|
-> ParseResult {
|
||||||
if self.scanner.stream_ended()
|
if self.state == State::End {
|
||||||
|| self.state == State::End {
|
|
||||||
return Ok(Event::StreamEnd);
|
return Ok(Event::StreamEnd);
|
||||||
}
|
}
|
||||||
let ev = try!(self.state_machine());
|
let ev = try!(self.state_machine());
|
||||||
|
|
|
@ -331,6 +331,14 @@ c: [1, 2]
|
||||||
assert!(doc["d"][0].is_badvalue());
|
assert!(doc["d"][0].is_badvalue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_empty_doc() {
|
||||||
|
let s: String = "".to_owned();
|
||||||
|
YamlLoader::load_from_str(&s).unwrap();
|
||||||
|
let s: String = "---".to_owned();
|
||||||
|
assert_eq!(YamlLoader::load_from_str(&s).unwrap()[0], Yaml::Null);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parser() {
|
fn test_parser() {
|
||||||
let s: String = "
|
let s: String = "
|
||||||
|
|
Loading…
Reference in a new issue