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 <gitster@pobox.com>
Junio C Hamano committed
May 6, 2016 at 11:17 UTC
8ca65aebad55790d675f1eaead2dfc15fae60847
1 file changed
+2
-18
t/t0040-parse-options.sh
+2
-18
@@ -57,28 +57,12 @@ test_expect_success 'test help' '
57
58
mv expect expect.err
59
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 () {
61
what="$1" &&
62
shift &&
63
expect="$1" &&
64
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" "$@"
66
}
67
68
check_unknown_i18n() {