Permalink
Browse files

Cleaning up the spec/ dir.

- Move more free-standing scripts to gold/
- Combine errexit tests
- Move data to spec/testdata/
  • Loading branch information...
Andy Chu
Andy Chu committed Nov 8, 2017
1 parent ba59db6 commit 0aebe9ecce98b8f4b6246c5b716149d36c34f604
File renamed without changes.
File renamed without changes.
@@ -7,14 +7,18 @@
set -o pipefail
set -o errexit
printenv() {
spec/bin/printenv.py "$@"
}
f1() {
local f1_str=f1_str
local f1_exported=f1_exported
export f1_exported
echo -n 'in f1: '
printenv.py f1_exported
printenv f1_exported
f1_global=f1_global
export f1_global
@@ -29,24 +33,24 @@ echo $f1_str
# end.
echo -n 'global: '
printenv.py f1_exported
printenv f1_exported
echo $f1_exported
f1_global=AAA # mutate exported variable
echo $f1_global
printenv.py f1_global
printenv f1_global
# oil:setandexport
export E1=E1_VAL
printenv.py E1
printenv E1
unset E1
echo "E1: $E1" # no longer set
printenv.py E1 # no longer exported
printenv E1 # no longer exported
export E1=E1_VAL
export -n E1
echo "E1: $E1" # Still set! export and export -n aren't inverses.
printenv.py E1
printenv E1
echo ---
@@ -58,4 +62,4 @@ E3=E3_VAL
myexport E2=E2_VAL E3
echo "E2: $E2"
echo "E3: $E3"
printenv.py E2 E3
printenv E2 E3
@@ -6,6 +6,10 @@
set -o pipefail
set -o errexit
printenv() {
spec/bin/printenv.py "$@"
}
my_global=G1
func() {
@@ -75,7 +79,7 @@ combined() {
# This doesn't work!
export readonly local __EIGHT=eight
printenv.py __ONE __TWO __THREE __FOUR __FIVE __SIX __SEVEN __EIGHT
printenv __ONE __TWO __THREE __FOUR __FIVE __SIX __SEVEN __EIGHT
# export can come first, but local can't come first
# These are both -a
View
@@ -92,4 +92,18 @@ test-fail-or() {
echo DONE
}
succeed() {
return 0
}
fail() {
return 1
}
test-func-with-and() {
succeed && echo "OK 1"
fail && echo "OK 2" # Swallos the error because of errexit, not good!
succeed && echo "OK 3"
}
"$@"
View

This file was deleted.

Oops, something went wrong.
View
@@ -31,8 +31,8 @@ echo [!bin
# stdout: [!bin
### glob can expand to command and arg
spec/echo.s[hz]
# stdout: spec/echo.sz
spec/testdata/echo.s[hz]
# stdout: spec/testdata/echo.sz
### glob after var expansion
touch _tmp/a.A _tmp/aa.A _tmp/b.B
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -104,10 +104,20 @@ complex-here-docs() {
_compare gold/complex-here-docs.sh
}
comments() { _compare gold/comments.sh; }
export() { _compare gold/export.sh; }
# Needs declare -p
declare() { _compare gold/declare.sh demo; }
# Needs declare -p
scope() { _compare gold/scope.sh; }
all() {
# This one differs by timestamp
version-text
comments
readonly_
count
one-spec-test

0 comments on commit 0aebe9e

Please sign in to comment.