From 22e4ff4cc3f53a743ed9032ae26baba70f8f472d Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Sun, 28 Feb 2016 19:43:32 +0000 Subject: [PATCH] tests for -e, --exit-on-fail --- .../Flags/-e,--exit-on-fail | 8 ++++---- .../Flags/.test_-e,--exit-on-fail/.urchin | 0 tests/Flags/.test_-e,--exit-on-fail/1 should run. | 0 .../Flags/.test_-e,--exit-on-fail}/2 should run. | 0 .../Flags/.test_-e,--exit-on-fail}/3 should not run. | 0 .../Flags/.test_-e,--exit-on-fail}/4 should not run. | 0 tests/Flags/setup | 1 + tests/Flags/teardown | 1 + urchin | 2 +- 9 files changed, 7 insertions(+), 5 deletions(-) rename tests.old/Exit on fail if -e is passed. => tests/Flags/-e,--exit-on-fail (68%) rename tests.old/.die-on-fail/1 should run. => tests/Flags/.test_-e,--exit-on-fail/.urchin (100%) mode change 100755 => 100644 create mode 100755 tests/Flags/.test_-e,--exit-on-fail/1 should run. rename {tests.old/.die-on-fail => tests/Flags/.test_-e,--exit-on-fail}/2 should run. (100%) rename {tests.old/.die-on-fail => tests/Flags/.test_-e,--exit-on-fail}/3 should not run. (100%) rename {tests.old/.die-on-fail => tests/Flags/.test_-e,--exit-on-fail}/4 should not run. (100%) create mode 100644 tests/Flags/setup create mode 100644 tests/Flags/teardown diff --git a/tests.old/Exit on fail if -e is passed. b/tests/Flags/-e,--exit-on-fail similarity index 68% rename from tests.old/Exit on fail if -e is passed. rename to tests/Flags/-e,--exit-on-fail index d9c3d22..32c5ab7 100755 --- a/tests.old/Exit on fail if -e is passed. +++ b/tests/Flags/-e,--exit-on-fail @@ -1,11 +1,11 @@ -tmp=$(mktemp) -../urchin -e -f ./.die-on-fail > $tmp +#!/bin/sh + +../../urchin -e ./.test_-e,--exit-on-fail > $tmp result=$? +set -e grep '1 should run.' $tmp grep '2 should run.' $tmp grep -v '3 should not run.' $tmp grep -v '4 should not run.' $tmp - -rm $tmp exit $result diff --git a/tests.old/.die-on-fail/1 should run. b/tests/Flags/.test_-e,--exit-on-fail/.urchin old mode 100755 new mode 100644 similarity index 100% rename from tests.old/.die-on-fail/1 should run. rename to tests/Flags/.test_-e,--exit-on-fail/.urchin diff --git a/tests/Flags/.test_-e,--exit-on-fail/1 should run. b/tests/Flags/.test_-e,--exit-on-fail/1 should run. new file mode 100755 index 0000000..e69de29 diff --git a/tests.old/.die-on-fail/2 should run. b/tests/Flags/.test_-e,--exit-on-fail/2 should run. similarity index 100% rename from tests.old/.die-on-fail/2 should run. rename to tests/Flags/.test_-e,--exit-on-fail/2 should run. diff --git a/tests.old/.die-on-fail/3 should not run. b/tests/Flags/.test_-e,--exit-on-fail/3 should not run. similarity index 100% rename from tests.old/.die-on-fail/3 should not run. rename to tests/Flags/.test_-e,--exit-on-fail/3 should not run. diff --git a/tests.old/.die-on-fail/4 should not run. b/tests/Flags/.test_-e,--exit-on-fail/4 should not run. similarity index 100% rename from tests.old/.die-on-fail/4 should not run. rename to tests/Flags/.test_-e,--exit-on-fail/4 should not run. diff --git a/tests/Flags/setup b/tests/Flags/setup new file mode 100644 index 0000000..e01b6ff --- /dev/null +++ b/tests/Flags/setup @@ -0,0 +1 @@ +export tmp=$(mktemp) diff --git a/tests/Flags/teardown b/tests/Flags/teardown new file mode 100644 index 0000000..1069296 --- /dev/null +++ b/tests/Flags/teardown @@ -0,0 +1 @@ +rm $tmp diff --git a/urchin b/urchin index eff4da3..5de2b74 100755 --- a/urchin +++ b/urchin @@ -492,7 +492,7 @@ fi # Run or present the Molly guard. root="$(urchin_root "$1")" if basename "$(fullpath "$root")" | - grep -Fi 'test' > /dev/null || $force; then + grep -i 'test' > /dev/null || $force; then start=$(date +%s) set +e