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

Function test_data

core/src/lexer.rs:1197–1216  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1195
1196 #[test]
1197 fn test_data() {
1198 do_ok_test("DATA", &[ts(Token::Data, 1, 1, 4), ts(Token::Eof, 1, 5, 0)]);
1199
1200 do_ok_test("data", &[ts(Token::Data, 1, 1, 4), ts(Token::Eof, 1, 5, 0)]);
1201
1202 // Common BASIC interprets things like "2 + foo" as a single string but we interpret
1203 // separate tokens. "Fixing" this to read data in the same way requires entering a
1204 // separate lexing mode just for DATA statements, which is not very interesting. We can
1205 // ask for strings to always be double-quoted.
1206 do_ok_test(
1207 "DATA 2 + foo",
1208 &[
1209 ts(Token::Data, 1, 1, 4),
1210 ts(Token::Integer(2), 1, 6, 1),
1211 ts(Token::Plus, 1, 8, 1),
1212 ts(new_auto_symbol("foo"), 1, 10, 3),
1213 ts(Token::Eof, 1, 13, 0),
1214 ],
1215 );
1216 }
1217
1218 #[test]
1219 fn test_declare() {

Callers

nothing calls this directly

Calls 3

tsFunction · 0.85
new_auto_symbolFunction · 0.85
do_ok_testFunction · 0.70

Tested by

no test coverage detected