summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/testbench.rs22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/testbench.rs b/src/testbench.rs
index 9de4db1..6d9ea16 100644
--- a/src/testbench.rs
+++ b/src/testbench.rs
@@ -28,6 +28,13 @@ impl Test {
return self.text.as_ref().unwrap();
}
+
+ pub fn text(&self) -> &str {
+ return match &self.text {
+ Some(text) => text,
+ None => "",
+ }
+ }
}
#[derive(Default)]
@@ -46,10 +53,15 @@ impl Bench {
let lua_setup = lua.context(|context| -> rlua::Result<()> {
use rlua::{String, Variadic};
+ let globals = context.globals();
+
let ui_table = context.create_table()?;
- let ui_print = context.create_function(|_, strings: Variadic<String>| Ok(()))?;
+ let ui_print = context.create_function(|_, strings: Variadic<String>| {
+ Ok(())
+ })?;
ui_table.set("print", ui_print)?;
+ globals.set("ui", ui_table)?;
Ok(())
});
@@ -66,16 +78,14 @@ impl Bench {
};
// TODO: set graphically and use RV
- b.load_tests("lua");
+ b.load_tests();
return b;
}
- pub fn load_tests<P>(&mut self, path: P) -> io::Result<()>
- where
- P: AsRef<Path>,
+ pub fn load_tests(&mut self) -> io::Result<()>
{
- let entries: Result<Vec<PathBuf>, io::Error> = fs::read_dir(path)?
+ let entries: Result<Vec<PathBuf>, io::Error> = fs::read_dir(&self.tests_path)?
.into_iter()
.map(|r| r.map(|f| f.path()))
.collect();