Better code coverage

This commit is contained in:
Yuheng Chen 2015-06-04 16:10:43 +08:00
parent 97747a719c
commit d40b7cbdd2
3 changed files with 21 additions and 2 deletions

View file

@ -217,6 +217,8 @@ a4:
- - a1 - - a1
- a2 - a2
- 2 - 2
- []
- {}
a5: 'single_quoted' a5: 'single_quoted'
a6: \"double_quoted\" a6: \"double_quoted\"
a7: a7:

View file

@ -259,8 +259,10 @@ impl<T: Iterator<Item=char>> Parser<T> {
State::FlowSequenceEntryMappingKey => self.flow_sequence_entry_mapping_key(), State::FlowSequenceEntryMappingKey => self.flow_sequence_entry_mapping_key(),
State::FlowSequenceEntryMappingValue => self.flow_sequence_entry_mapping_value(), State::FlowSequenceEntryMappingValue => self.flow_sequence_entry_mapping_value(),
State::FlowSequenceEntryMappingEnd => self.flow_sequence_entry_mapping_end(), State::FlowSequenceEntryMappingEnd => self.flow_sequence_entry_mapping_end(),
State::FlowMappingEmptyValue => self.flow_mapping_value(true),
_ => unimplemented!() /* impossible */
State::End => unreachable!(),
} }
} }
@ -329,7 +331,6 @@ impl<T: Iterator<Item=char>> Parser<T> {
//} //}
}, },
TokenType::TagDirectiveToken(..) => { TokenType::TagDirectiveToken(..) => {
// unimplemented!();
// TODO add tag directive // TODO add tag directive
}, },
_ => break _ => break

View file

@ -1942,6 +1942,22 @@ key:
end!(p); end!(p);
} }
#[test]
fn test_scanner_cr() {
let s = "---\r\n- tok1\r\n- tok2";
let mut p = Scanner::new(s.chars());
next!(p, StreamStartToken(..));
next!(p, DocumentStartToken);
next!(p, BlockSequenceStartToken);
next!(p, BlockEntryToken);
next_scalar!(p, TScalarStyle::Plain, "tok1");
next!(p, BlockEntryToken);
next_scalar!(p, TScalarStyle::Plain, "tok2");
next!(p, BlockEndToken);
next!(p, StreamEndToken);
end!(p);
}
#[test] #[test]
fn test_uri() { fn test_uri() {
// TODO // TODO