diff --git a/vlib/v/checker/checker_test.v b/vlib/v/checker/checker_test.v index 4a4cfad238..3f621b1006 100644 --- a/vlib/v/checker/checker_test.v +++ b/vlib/v/checker/checker_test.v @@ -1,10 +1,15 @@ import os import term +fn clean_line_endings(s string) string { + return s.trim_space().replace(' \n', '\n').replace(' \r\n', '\n').replace('\r\n', '\n').trim('\n') +} + fn test_all() { mut total_errors := 0 vexe := os.getenv('VEXE') - // vroot := os.dir(vexe) + vroot := os.dir(vexe) + os.chdir(vroot) dir := 'vlib/v/checker/tests' files := os.ls(dir) or { panic(err) @@ -16,8 +21,8 @@ fn test_all() { } for test in tests { path := os.join_path(dir, test).replace('\\', '/') - print(test + ' ') program := path.replace('.vv', '.v') + print(program + ' ') os.cp(path, program) or { panic(err) } @@ -28,10 +33,8 @@ fn test_all() { mut expected := os.read_file(program.replace('.v', '') + '.out') or { panic(err) } - expected = expected.trim_space().replace(' \n', '\n').replace(' \r\n', '\n').replace('\r\n', - '\n').trim('\n') - found := res.output.trim_space().replace(' \n', '\n').replace(' \r\n', '\n').replace('\r\n', - '\n').trim('\n') + expected = clean_line_endings(expected) + found := clean_line_endings(res.output) if expected != found { println(term.red('FAIL')) println('============') @@ -44,6 +47,7 @@ fn test_all() { total_errors++ } else { println(term.green('OK')) + os.rm( program ) } } assert total_errors == 0 diff --git a/vlib/v/checker/tests/ambiguous_function_call_a.v b/vlib/v/checker/tests/ambiguous_function_call_a.v deleted file mode 100644 index e8ec08cdf7..0000000000 --- a/vlib/v/checker/tests/ambiguous_function_call_a.v +++ /dev/null @@ -1,7 +0,0 @@ -fn foo(foo int) { - foo(foo + 1) -} - -fn main() { - foo(5) -} diff --git a/vlib/v/checker/tests/ambiguous_function_call_b.v b/vlib/v/checker/tests/ambiguous_function_call_b.v deleted file mode 100644 index c1dbab3b34..0000000000 --- a/vlib/v/checker/tests/ambiguous_function_call_b.v +++ /dev/null @@ -1,8 +0,0 @@ -fn foo() { - foo := 1 - foo(foo) -} - -fn main() { - foo() -} diff --git a/vlib/v/checker/tests/division_by_zero_float_err.v b/vlib/v/checker/tests/division_by_zero_float_err.v deleted file mode 100644 index b5c1e7cb0b..0000000000 --- a/vlib/v/checker/tests/division_by_zero_float_err.v +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println(1.0/0.0) -} diff --git a/vlib/v/checker/tests/division_by_zero_int_err.v b/vlib/v/checker/tests/division_by_zero_int_err.v deleted file mode 100644 index 996814a9a6..0000000000 --- a/vlib/v/checker/tests/division_by_zero_int_err.v +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println(1/0) -} diff --git a/vlib/v/checker/tests/struct_field_name_duplicate_err.v b/vlib/v/checker/tests/struct_field_name_duplicate_err.v deleted file mode 100644 index e59e586300..0000000000 --- a/vlib/v/checker/tests/struct_field_name_duplicate_err.v +++ /dev/null @@ -1,5 +0,0 @@ -struct A { - a int - a string -} -fn main(){}