tests: add testshell.sh and port old testsuite.txt
Add a simple helper script testshell.sh that can be called to set up an environment for generating test case transcripts that can then be pasted into an actual test script. Port old testsuite.txt into t9999-testsuite_example.sh with the aim of refactoring it later into smaller tests. Also, change test_todo_session to count from one instead of zero when autogenerating tests. Signed-off-by: Emil Sit <sit@emilsit.net>
This commit is contained in:
committed by
Emil Sit
parent
b238a29430
commit
d6c57e4230
@@ -471,7 +471,7 @@ test_tick () {
|
||||
test_todo_session () {
|
||||
test "$#" = 1 ||
|
||||
error "bug in the test script: extra args to test_todo_session"
|
||||
subnum=0
|
||||
subnum=1
|
||||
cmd=""
|
||||
status=0
|
||||
> expect
|
||||
@@ -513,6 +513,18 @@ test_todo_session () {
|
||||
fi
|
||||
}
|
||||
|
||||
test_shell () {
|
||||
trap - EXIT
|
||||
export PS1='$(ret_val=$?; [ "$ret_val" != "0" ] && echo -e "=== $ret_val\n\n>>> "||echo "\n>>> ")'
|
||||
cat <<EOF
|
||||
Do your tests session here and
|
||||
don't forget to replace the hardcoded path with \$HOME in the transcript:
|
||||
$HOME/todo.txt => \$HOME/todo.txt
|
||||
EOF
|
||||
bash --noprofile --norc
|
||||
exit 0
|
||||
}
|
||||
|
||||
test_init_todo "$test"
|
||||
# Use -P to resolve symlinks in our working directory so that the cwd
|
||||
# in subprocesses equals our $PWD (for pathname comparisons).
|
||||
|
||||
Reference in New Issue
Block a user