@@ -11,18 +11,19 @@ mod common;
1111#[ test_case( include_str!( "programs/refs.ed" ) , "refs" , false , 2 , & [ ] ; "refs" ) ]
1212#[ test_case( include_str!( "programs/struct.ed" ) , "struct" , false , 5 , & [ ] ; "r#struct" ) ]
1313#[ test_case( include_str!( "programs/casts.ed" ) , "casts" , false , 2 , & [ ] ; "casts" ) ]
14- #[ test_case( TEST_ADD , "TEST_ADD " , false , 2 , & [ ] ; "TEST_ADD " ) ]
15- #[ test_case( TEST_SUB , "TEST_SUB " , false , 1 , & [ ] ; "TEST_SUB " ) ]
16- #[ test_case( TEST_MUL , "TEST_MUL " , false , 4 , & [ ] ; "TEST_MUL" ) ]
17- #[ test_case( TEST_DIV , "TEST_DIV " , false , 2 , & [ ] ; "TEST_DIV" ) ]
18- #[ test_case( TEST_REM , "TEST_REM " , false , 0 , & [ ] ; "TEST_REM" ) ]
19- #[ test_case( TEST_IF_BOTH , "TEST_IF_BOTH " , false , 1 , & [ ] ; "TEST_IF_BOTH " ) ]
20- #[ test_case( TEST_IF_BOTH , "TEST_IF_BOTH " , false , 2 , & [ "a" ] ; "TEST_IF_BOTH args " ) ]
21- #[ test_case( TEST_IF_NO_ELSE , "TEST_IF_NO_ELSE " , false , 1 , & [ ] ; "TEST_IF_NO_ELSE " ) ]
22- #[ test_case( TEST_IF_NO_ELSE , "TEST_IF_NO_ELSE " , false , 2 , & [ "a" ] ; "TEST_IF_NO_ELSE args " ) ]
14+ #[ test_case( TEST_ADD , "test_add " , false , 2 , & [ ] ; "test_add " ) ]
15+ #[ test_case( TEST_SUB , "test_sub " , false , 1 , & [ ] ; "test_sub " ) ]
16+ #[ test_case( TEST_MUL , "test_mul " , false , 4 , & [ ] ; "TEST_MUL" ) ]
17+ #[ test_case( TEST_DIV , "test_div " , false , 2 , & [ ] ; "TEST_DIV" ) ]
18+ #[ test_case( TEST_REM , "test_rem " , false , 0 , & [ ] ; "TEST_REM" ) ]
19+ #[ test_case( TEST_IF_BOTH , "test_if_both " , false , 1 , & [ ] ; "test_if_both " ) ]
20+ #[ test_case( TEST_IF_BOTH , "test_if_both " , false , 2 , & [ "a" ] ; "test_if_both_args " ) ]
21+ #[ test_case( TEST_IF_NO_ELSE , "test_if_no_else " , false , 1 , & [ ] ; "test_if_no_else " ) ]
22+ #[ test_case( TEST_IF_NO_ELSE , "test_if_no_else " , false , 2 , & [ "a" ] ; "test_if_no_else_args " ) ]
2323fn example_tests ( source : & str , name : & str , is_library : bool , status_code : i32 , args : & [ & str ] ) {
2424 let program = compile_program ( source, name, is_library) . unwrap ( ) ;
2525
26+ dbg ! ( & program) ;
2627 assert ! ( program. binary_file. exists( ) , "program not compiled" ) ;
2728 let mut result = run_program ( & program. binary_file , args) . unwrap ( ) ;
2829 let status = result. wait ( ) . unwrap ( ) ;
@@ -35,63 +36,63 @@ fn example_tests(source: &str, name: &str, is_library: bool, status_code: i32, a
3536}
3637
3738const TEST_ADD : & str = r#"
38- mod Main {
39+
3940 pub fn main() -> i32 {
4041 let b: i32 = 1 + 1;
4142 return b;
4243 }
43- }
44+
4445"# ;
4546const TEST_SUB : & str = r#"
46- mod Main {
47+
4748 pub fn main() -> i32 {
4849 let b: i32 = 2 - 1;
4950 return b;
5051 }
51- }
52+
5253"# ;
5354const TEST_MUL : & str = r#"
54- mod Main {
55+
5556 pub fn main() -> i32 {
5657 let b: i32 = 2 * 2;
5758 return b;
5859 }
59- }
60+
6061"# ;
6162const TEST_DIV : & str = r#"
62- mod Main {
63+
6364 pub fn main() -> i32 {
6465 let b: i32 = 4 / 2;
6566 return b;
6667 }
67- }
68+
6869"# ;
6970const TEST_REM : & str = r#"
70- mod Main {
71+
7172 pub fn main() -> i32 {
7273 let b: i32 = 4 % 2;
7374 return b;
7475 }
75- }
76+
7677"# ;
7778const TEST_IF_BOTH : & str = r#"
78- mod Main {
79+
7980 pub fn main(argc: i32) -> i32 {
8081 if argc == 1 {
8182 return 1;
8283 } else {
8384 return 2;
8485 }
8586 }
86- }
87+
8788"# ;
8889const TEST_IF_NO_ELSE : & str = r#"
89- mod Main {
90+
9091 pub fn main(argc: i32) -> i32 {
9192 if argc == 1 {
9293 return 1;
9394 }
9495 return 2;
9596 }
96- }
97+
9798"# ;
0 commit comments