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

Function do_ok_test

core/src/lexer.rs:807–820  ·  view source on GitHub ↗

Runs the lexer on the given `input` and expects the returned tokens to match `exp_token_spans`.

(input: &str, exp_token_spans: &[TokenSpan])

Source from the content-addressed store, hash-verified

805 /// Runs the lexer on the given `input` and expects the returned tokens to match
806 /// `exp_token_spans`.
807 fn do_ok_test(input: &str, exp_token_spans: &[TokenSpan]) {
808 let mut input = input.as_bytes();
809 let mut lexer = Lexer::from(&mut input);
810
811 let mut token_spans: Vec<TokenSpan> = vec![];
812 let mut eof = false;
813 while !eof {
814 let token_span = lexer.read().expect("Lexing failed");
815 eof = token_span.token == Token::Eof;
816 token_spans.push(token_span);
817 }
818
819 assert_eq!(exp_token_spans, token_spans.as_slice());
820 }
821
822 #[test]
823 fn test_empty() {

Callers 15

test_read_past_eofFunction · 0.70
test_whitespace_onlyFunction · 0.70
test_multiple_linesFunction · 0.70
test_tabsFunction · 0.70
test_some_tokensFunction · 0.70
test_boolean_literalsFunction · 0.70
test_integer_literalsFunction · 0.70
test_utf8Function · 0.70
test_remarksFunction · 0.70
test_shebangFunction · 0.70
test_invalid_hashesFunction · 0.70
test_var_typesFunction · 0.70

Calls 3

as_bytesMethod · 0.80
pushMethod · 0.80
readMethod · 0.45

Tested by 15

test_read_past_eofFunction · 0.56
test_whitespace_onlyFunction · 0.56
test_multiple_linesFunction · 0.56
test_tabsFunction · 0.56
test_some_tokensFunction · 0.56
test_boolean_literalsFunction · 0.56
test_integer_literalsFunction · 0.56
test_utf8Function · 0.56
test_remarksFunction · 0.56
test_shebangFunction · 0.56
test_invalid_hashesFunction · 0.56
test_var_typesFunction · 0.56