-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To make sure an invalid command is detected as such, and an error message is shown to the user. Covers the problems found in issues #3 and #48.
- Loading branch information
1 parent
a47b085
commit dc04d78
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
u | ||
s | ||
s/ | ||
s// | ||
s/foo | ||
s/foo\/foo | ||
s/foo/bar | ||
s/foo/bar\/bar | ||
s/foo/bar/@ | ||
s/foo/bar/@g | ||
s/foo/bar/g@ | ||
s/foo/bar// | ||
s/foo/bar/w | ||
y | ||
y/ | ||
y// | ||
y/a | ||
y/a/b | ||
y/a/b/g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/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" | ||
output=$($sedsed -e "$line" || 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 |