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

Function test_input_ok

std/src/console/cmds.rs:800–817  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

798
799 #[test]
800 fn test_input_ok() {
801 fn t(stmt: &str, input: &str, output: &str) {
802 Tester::default().add_input_chars(input).run(stmt).expect_prints([output]).check();
803 }
804
805 t("INPUT foo\nPRINT foo", "9\n", " 9");
806 t("INPUT ; foo\nPRINT foo", "9\n", " 9");
807 t("INPUT ; foo\nPRINT foo", "-9\n", "-9");
808 t("INPUT , bar?\nPRINT bar", "true\n", "TRUE");
809 t("INPUT ; foo$\nPRINT foo", "\n", "");
810 t("INPUT \"With question mark\"; a$\nPRINT a$", "some long text\n", "some long text");
811
812 Tester::default()
813 .add_input_chars("42\n")
814 .run("prompt$ = \"Indirectly without question mark\"\nINPUT prompt$, b\nPRINT b * 2")
815 .expect_prints([" 84"])
816 .check();
817 }
818
819 #[test]
820 fn test_input_on_predefined_vars() {

Callers

nothing calls this directly

Calls 5

tFunction · 0.85
checkMethod · 0.45
expect_printsMethod · 0.45
runMethod · 0.45
add_input_charsMethod · 0.45

Tested by

no test coverage detected