-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_fixed_v1.2.5.bash
More file actions
executable file
·48 lines (35 loc) · 1.01 KB
/
test_fixed_v1.2.5.bash
File metadata and controls
executable file
·48 lines (35 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash -xv
# SPDX-FileCopyrightText: 2025 Ryuichi Ueda ryuichiueda@gmail.com
# SPDX-License-Identifier: GPL-3.0-or-later
err () {
echo $0 >> ./error
echo "ERROR!" FILE: $0, LINENO: $1
rm -f $tmp-*
exit 1
}
repo_dir=${2:-~/GIT/rusty_bash}
test_dir="$PWD"
com="$repo_dir/target/debug/sush"
cd "$repo_dir"
tmp=/tmp/$$
[ "$1" == "nobuild" ] || cargo build || err $LINENO
cd "$test_dir"
res=$($com <<< 'f () { echo hoge ; } ; declare -f f')
[ $? -eq 0 ] || err $LINENO
res=$($com <<< 'f () { echo hoge ; } ; declare -f -- f')
[ $? -eq 0 ] || err $LINENO
res=$($com <<< 'a= ; echo ${#a[*]}')
[ "$res" = "1" ] || err $LINENO
res=$($com <<< 'a= ; echo ${#a[@]}')
[ "$res" = "1" ] || err $LINENO
res=$($com <<< 'a=b ; echo ${#a[@]}')
[ "$res" = "1" ] || err $LINENO
res=$($com <<< 'declare a ; echo ${#a[@]}')
[ "$res" = "0" ] || err $LINENO
res=$($com -c 'shopt -q progcomp')
[ $? -eq 0 ] || err $LINENO
res=$($com <<< 'shopt -u progcomp ; shopt -q progcomp')
[ $? -eq 1 ] || err $LINENO
rm -f $tmp-*
echo $0 >> ./ok
exit