mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
tests: make the failures of vmodules_overrides_test.v more informative
This commit is contained in:
parent
416b37bcb3
commit
0fe2d6052d
1 changed files with 6 additions and 5 deletions
|
@ -10,6 +10,8 @@ const basepath = os.real_path(os.join_path(vroot, 'vlib', 'v', 'tests', 'multipl
|
|||
|
||||
const mainvv = os.join_path(basepath, 'main.vv')
|
||||
|
||||
const cmd = '${os.quoted_path(vexe)} run ${os.quoted_path(mainvv)}'
|
||||
|
||||
fn test_vexe_is_set() {
|
||||
assert vexe != ''
|
||||
println('vexe: ${vexe}')
|
||||
|
@ -18,11 +20,9 @@ fn test_vexe_is_set() {
|
|||
fn test_compiling_without_vmodules_fails() {
|
||||
os.chdir(vroot) or {}
|
||||
os.setenv('VMODULES', '', true)
|
||||
cmd := '${os.quoted_path(vexe)} run ${os.quoted_path(mainvv)}'
|
||||
dump(cmd)
|
||||
res := os.execute(cmd)
|
||||
assert res.exit_code == 1
|
||||
dump(res)
|
||||
assert res.exit_code == 1, res.output
|
||||
assert res.output.trim_space().contains('builder error: cannot import module "yyy" (not found)')
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,8 @@ fn test_compiling_with_vmodules_works() {
|
|||
os.chdir(vroot) or {}
|
||||
vmpaths := ['path1', 'path2', 'path3'].map(os.join_path(basepath, it))
|
||||
os.setenv('VMODULES', vmpaths.join(os.path_delimiter), true)
|
||||
res := os.execute('${os.quoted_path(vexe)} run ${os.quoted_path(mainvv)}')
|
||||
assert res.exit_code == 0
|
||||
dump(cmd)
|
||||
res := os.execute(cmd)
|
||||
assert res.exit_code == 0, res.output
|
||||
assert res.output.trim_space() == "['x', 'y', 'z']"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue