tests: enable running `v test .` inside vlib/v/ too

pull/6423/head
Delyan Angelov 2020-09-18 19:20:01 +03:00
parent b4535acbac
commit 78e6ddee75
3 changed files with 6 additions and 2 deletions

View File

@ -150,9 +150,9 @@ fn worker_trunner(mut p sync.PoolProcessor, idx int, thread_id int) voidptr {
} }
tls_bench.no_cstep = true tls_bench.no_cstep = true
dot_relative_file := p.get_string_item(idx) dot_relative_file := p.get_string_item(idx)
mut relative_file := dot_relative_file mut relative_file := dot_relative_file.replace('./', '')
if ts.root_relative { if ts.root_relative {
relative_file = relative_file.replace(ts.vroot + os.path_separator, '').replace('./', '') relative_file = relative_file.replace(ts.vroot + os.path_separator, '')
} }
file := os.real_path(relative_file) file := os.real_path(relative_file)
// Ensure that the generated binaries will be stored in the temporary folder. // Ensure that the generated binaries will be stored in the temporary folder.

View File

@ -7,6 +7,7 @@ fn test_all() {
mut total_errors := 0 mut total_errors := 0
vexe := os.getenv('VEXE') vexe := os.getenv('VEXE')
vroot := os.dir(vexe) vroot := os.dir(vexe)
os.chdir(vroot)
diff_cmd := util.find_working_diff_command() or { diff_cmd := util.find_working_diff_command() or {
'' ''
} }

View File

@ -1,6 +1,9 @@
import vmod import vmod
import os
fn test_from_file() { fn test_from_file() {
os.chdir(os.dir(os.getenv('VEXE')))
data := vmod.from_file('./v.mod') or { data := vmod.from_file('./v.mod') or {
panic(err) panic(err)
} }