mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vdoc: include the project root folder, when searching for readme of src/
(#19000)
This commit is contained in:
parent
1c2b4e76dc
commit
e78e468d5f
1
cmd/tools/vdoc/tests/testdata/readme_in_project_root/README.md
vendored
Normal file
1
cmd/tools/vdoc/tests/testdata/readme_in_project_root/README.md
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
hello from readme
|
3
cmd/tools/vdoc/tests/testdata/readme_in_project_root/src/main.comments.out
vendored
Normal file
3
cmd/tools/vdoc/tests/testdata/readme_in_project_root/src/main.comments.out
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module foo
|
||||||
|
|
||||||
|
fn bar()
|
4
cmd/tools/vdoc/tests/testdata/readme_in_project_root/src/main.readme.comments.out
vendored
Normal file
4
cmd/tools/vdoc/tests/testdata/readme_in_project_root/src/main.readme.comments.out
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
hello from readme
|
||||||
|
module foo
|
||||||
|
|
||||||
|
fn bar()
|
3
cmd/tools/vdoc/tests/testdata/readme_in_project_root/src/main.v
vendored
Normal file
3
cmd/tools/vdoc/tests/testdata/readme_in_project_root/src/main.v
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module foo
|
||||||
|
|
||||||
|
pub fn bar() {}
|
0
cmd/tools/vdoc/tests/testdata/readme_in_project_root/v.mod
vendored
Normal file
0
cmd/tools/vdoc/tests/testdata/readme_in_project_root/v.mod
vendored
Normal file
@ -52,6 +52,11 @@ fn check_path(vexe string, dir string, tests []string) int {
|
|||||||
cmd: '${os.quoted_path(vexe)} doc -comments ${os.quoted_path(program)}'
|
cmd: '${os.quoted_path(vexe)} doc -comments ${os.quoted_path(program)}'
|
||||||
out_filename: 'main.comments.out'
|
out_filename: 'main.comments.out'
|
||||||
)
|
)
|
||||||
|
fails += check_output(
|
||||||
|
program: program
|
||||||
|
cmd: '${os.quoted_path(vexe)} doc -readme -comments ${os.quoted_path(program)}'
|
||||||
|
out_filename: 'main.readme.comments.out'
|
||||||
|
)
|
||||||
total_fails += fails
|
total_fails += fails
|
||||||
if fails == 0 {
|
if fails == 0 {
|
||||||
println(term.green('OK'))
|
println(term.green('OK'))
|
||||||
|
@ -233,6 +233,9 @@ fn (vd VDoc) get_readme(path string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if fname == '' {
|
if fname == '' {
|
||||||
|
if path.all_after_last(os.path_separator) == 'src' {
|
||||||
|
return vd.get_readme(path.all_before_last(os.path_separator))
|
||||||
|
}
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
readme_path := os.join_path(path, '${fname}.md')
|
readme_path := os.join_path(path, '${fname}.md')
|
||||||
|
Loading…
Reference in New Issue
Block a user