tools: move _test.v files for vdoc at the same level (#21473)

This commit is contained in:
Delyan Angelov 2024-05-08 17:29:49 +03:00 committed by GitHub
parent 972a137087
commit 8eaaba6094
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 11 additions and 12 deletions

View file

@ -24,13 +24,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build V - name: Build V
run: make -j4 run: make -j4 && ./v symlink
- name: Install markdown from vpm
run: v retry -- v install markdown
- name: Test v doc - name: Test v doc
run: | run: ./v test cmd/tools/vdoc/
# While the integration tests (executing the v doc command) should install
# markdown automatically, unit tests won't. Run integration tests first.
./v test cmd/tools/vdoc/tests/
./v test cmd/tools/vdoc/*.v
- name: Build module documentation - name: Build module documentation
run: ./v doc -m -f html vlib/ run: ./v doc -m -f html vlib/
- name: Deploy docs to vercel - name: Deploy docs to vercel

View file

@ -191,5 +191,5 @@ The VDOC test vdoc_file_test.v now also supports VAUTOFIX, which is
useful, if you change anything inside cmd/tools/vdoc or vlib/v/doc/, useful, if you change anything inside cmd/tools/vdoc or vlib/v/doc/,
or inside the modules that it depends on (like markdown). or inside the modules that it depends on (like markdown).
After such changes, just run this command *2 times*, and commit the After such changes, just run this command *2 times*, and commit the
resulting changes in `cmd/tools/vdoc/tests/testdata` as well: resulting changes in `cmd/tools/vdoc/testdata` as well:
`VAUTOFIX=1 ./v cmd/tools/vdoc/tests/vdoc_file_test.v` `VAUTOFIX=1 ./v cmd/tools/vdoc/vdoc_file_test.v`

View file

@ -13,8 +13,9 @@ fn test_output() {
os.setenv('VCOLORS', 'never', true) os.setenv('VCOLORS', 'never', true)
os.chdir(vroot)! os.chdir(vroot)!
mut total_fails := 0 mut total_fails := 0
test_files := vtest.filter_vtest_only(os.walk_ext('cmd/tools/vdoc/tests/testdata', test_files := vtest.filter_vtest_only(os.walk_ext('cmd/tools/vdoc/testdata', '.v'),
'.v'), basepath: vroot) basepath: vroot
)
for path in test_files { for path in test_files {
mut fails := 0 mut fails := 0
qpath := os.quoted_path(path) qpath := os.quoted_path(path)
@ -45,7 +46,7 @@ fn test_output() {
fn test_run_examples_good() { fn test_run_examples_good() {
os.setenv('VCOLORS', 'never', true) os.setenv('VCOLORS', 'never', true)
os.chdir(vroot)! os.chdir(vroot)!
res := os.execute('${vexe} doc -comments -run-examples cmd/tools/vdoc/tests/testdata/run_examples_good/main.v') res := os.execute('${vexe} doc -comments -run-examples cmd/tools/vdoc/testdata/run_examples_good/main.v')
assert res.exit_code == 0 assert res.exit_code == 0
assert res.output.contains('module main'), res.output assert res.output.contains('module main'), res.output
assert res.output.contains('fn abc()'), res.output assert res.output.contains('fn abc()'), res.output
@ -57,7 +58,7 @@ fn test_run_examples_good() {
fn test_run_examples_bad() { fn test_run_examples_bad() {
os.setenv('VCOLORS', 'never', true) os.setenv('VCOLORS', 'never', true)
os.chdir(vroot)! os.chdir(vroot)!
res := os.execute('${vexe} doc -comments -run-examples cmd/tools/vdoc/tests/testdata/run_examples_bad/main.v') res := os.execute('${vexe} doc -comments -run-examples cmd/tools/vdoc/testdata/run_examples_bad/main.v')
assert res.exit_code != 0 assert res.exit_code != 0
assert res.output.contains('error in documentation example'), res.output assert res.output.contains('error in documentation example'), res.output
assert res.output.contains(' left value: 5 * 5 = 25'), res.output assert res.output.contains(' left value: 5 * 5 = 25'), res.output