tests: make the failures of vmodules_overrides_test.v more informative

This commit is contained in:
Delyan Angelov 2024-05-23 17:57:55 +03:00
parent 416b37bcb3
commit 0fe2d6052d
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED

View file

@ -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 mainvv = os.join_path(basepath, 'main.vv')
const cmd = '${os.quoted_path(vexe)} run ${os.quoted_path(mainvv)}'
fn test_vexe_is_set() { fn test_vexe_is_set() {
assert vexe != '' assert vexe != ''
println('vexe: ${vexe}') println('vexe: ${vexe}')
@ -18,11 +20,9 @@ fn test_vexe_is_set() {
fn test_compiling_without_vmodules_fails() { fn test_compiling_without_vmodules_fails() {
os.chdir(vroot) or {} os.chdir(vroot) or {}
os.setenv('VMODULES', '', true) os.setenv('VMODULES', '', true)
cmd := '${os.quoted_path(vexe)} run ${os.quoted_path(mainvv)}'
dump(cmd) dump(cmd)
res := os.execute(cmd) res := os.execute(cmd)
assert res.exit_code == 1 assert res.exit_code == 1, res.output
dump(res)
assert res.output.trim_space().contains('builder error: cannot import module "yyy" (not found)') 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 {} os.chdir(vroot) or {}
vmpaths := ['path1', 'path2', 'path3'].map(os.join_path(basepath, it)) vmpaths := ['path1', 'path2', 'path3'].map(os.join_path(basepath, it))
os.setenv('VMODULES', vmpaths.join(os.path_delimiter), true) os.setenv('VMODULES', vmpaths.join(os.path_delimiter), true)
res := os.execute('${os.quoted_path(vexe)} run ${os.quoted_path(mainvv)}') dump(cmd)
assert res.exit_code == 0 res := os.execute(cmd)
assert res.exit_code == 0, res.output
assert res.output.trim_space() == "['x', 'y', 'z']" assert res.output.trim_space() == "['x', 'y', 'z']"
} }