From 794ceae0af3e9ff613b6a8176ba8851e23f9f6c8 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 11 Aug 2019 23:04:52 -0700 Subject: 5509 --- run_one_test | 22 ++++++++++++++++++++++ run_one_test.sh | 22 ---------------------- vimrc.vim | 4 ++-- 3 files changed, 24 insertions(+), 24 deletions(-) create mode 100755 run_one_test delete mode 100755 run_one_test.sh diff --git a/run_one_test b/run_one_test new file mode 100755 index 00000000..41844d82 --- /dev/null +++ b/run_one_test @@ -0,0 +1,22 @@ +#!/usr/bin/env zsh +# Either run the test with the given name, or rerun the most recently run test. +# Intended to be called from within Vim. Check out the vimrc.vim file. + +if [[ $2 == 'test-'* ]] +then + TEST_NAME=$2 envsubst '$TEST_NAME' < run_one_test.subx > /tmp/run_one_test.subx + FILES=$(ls [0-9]*.subx apps/subx-common.subx $1 |sort |uniq) + echo $FILES > /tmp/last_run_files +elif [[ -e /tmp/last_run_files ]] +then + FILES=`cat /tmp/last_run_files` +else + echo "no test found" + exit 0 # don't open trace +fi + +set -e + # turn newlines into spaces +CFLAGS=$CFLAGS ./subx --debug translate $(echo $FILES) /tmp/run_one_test.subx -o /tmp/a.elf + +./subx --debug --trace run /tmp/a.elf diff --git a/run_one_test.sh b/run_one_test.sh deleted file mode 100755 index caecd63c..00000000 --- a/run_one_test.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env zsh -# Either run the test with the given name, or rerun the most recently run test. -# Intended to be called from within Vim. Check out the vimrc.vim file. - -if [[ $2 == 'test-'* ]] -then - TEST_NAME=$2 envsubst '$TEST_NAME' < run_one_test.subx > /tmp/run_one_test.subx - FILES=$(ls [0-9]*.subx apps/subx-common.subx $1 |sort |uniq) - echo $FILES > /tmp/last_run_files -elif [[ -e /tmp/last_run_files ]] -then - FILES=`cat /tmp/last_run_files` -else - echo "no test found" - exit 0 # don't open trace -fi - -set -e - # turn newlines into spaces -CFLAGS=$CFLAGS ./subx --debug translate $(echo $FILES) /tmp/run_one_test.subx -o /tmp/a.elf - -./subx --debug --trace run /tmp/a.elf diff --git a/vimrc.vim b/vimrc.vim index bf81ebd2..2f39ad8d 100644 --- a/vimrc.vim +++ b/vimrc.vim @@ -86,11 +86,11 @@ command! -nargs=0 L exec "%!grep -a label |grep -v clear-stream:loop" " cursor on '#' causes error noremap t {j0:call RunTestMoveCursor("") function RunTestMoveCursor(arg) - exec "!run_one_test.sh ".expand("%")." ".a:arg + exec "!./run_one_test ".expand("%")." ".a:arg exec "normal \" endfunction function RunTestMoveCursorAndMaybeOpenTrace(arg) - exec "!run_one_test.sh ".expand("%")." ".a:arg + exec "!./run_one_test ".expand("%")." ".a:arg exec "normal \" if v:shell_error noautocmd vertical split last_run -- cgit 1.4.1-2-gfad0