summaryrefslogtreecommitdiffstats
path: root/tests/fake_formatter.sh
diff options
context:
space:
mode:
authorSteven Arcangeli <506791+stevearc@users.noreply.github.com>2023-12-26 06:38:00 -0800
committerGitHub <noreply@github.com>2023-12-26 06:38:00 -0800
commitf245cca8ad42c9d344b53a18c3fc1a3c6724c2d4 (patch)
tree71cf24c9888024ce02706e3d1e544187729dcf09 /tests/fake_formatter.sh
parent7396fc0208539e2bd70e3e446f27529e28dba12b (diff)
fix(injected): handle inline injections (#251)
Diffstat (limited to 'tests/fake_formatter.sh')
-rwxr-xr-xtests/fake_formatter.sh26
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/fake_formatter.sh b/tests/fake_formatter.sh
index a060a4c..75f92ff 100755
--- a/tests/fake_formatter.sh
+++ b/tests/fake_formatter.sh
@@ -2,16 +2,24 @@
set -e
-if [ -e "tests/fake_formatter_output" ]; then
- cat tests/fake_formatter_output
-else
- cat
+CODE=0
+if [ "$1" = "--fail" ]; then
+ shift
+ echo "failure" >&2
+ CODE=1
+fi
+if [ "$1" = "--timeout" ]; then
+ shift
+ echo "timeout" >&2
+ sleep 4
fi
-if [ "$1" = "--fail" ]; then
- echo "failure" >&2
- exit 1
-elif [ "$1" = "--timeout" ]; then
- sleep 4
+output_file="$1"
+
+if [ -n "$output_file" ] && [ -e "$output_file" ]; then
+ cat "$output_file"
+else
+ cat
fi
+exit $CODE