()
| 978 | |
| 979 | #[test] |
| 980 | fn test_print_ok() { |
| 981 | Tester::default().run("PRINT").expect_prints([""]).check(); |
| 982 | Tester::default().run("PRINT ;").expect_output([CapturedOut::Write("".to_owned())]).check(); |
| 983 | Tester::default() |
| 984 | .run("PRINT ,") |
| 985 | .expect_output([CapturedOut::Write(" ".to_owned())]) |
| 986 | .check(); |
| 987 | Tester::default() |
| 988 | .run("PRINT ;,;,") |
| 989 | .expect_output([CapturedOut::Write(" ".to_owned())]) |
| 990 | .check(); |
| 991 | |
| 992 | Tester::default() |
| 993 | .run("PRINT \"1234567890123\", \"4\"") |
| 994 | .expect_prints(["1234567890123 4"]) |
| 995 | .check(); |
| 996 | Tester::default() |
| 997 | .run("PRINT \"12345678901234\", \"5\"") |
| 998 | .expect_prints(["12345678901234 5"]) |
| 999 | .check(); |
| 1000 | |
| 1001 | Tester::default().run("PRINT \"abcdefg\", 1").expect_prints(["abcdefg 1"]).check(); |
| 1002 | Tester::default().run("PRINT \"abcdefgh\", 1").expect_prints(["abcdefgh 1"]).check(); |
| 1003 | |
| 1004 | Tester::default().run("PRINT 3").expect_prints([" 3"]).check(); |
| 1005 | Tester::default().run("PRINT -3").expect_prints(["-3"]).check(); |
| 1006 | Tester::default().run("PRINT 3 = 5").expect_prints(["FALSE"]).check(); |
| 1007 | |
| 1008 | Tester::default().run("PRINT 3; -1; 4").expect_prints([" 3 -1 4"]).check(); |
| 1009 | Tester::default().run("PRINT \"foo\"; \"bar\"").expect_prints(["foobar"]).check(); |
| 1010 | Tester::default() |
| 1011 | .run(r#"PRINT "foo";: PRINT "bar""#) |
| 1012 | .expect_output([ |
| 1013 | CapturedOut::Write("foo".to_owned()), |
| 1014 | CapturedOut::Print("bar".to_owned()), |
| 1015 | ]) |
| 1016 | .check(); |
| 1017 | Tester::default() |
| 1018 | .run("PRINT true;123;\"foo bar\"") |
| 1019 | .expect_prints(["TRUE 123 foo bar"]) |
| 1020 | .check(); |
| 1021 | |
| 1022 | Tester::default() |
| 1023 | .run("PRINT 6,1;3,5") |
| 1024 | .expect_prints([" 6 1 3 5"]) |
| 1025 | .check(); |
| 1026 | |
| 1027 | Tester::default() |
| 1028 | .run(r#"word = "foo": PRINT word, word: PRINT word + "s""#) |
| 1029 | .expect_prints(["foo foo", "foos"]) |
| 1030 | .expect_var("word", "foo") |
| 1031 | .check(); |
| 1032 | |
| 1033 | Tester::default() |
| 1034 | .run(r#"word = "foo": PRINT word,: PRINT word;: PRINT word + "s""#) |
| 1035 | .expect_output([ |
| 1036 | CapturedOut::Write("foo ".to_owned()), |
| 1037 | CapturedOut::Write("foo".to_owned()), |
nothing calls this directly
no test coverage detected