test.sh
This commit is contained in:
@@ -1,21 +1,5 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
main() {
|
|
||||||
for t in $(grep ^test_* ./notea_test.sh | sed 's/(.*//'); do
|
|
||||||
each
|
|
||||||
echo run $t >&2
|
|
||||||
if ! eval "$t"; then
|
|
||||||
echo failed $t >&2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
each() {
|
|
||||||
export CACHE=$(mktemp -d)
|
|
||||||
source ./notea.sh
|
|
||||||
source ./cache.sh
|
|
||||||
}
|
|
||||||
|
|
||||||
test_ids() {
|
test_ids() {
|
||||||
notea eval "$(cat <<EOF
|
notea eval "$(cat <<EOF
|
||||||
ncurl() {
|
ncurl() {
|
||||||
@@ -53,7 +37,3 @@ test_get() {
|
|||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$0" == "$BASH_SOURCE" ]; then
|
|
||||||
main "$@"
|
|
||||||
fi
|
|
||||||
|
|||||||
41
app/crawler/test.sh
Normal file
41
app/crawler/test.sh
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
main() {
|
||||||
|
local ret=0
|
||||||
|
for f in ./*_test.sh; do
|
||||||
|
if ! one_main "$f"; then
|
||||||
|
echo failed $f >&2
|
||||||
|
ret=$((ret+1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ $ret != 0 ]; then
|
||||||
|
echo failed >&2
|
||||||
|
fi
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
one_main() (
|
||||||
|
echo testing $f >&2
|
||||||
|
local f="$1"
|
||||||
|
local ret=0
|
||||||
|
for t in $(grep ^test_ "$f" | sed 's/(.*//'); do
|
||||||
|
echo testing $f:$t >&2
|
||||||
|
each
|
||||||
|
source "${f%_test.sh}.sh"
|
||||||
|
source "$f"
|
||||||
|
if ! eval "$t"; then
|
||||||
|
echo failed $f:$t >&2
|
||||||
|
ret=$((ret+1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return $ret
|
||||||
|
)
|
||||||
|
|
||||||
|
each() {
|
||||||
|
export CACHE=$(mktemp -d)
|
||||||
|
source ./cache.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$0" == "$BASH_SOURCE" ]; then
|
||||||
|
main "$@"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user