MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_tokenizer_offset_multi_char

Function test_tokenizer_offset_multi_char

atomic-core/src/diff/token/tests.rs:566–576  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

564
565 #[test]
566 fn test_tokenizer_offset_multi_char() {
567 let code = b"foo == bar";
568 let tokens: Vec<Token> = Tokenizer::new(code).collect();
569
570 assert_eq!(tokens[0].offset(), 0); // 'foo'
571 assert_eq!(tokens[0].end_offset(), 3);
572 assert_eq!(tokens[2].offset(), 4); // '=='
573 assert_eq!(tokens[2].end_offset(), 6);
574 assert_eq!(tokens[4].offset(), 7); // 'bar'
575 assert_eq!(tokens[4].end_offset(), 10);
576 }
577
578 #[test]
579 fn test_tokenizer_byte_range_slicing() {

Callers

nothing calls this directly

Calls 1

collectMethod · 0.45

Tested by

no test coverage detected