|
|
@ -55,8 +55,9 @@ impl<W: Write> CsvSolutionsWriter<W> { |
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn finish(self) -> W { |
|
|
|
pub fn finish(mut self) -> io::Result<W> { |
|
|
|
self.sink |
|
|
|
self.sink.flush()?; |
|
|
|
|
|
|
|
Ok(self.sink) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -145,8 +146,9 @@ impl<W: Write> TsvSolutionsWriter<W> { |
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn finish(self) -> W { |
|
|
|
pub fn finish(mut self) -> io::Result<W> { |
|
|
|
self.sink |
|
|
|
self.sink.flush()?; |
|
|
|
|
|
|
|
Ok(self.sink) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -319,7 +321,7 @@ mod tests { |
|
|
|
.filter_map(|(v, s)| s.as_ref().map(|s| (v.as_ref(), s.as_ref()))), |
|
|
|
.filter_map(|(v, s)| s.as_ref().map(|s| (v.as_ref(), s.as_ref()))), |
|
|
|
)?; |
|
|
|
)?; |
|
|
|
} |
|
|
|
} |
|
|
|
let result = writer.finish(); |
|
|
|
let result = writer.finish()?; |
|
|
|
assert_eq!(str::from_utf8(&result).unwrap(), "x,literal\r\nhttp://example/x,String\r\nhttp://example/x,\"String-with-dquote\"\"\"\r\n_:b0,Blank node\r\n,Missing 'x'\r\n,\r\nhttp://example/x,\r\n_:b1,String-with-lang\r\n_:b1,123"); |
|
|
|
assert_eq!(str::from_utf8(&result).unwrap(), "x,literal\r\nhttp://example/x,String\r\nhttp://example/x,\"String-with-dquote\"\"\"\r\n_:b0,Blank node\r\n,Missing 'x'\r\n,\r\nhttp://example/x,\r\n_:b1,String-with-lang\r\n_:b1,123"); |
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
|
} |
|
|
|
} |
|
|
@ -337,7 +339,7 @@ mod tests { |
|
|
|
.filter_map(|(v, s)| s.as_ref().map(|s| (v.as_ref(), s.as_ref()))), |
|
|
|
.filter_map(|(v, s)| s.as_ref().map(|s| (v.as_ref(), s.as_ref()))), |
|
|
|
)?; |
|
|
|
)?; |
|
|
|
} |
|
|
|
} |
|
|
|
let result = writer.finish(); |
|
|
|
let result = writer.finish()?; |
|
|
|
assert_eq!(str::from_utf8(&result).unwrap(), "?x\t?literal\n<http://example/x>\t\"String\"\n<http://example/x>\t\"String-with-dquote\\\"\"\n_:b0\t\"Blank node\"\n\t\"Missing 'x'\"\n\t\n<http://example/x>\t\n_:b1\t\"String-with-lang\"@en\n_:b1\t123"); |
|
|
|
assert_eq!(str::from_utf8(&result).unwrap(), "?x\t?literal\n<http://example/x>\t\"String\"\n<http://example/x>\t\"String-with-dquote\\\"\"\n_:b0\t\"Blank node\"\n\t\"Missing 'x'\"\n\t\n<http://example/x>\t\n_:b1\t\"String-with-lang\"@en\n_:b1\t123"); |
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
|
} |
|
|
|
} |
|
|
|