From 22a7b4f0c8e018077984d58476a0c419b5e11942 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 2 Apr 2023 10:33:40 -0300 Subject: aux/checks/repo.sh: WIP Fix tests --- repo.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 repo.sh (limited to 'repo.sh') diff --git a/repo.sh b/repo.sh new file mode 100755 index 0000000..7d81867 --- /dev/null +++ b/repo.sh @@ -0,0 +1,33 @@ +#!/bin/sh +set -eu + +f() { + set -e + bad-command + unreachable + return 0 +} + +f && echo 'Executed, but shoult not' + +if f; then + echo 'Also executed, but should not' +fi + +f || echo 'Not executed, but should be' + +if ! f; then + echo 'Also not executed, but should be' +fi + +set -x +set +e +f +STATUS=$? +set -e +if [ "$STATUS" != 0 ]; then + echo 'Only one that is executed when it should be' +fi + +f +echo 'This is *actually* unreachable' -- cgit v1.2.3