From 6ea750da8d71881a399190ef5421790a7a47ea98 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 10 Sep 2021 12:43:53 +0300 Subject: [PATCH] v test-all: add a `v run examples/v_script.vsh` step too --- .github/workflows/ci.yml | 5 +++-- cmd/tools/vtest-all.v | 4 ++++ examples/v_script.vsh | 10 +++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e55d65bb3..518a939740 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,9 +107,10 @@ jobs: run: ./v -W build-tools - name: Test v binaries run: ./v build-vbinaries + - name: Run a VSH script + run: ./v run examples/v_script.vsh - name: Test v tutorials - run: | - ./v tutorials/building_a_simple_web_blog_with_vweb/code/blog + run: ./v tutorials/building_a_simple_web_blog_with_vweb/code/blog - name: Build cmd/tools/fast run: cd cmd/tools/fast && ../../../v fast.v && ./fast diff --git a/cmd/tools/vtest-all.v b/cmd/tools/vtest-all.v index 6c32d73578..b0544248e4 100644 --- a/cmd/tools/vtest-all.v +++ b/cmd/tools/vtest-all.v @@ -68,6 +68,10 @@ fn get_all_commands() []Command { okmsg: 'V prints the generated source code to stdout with `-o -` .' } } + res << Command{ + line: '$vexe run examples/v_script.vsh' + okmsg: 'V can run the .VSH script file examples/v_script.vsh' + } res << Command{ line: '$vexe -o vtmp cmd/v' okmsg: 'V can compile itself.' diff --git a/examples/v_script.vsh b/examples/v_script.vsh index 1cdf910bf6..fb76d9fa34 100644 --- a/examples/v_script.vsh +++ b/examples/v_script.vsh @@ -9,10 +9,10 @@ for _ in 0 .. 3 { } println('\nMaking dir "v_script_dir".') -mkdir('v_script_dir') +mkdir('v_script_dir') ? println("\nEntering into v_script_dir and listing it's files.") -chdir('v_script_dir') +chdir('v_script_dir') ? files := ls('.') or { panic(err.msg) } println(files) @@ -24,9 +24,9 @@ again_ls := ls('.') or { panic(err.msg) } println(again_ls) println('\nRemoving foo.txt and v_script_dir') -rm('foo.txt') -chdir('../') -rmdir('v_script_dir') +rm('foo.txt') ? +chdir('../') ? +rmdir('v_script_dir') ? print('\nDoes v_script_dir still exist? ') println(exists('v_script_dir'))