MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_next_pos

Function test_next_pos

core/src/reader.rs:263–273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

261
262 #[test]
263 fn test_next_pos() {
264 let mut input = "Hi".as_bytes();
265 let mut reader = CharReader::from(&mut input);
266 assert_eq!(LineCol { line: 1, col: 1 }, reader.next_pos());
267 assert_eq!(cs('H', 1, 1), reader.next().unwrap().unwrap());
268 assert_eq!(LineCol { line: 1, col: 2 }, reader.next_pos());
269 assert_eq!(cs('i', 1, 2), reader.next().unwrap().unwrap());
270 assert_eq!(LineCol { line: 1, col: 3 }, reader.next_pos());
271 assert!(reader.next().is_none());
272 assert_eq!(LineCol { line: 1, col: 3 }, reader.next_pos());
273 }
274
275 /// A reader that generates an error only on the Nth read operation.
276 ///

Callers

nothing calls this directly

Calls 1

as_bytesMethod · 0.80

Tested by

no test coverage detected