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

Function test_data

core/src/parser.rs:2421–2480  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2419
2420 #[test]
2421 fn test_data() {
2422 do_ok_test("DATA", &[Statement::Data(DataSpan { values: vec![None] })]);
2423
2424 do_ok_test("DATA , ", &[Statement::Data(DataSpan { values: vec![None, None] })]);
2425 do_ok_test(
2426 "DATA , , ,",
2427 &[Statement::Data(DataSpan { values: vec![None, None, None, None] })],
2428 );
2429
2430 do_ok_test(
2431 "DATA 1: DATA 2",
2432 &[
2433 Statement::Data(DataSpan {
2434 values: vec![Some(Expr::Integer(IntegerSpan { value: 1, pos: lc(1, 6) }))],
2435 }),
2436 Statement::Data(DataSpan {
2437 values: vec![Some(Expr::Integer(IntegerSpan { value: 2, pos: lc(1, 14) }))],
2438 }),
2439 ],
2440 );
2441
2442 do_ok_test(
2443 "DATA TRUE, -3, 5.1, \"foo\"",
2444 &[Statement::Data(DataSpan {
2445 values: vec![
2446 Some(Expr::Boolean(BooleanSpan { value: true, pos: lc(1, 6) })),
2447 Some(Expr::Integer(IntegerSpan { value: -3, pos: lc(1, 12) })),
2448 Some(Expr::Double(DoubleSpan { value: 5.1, pos: lc(1, 16) })),
2449 Some(Expr::Text(TextSpan { value: "foo".to_owned(), pos: lc(1, 21) })),
2450 ],
2451 })],
2452 );
2453
2454 do_ok_test(
2455 "DATA , TRUE, , 3, , 5.1, , \"foo\",",
2456 &[Statement::Data(DataSpan {
2457 values: vec![
2458 None,
2459 Some(Expr::Boolean(BooleanSpan { value: true, pos: lc(1, 8) })),
2460 None,
2461 Some(Expr::Integer(IntegerSpan { value: 3, pos: lc(1, 16) })),
2462 None,
2463 Some(Expr::Double(DoubleSpan { value: 5.1, pos: lc(1, 21) })),
2464 None,
2465 Some(Expr::Text(TextSpan { value: "foo".to_owned(), pos: lc(1, 28) })),
2466 None,
2467 ],
2468 })],
2469 );
2470
2471 do_ok_test(
2472 "DATA -3, -5.1",
2473 &[Statement::Data(DataSpan {
2474 values: vec![
2475 Some(Expr::Integer(IntegerSpan { value: -3, pos: lc(1, 6) })),
2476 Some(Expr::Double(DoubleSpan { value: -5.1, pos: lc(1, 10) })),
2477 ],
2478 })],

Callers

nothing calls this directly

Calls 1

do_ok_testFunction · 0.70

Tested by

no test coverage detected