Add imported_type to e2e-tests

This commit is contained in:
Sofia 2025-07-26 14:05:06 +03:00
parent 0ba1fa90e7
commit 5991a75d32

View File

@ -34,9 +34,7 @@ fn test(source: &str, name: &str, expected_exit_code: Option<i32>) {
let time = SystemTime::now(); let time = SystemTime::now();
let in_path = PathBuf::from(format!( let in_path = PathBuf::from(format!(
"/tmp/temp-{}.o", "/tmp/temp-{}.o",
time.duration_since(SystemTime::UNIX_EPOCH) time.duration_since(SystemTime::UNIX_EPOCH).unwrap().as_nanos()
.unwrap()
.as_nanos()
)); ));
std::fs::write(&in_path, &output.obj_buffer).expect("Could not write OBJ-file!"); std::fs::write(&in_path, &output.obj_buffer).expect("Could not write OBJ-file!");
@ -60,19 +58,11 @@ fn test(source: &str, name: &str, expected_exit_code: Option<i32>) {
#[test] #[test]
fn arithmetic_compiles_well() { fn arithmetic_compiles_well() {
test( test(include_str!("../../examples/arithmetic.reid"), "test", Some(48));
include_str!("../../examples/arithmetic.reid"),
"test",
Some(48),
);
} }
#[test] #[test]
fn array_structs_compiles_well() { fn array_structs_compiles_well() {
test( test(include_str!("../../examples/array_structs.reid"), "test", Some(5));
include_str!("../../examples/array_structs.reid"),
"test",
Some(5),
);
} }
#[test] #[test]
fn array_compiles_well() { fn array_compiles_well() {
@ -84,11 +74,7 @@ fn borrow_compiles_well() {
} }
#[test] #[test]
fn borrow_hard_compiles_well() { fn borrow_hard_compiles_well() {
test( test(include_str!("../../examples/borrow_hard.reid"), "test", Some(17));
include_str!("../../examples/borrow_hard.reid"),
"test",
Some(17),
);
} }
#[test] #[test]
fn cast_compiles_well() { fn cast_compiles_well() {
@ -100,19 +86,11 @@ fn char_compiles_well() {
} }
#[test] #[test]
fn div_mod_compiles_well() { fn div_mod_compiles_well() {
test( test(include_str!("../../examples/div_mod.reid"), "test", Some(12));
include_str!("../../examples/div_mod.reid"),
"test",
Some(12),
);
} }
#[test] #[test]
fn fibonacci_compiles_well() { fn fibonacci_compiles_well() {
test( test(include_str!("../../examples/fibonacci.reid"), "test", Some(1));
include_str!("../../examples/fibonacci.reid"),
"test",
Some(1),
);
} }
#[test] #[test]
fn float_compiles_well() { fn float_compiles_well() {
@ -120,19 +98,11 @@ fn float_compiles_well() {
} }
#[test] #[test]
fn hello_world_compiles_well() { fn hello_world_compiles_well() {
test( test(include_str!("../../examples/hello_world.reid"), "test", None);
include_str!("../../examples/hello_world.reid"),
"test",
None,
);
} }
#[test] #[test]
fn mutable_compiles_well() { fn mutable_compiles_well() {
test( test(include_str!("../../examples/mutable.reid"), "test", Some(21));
include_str!("../../examples/mutable.reid"),
"test",
Some(21),
);
} }
#[test] #[test]
fn ptr_compiles_well() { fn ptr_compiles_well() {
@ -140,11 +110,7 @@ fn ptr_compiles_well() {
} }
#[test] #[test]
fn std_test_compiles_well() { fn std_test_compiles_well() {
test( test(include_str!("../../examples/std_test.reid"), "test", Some(3));
include_str!("../../examples/std_test.reid"),
"test",
Some(3),
);
} }
#[test] #[test]
fn strings_compiles_well() { fn strings_compiles_well() {
@ -160,34 +126,22 @@ fn loops_compiles_well() {
} }
#[test] #[test]
fn ptr_hard_compiles_well() { fn ptr_hard_compiles_well() {
test( test(include_str!("../../examples/ptr_hard.reid"), "test", Some(0));
include_str!("../../examples/ptr_hard.reid"),
"test",
Some(0),
);
} }
#[test] #[test]
fn loop_hard_compiles_well() { fn loop_hard_compiles_well() {
test( test(include_str!("../../examples/loop_hard.reid"), "test", Some(0));
include_str!("../../examples/loop_hard.reid"),
"test",
Some(0),
);
} }
#[test] #[test]
fn custom_binop_compiles_well() { fn custom_binop_compiles_well() {
test( test(include_str!("../../examples/custom_binop.reid"), "test", Some(21));
include_str!("../../examples/custom_binop.reid"),
"test",
Some(21),
);
} }
#[test] #[test]
fn array_short_compiles_well() { fn array_short_compiles_well() {
test( test(include_str!("../../examples/array_short.reid"), "test", Some(5));
include_str!("../../examples/array_short.reid"), }
"test", #[test]
Some(5), fn imported_type_compiles_well() {
); test(include_str!("../../examples/imported_type.reid"), "test", Some(0));
} }