We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0be519d commit dd619ebCopy full SHA for dd619eb
app/saji/tests/saji.rs
@@ -17,6 +17,31 @@ use saji::ast::{JsParser, Node};
17
use saji::runtime::{JsRuntime, RuntimeValue};
18
use saji::token::JsLexer;
19
20
+#[cfg(test)]
21
+pub trait Testable {
22
+ fn run(&self) -> ();
23
+}
24
+
25
26
+impl<T> Testable for T
27
+where
28
+ T: Fn(),
29
+{
30
+ fn run(&self) {
31
+ print!("{} ...\t", core::any::type_name::<T>());
32
+ self();
33
+ println!("[ok]");
34
+ }
35
36
37
38
+pub fn test_runner(tests: &[&dyn Testable]) {
39
+ println!("Running {} tests in saji.rs", tests.len());
40
+ for test in tests {
41
+ test.run();
42
43
44
45
#[macro_export]
46
macro_rules! run_test {
47
($input:expr, $expected_global_variables:expr) => {
0 commit comments