Skip to content

Commit ece0088

Browse files
Vampiretnyblom
authored andcommitted
Fail test execution if there were duplicate test names (#106)
1 parent 572a8ba commit ece0088

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

test.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,28 @@ else
3838
fi
3939

4040
mkdir -p "$SCRIPT_DIR/build/tmp"
41-
TMPDIR="$SCRIPT_DIR/build/tmp" test/libs/bats-core/bin/bats "$@"
41+
{
42+
TMPDIR="$SCRIPT_DIR/build/tmp" \
43+
test/libs/bats-core/bin/bats "$@" \
44+
4>&1 1>&2 2>&4 |
45+
awk '
46+
BEGIN {
47+
duplicate_test_names = ""
48+
}
49+
50+
{
51+
print
52+
}
53+
54+
/duplicate test name/ {
55+
duplicate_test_names = duplicate_test_names "\n\t" $0
56+
}
57+
58+
END {
59+
if (length(duplicate_test_names)) {
60+
print "\nERROR: duplicate test name(s) found:" duplicate_test_names
61+
exit 1
62+
}
63+
}
64+
'
65+
} 4>&1 1>&2 2>&4

test/empty-dirs.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ load 'common'
10601060
assert_equal "$(git -C git-repo show branch-a:dir-a/.gitignore)" '/ignore-a'
10611061
}
10621062

1063-
@test 'branching with svn-ignore, svn-branches and empty-dirs parameter should not replace filled .gitignore files with empty ones' {
1063+
@test 'branching with svn-ignore, svn-branches and empty-dirs parameter should not replace filled .gitignore files with empty ones (nested)' {
10641064
svn mkdir project-a
10651065
cd project-a
10661066
svn mkdir --parents trunk/dir-a

0 commit comments

Comments
 (0)