Skip to content

Commit 0be519d

Browse files
committed
browser-rs: rename in test
1 parent 39e98b6 commit 0be519d

File tree

1 file changed

+6
-31
lines changed

1 file changed

+6
-31
lines changed

app/saji/tests/saji.rs

+6-31
Original file line numberDiff line numberDiff line change
@@ -13,50 +13,25 @@ use alloc::string::String;
1313
use core::borrow::Borrow;
1414
use hashbrown::HashMap;
1515
use liumlib::*;
16-
use saji::ast::{Node, Parser};
17-
use saji::runtime::{Runtime, RuntimeValue};
18-
use saji::token::Lexer;
19-
20-
#[cfg(test)]
21-
pub trait Testable {
22-
fn run(&self) -> ();
23-
}
24-
25-
#[cfg(test)]
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-
#[cfg(test)]
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-
}
16+
use saji::ast::{JsParser, Node};
17+
use saji::runtime::{JsRuntime, RuntimeValue};
18+
use saji::token::JsLexer;
4419

4520
#[macro_export]
4621
macro_rules! run_test {
4722
($input:expr, $expected_global_variables:expr) => {
48-
let lexer = Lexer::new($input);
23+
let lexer = JsLexer::new($input);
4924
println!("lexer {:?}", lexer);
5025

51-
let mut parser = Parser::new(lexer);
26+
let mut parser = JsParser::new(lexer);
5227
let ast = parser.parse_ast();
5328
println!("---------------------------------");
5429
for n in ast.body() {
5530
print_ast(&Some(n.clone()), 0);
5631
}
5732
println!("---------------------------------");
5833

59-
let mut runtime = Runtime::new();
34+
let mut runtime = JsRuntime::new();
6035
runtime.execute(&ast);
6136

6237
//let result_global_variables = &runtime.global_variables;

0 commit comments

Comments
 (0)