1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

jsgen: tests: ensure output deletion on fail (#6875)

This commit is contained in:
Lukas Neubert 2020-11-20 01:15:32 +01:00 committed by GitHub
parent d50c919879
commit a67873f6cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,25 +6,23 @@ const (
v_options = '-b js -w'
)
fn testsuite_end() {
os.rmdir_all(output_dir)
}
fn test_example_compilation() {
vexe := os.getenv('VEXE')
os.chdir(os.dir(vexe))
os.mkdir_all(output_dir)
files := find_test_files()
for file in files {
path := os.join_path(test_dir, file)
println('Testing $file')
v_code := os.system('$vexe $v_options -o ${output_dir}${file}.js $path')
if v_code != 0 { assert false } // Compilation failed
js_code := os.system('node ${output_dir}${file}.js')
if js_code != 0 { assert false } // Running failed
}
os.rmdir_all(output_dir)
}
fn find_test_files() []string {