Skip to content

Commit 8ca65ae

Browse files
committed
t0040: convert a few tests to use test-parse-options --expect
As a small example of using "test-parse-options --expect", rewrite the "check" helper using it, instead of comparing the whole variable dump. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 32d51d4 commit 8ca65ae

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

t/t0040-parse-options.sh

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,12 @@ test_expect_success 'test help' '
5757

5858
mv expect expect.err
5959

60-
cat >expect.template <<\EOF
61-
boolean: 0
62-
integer: 0
63-
magnitude: 0
64-
timestamp: 0
65-
string: (not set)
66-
abbrev: 7
67-
verbose: -1
68-
quiet: 0
69-
dry run: no
70-
file: (not set)
71-
EOF
72-
73-
check() {
60+
check () {
7461
what="$1" &&
7562
shift &&
7663
expect="$1" &&
7764
shift &&
78-
sed "s/^$what .*/$what $expect/" <expect.template >expect &&
79-
test-parse-options $* >output 2>output.err &&
80-
test_must_be_empty output.err &&
81-
test_cmp expect output
65+
test-parse-options --expect="$what $expect" "$@"
8266
}
8367

8468
check_unknown_i18n() {

0 commit comments

Comments
 (0)