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
|
#!/bin/bash
# Always run the tests from this script's folder
cd "$(dirname "$0")" || exit 1
# Read default configuration
# shellcheck source=test/_include.sh
source ../_include.sh
# Run sedsed for each invalid command.
# Each test is ok if sedsed raises an error message.
while read -r line
do
test_message "Testing $line"
# Make sure output only contains text sent to stderr
output=$($sedsed -e "$line" 2>&1 >/dev/null || true)
if ! echo "$output" | grep -q '^ERROR:'
then
failed=1
echo 'TEST FAILED'
echo "$output"
fi
done < invalid-commands.txt
tests_clean_up
tests_exit
|