xbasic 0.3.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::basic_io::BasicIO;
use xbasic::xbasic::XBasic;

pub struct TestIO {
	expected: &'static str,
	actual: String,
}

impl TestIO {
	pub fn new(expected: &'static str) -> Self {
		Self {
			expected,
			actual: String::new(),
		}
	}

	pub fn check(&self) {
		assert_eq!(self.expected, self.actual);
	}
}

impl BasicIO for TestIO {
	fn read_line(&mut self) -> String {
		unimplemented!()
	}

	fn write_line(&mut self, line: String) {
		self.actual += &(line + "\n");
	}
}

#[allow(dead_code)]
pub fn test_program(program: &'static str, expected: &'static str) {
	let tio = TestIO::new(expected);

	let mut xb = XBasic::new(tio);
	match xb.run(program) {
		Ok(_) => (),
		Err(_) => {
			for error in xb.error_handler.errors {
				println!("{}", error);
			}
			panic!();
		}
	}
	xb.get_io().check();
}