Skip to content

Commit d61fbe8

Browse files
authored
vdoc: fix flaky location of output path in vdoc_file_test.v (#27020)
1 parent c3d0a97 commit d61fbe8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cmd/tools/vdoc/vdoc_file_test.v

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ fn test_out_path() {
7272
test_path := os.join_path(os.vtmp_dir(), 'vdoc_test_${rand.ulid()}')
7373
test_mod_path := os.join_path(test_path, small_pure_v_vlib_module)
7474
os.mkdir_all(test_path)!
75+
// Sentinel v.mod so that vdoc's get_parent_mod() stops climbing here instead of
76+
// picking up stray .v files in ancestor tmp dirs (e.g. /private/tmp on macOS).
77+
os.write_file(os.join_path(test_path, 'v.mod'), "Module { name: 'vdoc_test' }\n")!
7578
defer {
7679
os.chdir(vroot) or {}
7780
os.rmdir_all(test_path) or {}
@@ -82,7 +85,7 @@ fn test_out_path() {
8285

8386
// Relative input with default output path.
8487
os.execute_opt('${vexe} doc -f html -m ${small_pure_v_vlib_module}')!
85-
output_path := os.join_path(mod_path, '_docs', '${small_pure_v_vlib_module}.html')
88+
output_path := os.join_path(test_mod_path, '_docs', '${small_pure_v_vlib_module}.html')
8689
assert os.exists(output_path), output_path
8790

8891
// Custom out path (no `_docs` subdir).

0 commit comments

Comments
 (0)