Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Apr 10, 2024
1 parent 37b4081 commit baefedf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cmd/tools/vdoc/tests/vdoc_file_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@ fn test_run_examples_bad() {
assert res.output.contains('Example: assert 5 * 5 == 77'), res.output
}

fn test_out_path() {
// Default out paths.
mut expected_out_dir := os.join_path(vroot, 'vlib', 'arrays', '_docs')
os.rmdir_all(expected_out_dir) or {}
os.execute_opt('${vexe} doc -f html -m vlib/arrays')!
assert os.exists(os.join_path(expected_out_dir, 'arrays.html'))
os.rmdir_all(expected_out_dir) or {}

expected_out_dir = os.join_path(vroot, 'vlib', 'builtin', '_docs')
os.rmdir_all(expected_out_dir) or {}
os.execute_opt('${vexe} doc -f html -m vlib/builtin')!
assert os.exists(os.join_path(expected_out_dir, 'builtin.html'))
os.rmdir_all(expected_out_dir) or {}

// Custom out path.
tmp_out := os.join_path(os.vtmp_dir(), 'docs_test')
os.rmdir_all(tmp_out) or {}
defer {
os.rmdir_all(tmp_out) or {}
}
os.execute_opt('${vexe} doc -f html -m -o ${tmp_out} vlib/arrays')!
assert os.exists(os.join_path(tmp_out, 'arrays.html'))
}

fn get_main_files_in_dir(dir string) []string {
mut mfiles := os.walk_ext(dir, '.v')
mfiles.sort()
Expand Down

0 comments on commit baefedf

Please sign in to comment.