diff options
| author | Edward Barnard | 2015-12-25 20:45:06 +0000 |
|---|---|---|
| committer | Edward Barnard | 2015-12-26 19:36:19 +0000 |
| commit | 0ec05856dab205db2a874dc45340f8b522bd7634 (patch) | |
| tree | 708e1a76b5148ffc7813286432ff642ddd8fc3b0 /src/binary | |
| parent | 261510a0c61da1afbbb4c5876023e2210fc60901 (diff) | |
| download | rust-plist-0ec05856dab205db2a874dc45340f8b522bd7634.tar.bz2 | |
Kill StartPlist and EndPlist
Diffstat (limited to 'src/binary')
| -rw-r--r-- | src/binary/reader.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/binary/reader.rs b/src/binary/reader.rs index 128c573..2463be2 100644 --- a/src/binary/reader.rs +++ b/src/binary/reader.rs @@ -144,7 +144,6 @@ impl<R: Read + Seek> EventReader<R> { if self.ref_size == 0 { // Initialise here rather than in new try!(self.read_trailer()); - return Ok(Some(PlistEvent::StartPlist)); } let object_ref = match self.stack.last_mut() { @@ -163,7 +162,8 @@ impl<R: Read + Seek> EventReader<R> { match item.ty { StackType::Array => return Ok(Some(PlistEvent::EndArray)), StackType::Dict => return Ok(Some(PlistEvent::EndDictionary)), - StackType::Root => return Ok(Some(PlistEvent::EndPlist)), + // We're at the end of the plist + StackType::Root => return Ok(None), } } } @@ -317,8 +317,7 @@ mod tests { let streaming_parser = EventReader::new(reader); let events: Vec<PlistEvent> = streaming_parser.map(|e| e.unwrap()).collect(); - let comparison = &[StartPlist, - StartDictionary(Some(6)), + let comparison = &[StartDictionary(Some(6)), StringValue("Lines".to_owned()), StartArray(Some(2)), StringValue("It is a tale told by an idiot,".to_owned()), @@ -334,8 +333,7 @@ mod tests { StringValue("William Shakespeare".to_owned()), StringValue("Data".to_owned()), DataValue(vec![0, 0, 0, 190, 0, 0, 0, 3, 0, 0, 0, 30, 0, 0, 0]), - EndDictionary, - EndPlist]; + EndDictionary]; assert_eq!(events, comparison); } @@ -347,6 +345,6 @@ mod tests { let reader = File::open(&Path::new("./tests/data/utf16_bplist.plist")).unwrap(); let streaming_parser = EventReader::new(reader); let events: Vec<PlistEvent> = streaming_parser.map(|e| e.unwrap()).collect(); - assert_eq!(events[39], StringValue("\u{2605} or better".to_owned())); + assert_eq!(events[38], StringValue("\u{2605} or better".to_owned())); } } |
