Skip to content

Commit

Permalink
[test/spec] Reorganize test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy C committed Jan 21, 2022
1 parent 9c55be9 commit 44ddf18
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 35 deletions.
30 changes: 0 additions & 30 deletions spec/sh-usage.test.sh
Expand Up @@ -88,33 +88,3 @@ $SH --login -c 'exit 0'
## status: 0
## OK dash status: 2
## OK mksh status: 1

#### $PATH is set if unset at startup

# Get absolute path before changing PATH
sh=$(which $SH)

old_path=$PATH
unset PATH

$sh -c 'echo $PATH' > path.txt

PATH=$old_path

# looks like PATH=/usr/bin:/bin for mksh, but more complicated for others
# cat path.txt

# should contain /usr/bin
if egrep -q '(^|:)/usr/bin($|:)' path.txt; then
echo yes
fi

# should contain /bin
if egrep -q '(^|:)/bin($|:)' path.txt ; then
echo yes
fi

## STDOUT:
yes
yes
## END
31 changes: 31 additions & 0 deletions spec/special-vars.test.sh → spec/vars-special.test.sh
Expand Up @@ -21,6 +21,37 @@ env | grep PWD
## status: 0
## BUG mksh status: 1

#### $PATH is set if unset at startup

# Get absolute path before changing PATH
sh=$(which $SH)

old_path=$PATH
unset PATH

$sh -c 'echo $PATH' > path.txt

PATH=$old_path

# looks like PATH=/usr/bin:/bin for mksh, but more complicated for others
# cat path.txt

# should contain /usr/bin
if egrep -q '(^|:)/usr/bin($|:)' path.txt; then
echo yes
fi

# should contain /bin
if egrep -q '(^|:)/bin($|:)' path.txt ; then
echo yes
fi

## STDOUT:
yes
yes
## END


#### $HOME is NOT set
case $SH in *zsh) echo 'zsh sets HOME'; exit ;; esac

Expand Down
10 changes: 5 additions & 5 deletions test/spec.sh
Expand Up @@ -459,6 +459,11 @@ vars-bash() {
$BASH $OSH_LIST "$@"
}

vars-special() {
sh-spec spec/vars-special.test.sh --osh-failures-allowed 6 \
${REF_SHELLS[@]} $ZSH $OSH_LIST "$@"
}

# This is bash/OSH only
builtin-completion() {
sh-spec spec/builtin-completion.test.sh --osh-failures-allowed 1 \
Expand Down Expand Up @@ -544,11 +549,6 @@ posix() {
${REF_SHELLS[@]} $OSH_LIST "$@"
}

special-vars() {
sh-spec spec/special-vars.test.sh --osh-failures-allowed 6 \
${REF_SHELLS[@]} $ZSH $OSH_LIST "$@"
}

introspect() {
sh-spec spec/introspect.test.sh --osh-failures-allowed 0 \
$BASH $OSH_LIST "$@"
Expand Down

0 comments on commit 44ddf18

Please sign in to comment.