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

Function test_tokenizer_rust_function

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

Source from the content-addressed store, hash-verified

763
764 #[test]
765 fn test_tokenizer_rust_function() {
766 let code = b"pub fn calculate(x: i32, y: i32) -> i32 { x + y }";
767 let tokens: Vec<Token> = Tokenizer::new(code).collect();
768
769 // Should tokenize without panicking
770 assert!(tokens.len() > 10);
771
772 // Check some specific tokens
773 let words: Vec<_> = tokens
774 .iter()
775 .filter(|t| t.kind() == TokenKind::Word)
776 .collect();
777 assert!(words.iter().any(|t| t.as_str() == "pub"));
778 assert!(words.iter().any(|t| t.as_str() == "fn"));
779 assert!(words.iter().any(|t| t.as_str() == "calculate"));
780 assert!(words.iter().any(|t| t.as_str() == "i32"));
781 }
782
783 #[test]
784 fn test_tokenizer_javascript_arrow() {

Callers

nothing calls this directly

Calls 3

collectMethod · 0.45
iterMethod · 0.45
kindMethod · 0.45

Tested by

no test coverage detected