use xbasic::xbasic::XBasic;
mod common;
#[test]
fn uninitialized_variable() {
common::test_program("print a\n", "0\n");
}
#[test]
fn initialized_variable() {
common::test_program("a = 3\nprint a\n", "3\n");
}
#[test]
fn variable_persists_runs() {
let tio = common::TestIO::new("3\n");
let mut xb = XBasic::new(tio);
assert!(xb.run("a = 3\n").is_ok());
assert!(xb.run("true and \"hi\"").is_err());
xb.clear_errors();
assert!(xb.run("print a\n").is_ok());
xb.get_io().check();
}
#[test]
fn mutable_variable() {
common::test_program("a = 3\nprint a\na = 5\nprint a\n", "3\n5\n");
}
#[test]
fn z_in_identifier() {
common::test_program("Z = 3\nprint Z\nZ = 5\nprint Z\n", "3\n5\n");
}