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>
This commit is contained in:
parent
32d51d473f
commit
8ca65aebad
@ -57,28 +57,12 @@ test_expect_success 'test help' '
|
|||||||
|
|
||||||
mv expect expect.err
|
mv expect expect.err
|
||||||
|
|
||||||
cat >expect.template <<\EOF
|
check () {
|
||||||
boolean: 0
|
|
||||||
integer: 0
|
|
||||||
magnitude: 0
|
|
||||||
timestamp: 0
|
|
||||||
string: (not set)
|
|
||||||
abbrev: 7
|
|
||||||
verbose: -1
|
|
||||||
quiet: 0
|
|
||||||
dry run: no
|
|
||||||
file: (not set)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check() {
|
|
||||||
what="$1" &&
|
what="$1" &&
|
||||||
shift &&
|
shift &&
|
||||||
expect="$1" &&
|
expect="$1" &&
|
||||||
shift &&
|
shift &&
|
||||||
sed "s/^$what .*/$what $expect/" <expect.template >expect &&
|
test-parse-options --expect="$what $expect" "$@"
|
||||||
test-parse-options $* >output 2>output.err &&
|
|
||||||
test_must_be_empty output.err &&
|
|
||||||
test_cmp expect output
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_unknown_i18n() {
|
check_unknown_i18n() {
|
||||||
|
Loading…
Reference in New Issue
Block a user