1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/compiler/tests/repl/repl_test.v
Delyan Angelov 53c64abdeb compiler: make compiler an ordinary vlib/compiler module
* Move compiler/ under vlib/compiler/ .

* Add a minimal compiler/main.v driver program.

* Cleanup compiler/main.v .

* Make most compiler tests pass again.

* Apply the fix by @joe-conigliaro , so that the rest of the compiler tests are fixed too.

* Thanks to @avitkauskas, now the vlib/vcompiler/tests/str_gen_test.v test does not need to be special cased anymore.

* Reapply @joe-conigliaro fix for vgen.
2019-10-13 16:37:43 +03:00

41 lines
1.0 KiB
V

import os
import compiler.tests.repl.runner
import benchmark
fn test_the_v_compiler_can_be_invoked() {
vexec := runner.full_path_to_v()
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'
}
fn test_all_v_repl_files() {
options := runner.new_options()
mut bmark := benchmark.new_benchmark()
for file in options.files {
bmark.step()
fres := runner.run_repl_file(options.wd, options.vexec, file) or {
bmark.fail()
eprintln( bmark.step_message(err) )
assert false
continue
}
bmark.ok()
println( bmark.step_message(fres) )
assert true
}
bmark.stop()
println( bmark.total_message('total time spent running REPL files') )
}