2019-08-18 18:21:48 +03:00
|
|
|
import os
|
2019-09-15 18:08:16 +03:00
|
|
|
import compiler.tests.repl.runner
|
2019-08-26 13:51:48 +03:00
|
|
|
|
|
|
|
fn test_the_v_compiler_can_be_invoked() {
|
2019-09-15 18:08:16 +03:00
|
|
|
vexec := runner.full_path_to_v()
|
2019-08-26 13:51:48 +03:00
|
|
|
println('vexecutable: $vexec')
|
|
|
|
assert vexec != ''
|
|
|
|
|
|
|
|
vcmd := '$vexec --version'
|
|
|
|
r := os.exec(vcmd) or { panic(err) }
|
|
|
|
//println('"$vcmd" exit_code: $r.exit_code | output: $r.output')
|
|
|
|
assert r.exit_code == 0
|
|
|
|
|
|
|
|
vcmd_error := '$vexec nonexisting.v'
|
|
|
|
r_error := os.exec(vcmd_error) or { panic(err) }
|
|
|
|
//println('"$vcmd_error" exit_code: $r_error.exit_code | output: $r_error.output')
|
|
|
|
assert r_error.exit_code == 1
|
|
|
|
assert r_error.output == '`nonexisting.v` does not exist'
|
|
|
|
}
|
|
|
|
|
2019-09-15 18:08:16 +03:00
|
|
|
fn test_all_v_repl_files() {
|
|
|
|
options := runner.new_options()
|
|
|
|
global_start_time := runner.now()
|
|
|
|
for file in options.files {
|
|
|
|
sticks := runner.now()
|
|
|
|
fres := runner.run_repl_file(options.wd, options.vexec, file) or {
|
2019-08-26 13:51:48 +03:00
|
|
|
assert false
|
2019-09-15 18:08:16 +03:00
|
|
|
eprintln( runner.tdiff_in_ms(err, sticks) )
|
|
|
|
continue
|
2019-08-26 13:51:48 +03:00
|
|
|
}
|
2019-09-15 18:08:16 +03:00
|
|
|
assert true
|
|
|
|
println( runner.tdiff_in_ms(fres, sticks) )
|
2019-08-26 13:51:48 +03:00
|
|
|
}
|
2019-09-15 18:08:16 +03:00
|
|
|
println( runner.tdiff_in_ms('<=== total time spent running REPL files', global_start_time) )
|
2019-08-22 14:15:11 +03:00
|
|
|
}
|
2019-09-15 18:08:16 +03:00
|
|
|
|