@@ -13,50 +13,25 @@ use alloc::string::String;
13
13
use core:: borrow:: Borrow ;
14
14
use hashbrown:: HashMap ;
15
15
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 ;
44
19
45
20
#[ macro_export]
46
21
macro_rules! run_test {
47
22
( $input: expr, $expected_global_variables: expr) => {
48
- let lexer = Lexer :: new( $input) ;
23
+ let lexer = JsLexer :: new( $input) ;
49
24
println!( "lexer {:?}" , lexer) ;
50
25
51
- let mut parser = Parser :: new( lexer) ;
26
+ let mut parser = JsParser :: new( lexer) ;
52
27
let ast = parser. parse_ast( ) ;
53
28
println!( "---------------------------------" ) ;
54
29
for n in ast. body( ) {
55
30
print_ast( & Some ( n. clone( ) ) , 0 ) ;
56
31
}
57
32
println!( "---------------------------------" ) ;
58
33
59
- let mut runtime = Runtime :: new( ) ;
34
+ let mut runtime = JsRuntime :: new( ) ;
60
35
runtime. execute( & ast) ;
61
36
62
37
//let result_global_variables = &runtime.global_variables;
0 commit comments