Skip to content

Commit

Permalink
Add test script for shell scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Aug 22, 2024
1 parent 6e51108 commit 977698f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/error
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
./test_script.bash
./test_script.bash
./test_script.bash
./test_script.bash
25 changes: 25 additions & 0 deletions test/test_script.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash -xv
# SPDX-FileCopyrightText: 2023 Ryuichi Ueda ryuichiueda@gmail.com
# SPDX-License-Identifier: BSD-3-Clause

err () {
echo $0 >> ./error
echo "ERROR!" FILE: $0, LINENO: $1
exit 1
}

tmp=/tmp/$$

[ "$1" == "nobuild" ] || cargo build --release || err $LINENO

cd $(dirname $0)
com=../target/release/sush

LANG=C ./lineno.bash 2> $tmp-bash
LANG=C ./lineno.sush 2> $tmp-sush

sed 's/sush/bash/g' $tmp-sush |
diff $tmp-bash - || err $LINENO


echo $0 >> ./ok

0 comments on commit 977698f

Please sign in to comment.