Skip to content

Commit 3be6aaf

Browse files
committed
t/test-lib test_equal: Expected may be glob pattern to match actual
This is done simply by using Bash `[[` instead of POSIX `[` test. Also change the `==` comparison to `=`; Bash was accepting the former but it's not POSIX.
1 parent 96e5205 commit 3be6aaf

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

t/10-test-lib.t

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
. t/test-lib.sh
3-
echo '1..5'
3+
echo '1..6'
44

55

66
##### 1
@@ -44,3 +44,12 @@ end_test
4444
start_test 'test_equal failure'
4545
expect_fails test_equal 'abc' 'XYZ'
4646
end_test
47+
48+
##### 6
49+
start_test 'test_equal glob'
50+
test_equal 'a*' 'abc'
51+
expect_fails test_equal 'abc' 'Abc'
52+
test_equal '[Aa]bc' 'Abc'
53+
test_equal '[Aa]bc' 'abc'
54+
expect_fails test_equal 'abc' '[Aa]bc'
55+
end_test

t/test-lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ test_equal() {
6060
return
6161
}
6262

63-
[ "$expected" == "$actual" ] || {
63+
[[ $actual = $expected ]] || {
6464
fail_test
6565
echo "# Expected: '$expected'"
6666
echo "# Actual: '$actual'"

0 commit comments

Comments
 (0)