diff options
| author | Jani Nikula <jani@nikula.org> | 2017-02-26 15:42:58 +0200 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2017-03-09 08:58:28 -0400 |
| commit | e563b8cafd394f673f0a768d46c18dd5da7411a5 (patch) | |
| tree | d12f0f09f8813f97141169065a56c94005806f8b | |
| parent | 13a59c4a8fc4ee418424e0b7ee4c8bbd5aae5da2 (diff) | |
test: ensure test_begin_subtest has been called before test_expect_*
This is the expectation, increase robustness of the test suite by
requiring it.
| -rw-r--r-- | test/test-lib.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh index 1bcf0df9..e7458c92 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -559,6 +559,9 @@ test_begin_subtest () test_expect_equal () { exec 1>&6 2>&7 # Restore stdout and stderr + if [ -z "$inside_subtest" ]; then + error "bug in the test script: test_expect_equal without test_begin_subtest" + fi inside_subtest= test "$#" = 3 && { prereq=$1; shift; } || prereq= test "$#" = 2 || @@ -583,6 +586,9 @@ test_expect_equal () test_expect_equal_file () { exec 1>&6 2>&7 # Restore stdout and stderr + if [ -z "$inside_subtest" ]; then + error "bug in the test script: test_expect_equal_file without test_begin_subtest" + fi inside_subtest= test "$#" = 3 && { prereq=$1; shift; } || prereq= test "$#" = 2 || @@ -630,6 +636,9 @@ test_emacs_expect_t () { test "$#" = 2 && { prereq=$1; shift; } || prereq= test "$#" = 1 || error "bug in the test script: not 1 or 2 parameters to test_emacs_expect_t" + if [ -z "$inside_subtest" ]; then + error "bug in the test script: test_emacs_expect_t without test_begin_subtest" + fi # Run the test. if ! test_skip "$test_subtest_name" |
