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:
parent
d50c919879
commit
a67873f6cf
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user