xbasic 0.1.1

A library that allows adding a scripting language onto your project with ease. This lets your users write their own arbitrary logic.
Documentation
use xbasic::xbasic::XBasic;

mod common;

#[test]
fn not_1() {
	common::test_program("print not not 5\n", "true\n");
}

#[test]
fn not_2() {
	common::test_program("print not true\n", "false\n");
}

#[test]
fn not_3() {
	let mut tio = common::TestIO::new("");
	{
		let mut xb = XBasic::new(&mut tio);
		assert!(xb.run("print not \"test\"\n").is_err());
		assert!(xb.error_handler.had_runtime_error);
		assert_eq!(
			xb.error_handler.errors,
			["[line 1] Error : Cannot cast string to boolean."]
		);
	}
	tio.check();
}

#[test]
fn neg_1() {
	common::test_program("print 3 + -5\n", "-2\n");
}

#[test]
fn neg_2() {
	common::test_program("print -(-5)\n", "5\n");
}

#[test]
fn neg_3() {
	let mut tio = common::TestIO::new("");
	{
		let mut xb = XBasic::new(&mut tio);
		assert!(xb.run("print -\"test\"\n").is_err());
		assert!(xb.error_handler.had_runtime_error);
		assert_eq!(
			xb.error_handler.errors,
			["[line 1] Error : Cannot cast string to number."]
		);
	}
	tio.check();
}