Skip to content

Commit

Permalink
Add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Dec 22, 2024
1 parent 31a2bd8 commit ba06bdc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 1 addition & 2 deletions test/ok
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
./test_script.bash
./test_options.bash
./test_glob.bash
./test_brace.bash
./test_builtins.bash
./test_brace.bash
./test_parameters.bash
./test_compound.bash
./test_others.bash
./test_job.bash
../test/test_compound.bash
12 changes: 8 additions & 4 deletions test/test_parameters.bash
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ res=$($com -c 'echo $(( $EPOCHREALTIME - $(date +%s) )) | awk -F. "{print \$1}"'
res=$($com -c 'A=1 ; f () { local A ; declare -r A ; A=123 ; } ; f')
[[ "$?" -eq 1 ]] || err $LINENO

#res=$($com -c 'A=1 ; f () { local -a A ; A[1]=123 ; echo ${A[@]} ; } ; f ; echo $A')
#[[ "$res" == '123
#1' ]] || err $LINENO
res=$($com -c 'A=1 ; f () { local -a A ; A[1]=123 ; echo ${A[@]} ; } ; f ; echo $A')
[[ "$res" == '123
1' ]] || err $LINENO

res=$($com -c 'A=1 ; f () { local -a A ; A=(2 123) ; echo ${A[@]} ; } ; f ; echo $A')
[[ "$res" == '2 123
1' ]] || err $LINENO

res=$($com -c 'f () { local A ; declare -r A ; A=123 ; } ; f; A=3 ; echo $A')
[[ "$res" -eq 3 ]] || err $LINENO
Expand All @@ -54,7 +58,7 @@ res=$($com -c 'A=1 ; declare -r A ; A=(3 4)')
[[ "$?" -eq 1 ]] || err $LINENO

### ARRAY ###
#

res=$($com <<< 'declare -a A; A[0]=bbb; echo ${A[aaa]}')
[ "$res" == "bbb" ] || err $LINENO

Expand Down

0 comments on commit ba06bdc

Please sign in to comment.