diff --git a/vlib/v/gen/native/tests/native_test.v b/vlib/v/gen/native/tests/native_test.v index 6bb1ae19bc..f10ff80701 100644 --- a/vlib/v/gen/native/tests/native_test.v +++ b/vlib/v/gen/native/tests/native_test.v @@ -5,6 +5,16 @@ import term const is_verbose = os.getenv('VTEST_SHOW_CMD') != '' const user_os = os.user_os() +const wrkdir = os.join_path(os.vtmp_dir(), 'native_tests') + +fn testsuite_begin() { + os.mkdir_all(wrkdir) or {} + os.chdir(wrkdir) or {} +} + +fn testsuite_end() { + os.rmdir_all(wrkdir) or {} +} // TODO: some logic copy pasted from valgrind_test.v and compiler_test.v, move to a module fn test_native() { @@ -23,13 +33,6 @@ fn test_native() { dir := os.join_path(vroot, 'vlib', 'v', 'gen', 'native', 'tests') files := os.ls(dir) or { panic(err) } - wrkdir := os.join_path(os.vtmp_dir(), 'native_tests') - os.mkdir_all(wrkdir) or { panic(err) } - defer { - os.rmdir_all(wrkdir) or {} - } - - os.chdir(wrkdir) or {} tests := files.filter(it.ends_with('.vv')).sorted() if tests.len == 0 { println('no native tests found') @@ -144,3 +147,10 @@ fn test_native() { exit(1) } } + +fn test_prevent_could_not_find_symbols_regression() { + res := os.execute('${os.quoted_path(@VEXE)} -b native ${os.quoted_path(os.join_path(@VROOT, + 'examples/hello_world.v'))}') + assert !res.output.contains('CaptureStackBackTrace'), 'Test failed system unable to find symbol: CaptureStackBackTrace' + assert !res.output.contains('__debugbreak'), 'Test failed system unable to find symbol: __debugbreak' +} diff --git a/vlib/v/gen/native/tests/pe_test.v b/vlib/v/gen/native/tests/pe_test.v deleted file mode 100644 index 96183b08ca..0000000000 --- a/vlib/v/gen/native/tests/pe_test.v +++ /dev/null @@ -1,9 +0,0 @@ -module tests - -import os - -fn test_prevent_could_not_find_symbols_regression() { - res := os.execute('${os.quoted_path(@VEXE)} -b native examples/hello_world.v') - assert !res.output.contains('CaptureStackBackTrace'), 'Test failed system unable to find symbol: CaptureStackBackTrace' - assert !res.output.contains('__debugbreak'), 'Test failed system unable to find symbol: __debugbreak' -}