git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Pranit Bauva <pranit.bauva@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH v11 1/4] test-parse-options: print quiet as integer
Date: Thu, 31 Mar 2016 14:45:53 +0000	[thread overview]
Message-ID: <01020153cd2340f8-4665cd5f-cd5c-41ab-a162-20acc43ca52e-000000@eu-west-1.amazonses.com> (raw)
In-Reply-To: <01020153b478cf07-758c7f14-33a1-4a67-9bc9-4688de3d6742-000000@eu-west-1.amazonses.com>

Current implementation of parse-options.c treats OPT__QUIET() as integer
and not boolean and thus it is more appropriate to print it as integer
to avoid confusion.

While at it, fix some style issues.
---
 t/t0040-parse-options.sh | 94 ++++++++++++++++++++++++------------------------
 test-parse-options.c     |  2 +-
 2 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 9be6411..2dcbdc0 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -7,7 +7,7 @@ test_description='our own option parser'
 
 . ./test-lib.sh
 
-cat > expect << EOF
+cat >expect <<EOF
 usage: test-parse-options <options>
 
     --yes                 get a boolean
@@ -49,7 +49,7 @@ Standard options
 EOF
 
 test_expect_success 'test help' '
-	test_must_fail test-parse-options -h > output 2> output.err &&
+	test_must_fail test-parse-options -h >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_i18ncmp expect output
 '
@@ -64,7 +64,7 @@ timestamp: 0
 string: (not set)
 abbrev: 7
 verbose: 0
-quiet: no
+quiet: 0
 dry run: no
 file: (not set)
 EOF
@@ -156,7 +156,7 @@ test_expect_success 'OPT_MAGNITUDE() 3giga' '
 	check magnitude: 3221225472 -m 3g
 '
 
-cat > expect << EOF
+cat >expect <<EOF
 boolean: 2
 integer: 1729
 magnitude: 16384
@@ -164,7 +164,7 @@ timestamp: 0
 string: 123
 abbrev: 7
 verbose: 2
-quiet: no
+quiet: 0
 dry run: yes
 file: prefix/my.file
 EOF
@@ -176,7 +176,7 @@ test_expect_success 'short options' '
 	test_must_be_empty output.err
 '
 
-cat > expect << EOF
+cat >expect <<EOF
 boolean: 2
 integer: 1729
 magnitude: 16384
@@ -184,7 +184,7 @@ timestamp: 0
 string: 321
 abbrev: 10
 verbose: 2
-quiet: no
+quiet: 0
 dry run: no
 file: prefix/fi.le
 EOF
@@ -204,7 +204,7 @@ test_expect_success 'missing required value' '
 	test_expect_code 129 test-parse-options --file
 '
 
-cat > expect << EOF
+cat >expect <<EOF
 boolean: 1
 integer: 13
 magnitude: 0
@@ -212,7 +212,7 @@ timestamp: 0
 string: 123
 abbrev: 7
 verbose: 0
-quiet: no
+quiet: 0
 dry run: no
 file: (not set)
 arg 00: a1
@@ -222,12 +222,12 @@ EOF
 
 test_expect_success 'intermingled arguments' '
 	test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
-		> output 2> output.err &&
+		>output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
-cat > expect << EOF
+cat >expect <<EOF
 boolean: 0
 integer: 2
 magnitude: 0
@@ -235,19 +235,19 @@ timestamp: 0
 string: (not set)
 abbrev: 7
 verbose: 0
-quiet: no
+quiet: 0
 dry run: no
 file: (not set)
 EOF
 
 test_expect_success 'unambiguously abbreviated option' '
-	test-parse-options --int 2 --boolean --no-bo > output 2> output.err &&
+	test-parse-options --int 2 --boolean --no-bo >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
 test_expect_success 'unambiguously abbreviated option with "="' '
-	test-parse-options --int=2 > output 2> output.err &&
+	test-parse-options --int=2 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
@@ -256,7 +256,7 @@ test_expect_success 'ambiguously abbreviated option' '
 	test_expect_code 129 test-parse-options --strin 123
 '
 
-cat > expect << EOF
+cat >expect <<EOF
 boolean: 0
 integer: 0
 magnitude: 0
@@ -264,38 +264,38 @@ timestamp: 0
 string: 123
 abbrev: 7
 verbose: 0
-quiet: no
+quiet: 0
 dry run: no
 file: (not set)
 EOF
 
 test_expect_success 'non ambiguous option (after two options it abbreviates)' '
-	test-parse-options --st 123 > output 2> output.err &&
+	test-parse-options --st 123 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
-cat > typo.err << EOF
+cat >typo.err <<EOF
 error: did you mean \`--boolean\` (with two dashes ?)
 EOF
 
 test_expect_success 'detect possible typos' '
-	test_must_fail test-parse-options -boolean > output 2> output.err &&
+	test_must_fail test-parse-options -boolean >output 2>output.err &&
 	test_must_be_empty output &&
 	test_cmp typo.err output.err
 '
 
-cat > typo.err << EOF
+cat >typo.err <<EOF
 error: did you mean \`--ambiguous\` (with two dashes ?)
 EOF
 
 test_expect_success 'detect possible typos' '
-	test_must_fail test-parse-options -ambiguous > output 2> output.err &&
+	test_must_fail test-parse-options -ambiguous >output 2>output.err &&
 	test_must_be_empty output &&
 	test_cmp typo.err output.err
 '
 
-cat > expect <<EOF
+cat >expect <<EOF
 boolean: 0
 integer: 0
 magnitude: 0
@@ -303,19 +303,19 @@ timestamp: 0
 string: (not set)
 abbrev: 7
 verbose: 0
-quiet: no
+quiet: 0
 dry run: no
 file: (not set)
 arg 00: --quux
 EOF
 
 test_expect_success 'keep some options as arguments' '
-	test-parse-options --quux > output 2> output.err &&
+	test-parse-options --quux >output 2>output.err &&
 	test_must_be_empty output.err &&
-        test_cmp expect output
+	test_cmp expect output
 '
 
-cat > expect <<EOF
+cat >expect <<EOF
 boolean: 0
 integer: 0
 magnitude: 0
@@ -323,7 +323,7 @@ timestamp: 1
 string: (not set)
 abbrev: 7
 verbose: 0
-quiet: yes
+quiet: 1
 dry run: no
 file: (not set)
 arg 00: foo
@@ -331,12 +331,12 @@ EOF
 
 test_expect_success 'OPT_DATE() works' '
 	test-parse-options -t "1970-01-01 00:00:01 +0000" \
-		foo -q > output 2> output.err &&
+		foo -q >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
-cat > expect <<EOF
+cat >expect <<EOF
 Callback: "four", 0
 boolean: 5
 integer: 4
@@ -345,28 +345,28 @@ timestamp: 0
 string: (not set)
 abbrev: 7
 verbose: 0
-quiet: no
+quiet: 0
 dry run: no
 file: (not set)
 EOF
 
 test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '
-	test-parse-options --length=four -b -4 > output 2> output.err &&
+	test-parse-options --length=four -b -4 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
-cat > expect <<EOF
+cat >expect <<EOF
 Callback: "not set", 1
 EOF
 
 test_expect_success 'OPT_CALLBACK() and callback errors work' '
-	test_must_fail test-parse-options --no-length > output 2> output.err &&
+	test_must_fail test-parse-options --no-length >output 2>output.err &&
 	test_i18ncmp expect output &&
 	test_i18ncmp expect.err output.err
 '
 
-cat > expect <<EOF
+cat >expect <<EOF
 boolean: 1
 integer: 23
 magnitude: 0
@@ -374,24 +374,24 @@ timestamp: 0
 string: (not set)
 abbrev: 7
 verbose: 0
-quiet: no
+quiet: 0
 dry run: no
 file: (not set)
 EOF
 
 test_expect_success 'OPT_BIT() and OPT_SET_INT() work' '
-	test-parse-options --set23 -bbbbb --no-or4 > output 2> output.err &&
+	test-parse-options --set23 -bbbbb --no-or4 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
 test_expect_success 'OPT_NEGBIT() and OPT_SET_INT() work' '
-	test-parse-options --set23 -bbbbb --neg-or4 > output 2> output.err &&
+	test-parse-options --set23 -bbbbb --neg-or4 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
-cat > expect <<EOF
+cat >expect <<EOF
 boolean: 6
 integer: 0
 magnitude: 0
@@ -399,30 +399,30 @@ timestamp: 0
 string: (not set)
 abbrev: 7
 verbose: 0
-quiet: no
+quiet: 0
 dry run: no
 file: (not set)
 EOF
 
 test_expect_success 'OPT_BIT() works' '
-	test-parse-options -bb --or4 > output 2> output.err &&
+	test-parse-options -bb --or4 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
 test_expect_success 'OPT_NEGBIT() works' '
-	test-parse-options -bb --no-neg-or4 > output 2> output.err &&
+	test-parse-options -bb --no-neg-or4 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
 test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' '
-	test-parse-options + + + + + + > output 2> output.err &&
+	test-parse-options + + + + + + >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
-cat > expect <<EOF
+cat >expect <<EOF
 boolean: 0
 integer: 12345
 magnitude: 0
@@ -430,13 +430,13 @@ timestamp: 0
 string: (not set)
 abbrev: 7
 verbose: 0
-quiet: no
+quiet: 0
 dry run: no
 file: (not set)
 EOF
 
 test_expect_success 'OPT_NUMBER_CALLBACK() works' '
-	test-parse-options -12345 > output 2> output.err &&
+	test-parse-options -12345 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
@@ -449,7 +449,7 @@ timestamp: 0
 string: (not set)
 abbrev: 7
 verbose: 0
-quiet: no
+quiet: 0
 dry run: no
 file: (not set)
 EOF
@@ -460,7 +460,7 @@ test_expect_success 'negation of OPT_NONEG flags is not ambiguous' '
 	test_cmp expect output
 '
 
-cat >>expect <<'EOF'
+cat >>expect <<EOF
 list: foo
 list: bar
 list: baz
diff --git a/test-parse-options.c b/test-parse-options.c
index 2c8c8f1..86afa98 100644
--- a/test-parse-options.c
+++ b/test-parse-options.c
@@ -90,7 +90,7 @@ int main(int argc, char **argv)
 	printf("string: %s\n", string ? string : "(not set)");
 	printf("abbrev: %d\n", abbrev);
 	printf("verbose: %d\n", verbose);
-	printf("quiet: %s\n", quiet ? "yes" : "no");
+	printf("quiet: %d\n", quiet);
 	printf("dry run: %s\n", dry_run ? "yes" : "no");
 	printf("file: %s\n", file ? file : "(not set)");
 

--
https://github.com/git/git/pull/218

  parent reply	other threads:[~2016-03-31 14:46 UTC|newest]

Thread overview: 136+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14 21:38 [PATCH v7] commit: add a commit.verbose config variable Pranit Bauva
2016-03-15 11:31 ` SZEDER Gábor
2016-03-15 19:00   ` Pranit Bauva
2016-03-15 19:24     ` Eric Sunshine
2016-03-15 20:13       ` Pranit Bauva
2016-03-15 20:24         ` Junio C Hamano
2016-03-15 21:09           ` Pranit Bauva
2016-03-15 21:16             ` Junio C Hamano
2016-03-15 21:18               ` Pranit Bauva
2016-03-18 21:19 ` [PATCH v8 1/2] parse-options.c: make OPTION__COUNTUP consider negative values Pranit Bauva
2016-03-18 21:19   ` [PATCH v8 2/2] commit: add a commit.verbose config variable Pranit Bauva
2016-03-20  3:56     ` Eric Sunshine
2016-03-20 11:05       ` Pranit Bauva
2016-03-20 17:34         ` Eric Sunshine
2016-03-20 18:02           ` Pranit Bauva
2016-03-23 19:19             ` Junio C Hamano
2016-03-23 19:23               ` Pranit Bauva
2016-03-23 20:43                 ` Junio C Hamano
2016-03-24  8:25     ` [PATCH v9 1/3] parse-options.c: make OPTION__COUNTUP consider negative values Pranit Bauva
2016-03-24  8:25       ` [PATCH v9 3/3] commit: add a commit.verbose config variable Pranit Bauva
2016-03-24 10:04         ` SZEDER Gábor
2016-03-24 10:22           ` Pranit Bauva
2016-03-24 10:26             ` Pranit Bauva
2016-03-25  0:05         ` Eric Sunshine
2016-03-25  6:15           ` Pranit Bauva
2016-03-24  8:25       ` [PATCH v9 2/3] t7507-commit-verbose: make test suite use write_script Pranit Bauva
2016-03-24 11:00         ` SZEDER Gábor
2016-03-24 23:57           ` Eric Sunshine
2016-03-25  6:06             ` Pranit Bauva
2016-03-25  6:24               ` Eric Sunshine
2016-03-25  6:55                 ` Pranit Bauva
2016-03-25 14:46             ` SZEDER Gábor
2016-03-25 14:50               ` Pranit Bauva
2016-03-25 17:04               ` Eric Sunshine
2016-03-25 18:15                 ` Pranit Bauva
2016-03-25 23:06                   ` Eric Sunshine
2016-03-24 10:33       ` [PATCH v9 1/3] parse-options.c: make OPTION__COUNTUP consider negative values SZEDER Gábor
2016-03-24 10:38         ` Pranit Bauva
2016-03-24 23:34         ` Eric Sunshine
2016-03-28 18:42         ` Pranit Bauva
2016-03-28 19:03           ` Eric Sunshine
2016-03-26 19:48       ` [PATCH v10 1/3] parse-options.c: make OPTION__COUNTUP understand "unspecified" values Pranit Bauva
2016-03-26 19:48         ` [PATCH v10 2/3] t7507-commit-verbose: store output of grep in a file Pranit Bauva
2016-03-27  3:07           ` Eric Sunshine
2016-03-27 13:27             ` SZEDER Gábor
2016-03-27 13:43               ` Pranit Bauva
2016-03-27 17:27               ` Eric Sunshine
2016-03-27 18:31                 ` Pranit Bauva
     [not found]             ` <CAFZEwPMaZkUi+DvohhVrc_dW_8cdfJsZX-YA_SRWDp021UvDLQ@mail.gmail.com>
2016-03-27 17:03               ` Eric Sunshine
     [not found]               ` <CAPig+cTFK=HPAtk7MeMQSTccmiaai++3sVn6J_pRcSi+w_4Lng@mail.gmail.com>
2016-03-27 17:05                 ` Eric Sunshine
     [not found]                 ` <CAFZEwPMJiCTKszfCAVrzsA+jNHwoHPaXySSD3HyiO=f5AikvZg@mail.gmail.com>
     [not found]                   ` <CAPig+cS3usDDeTMzjqbxqi+k+XbmjawZ0TF20s9-vM6o=Fm=OQ@mail.gmail.com>
2016-03-27 17:08                     ` Eric Sunshine
2016-03-26 19:48         ` [PATCH v10 3/3] commit: add a commit.verbose config variable Pranit Bauva
2016-03-27  3:34           ` Eric Sunshine
2016-03-27  7:00             ` Pranit Bauva
2016-03-27  8:17               ` Eric Sunshine
2016-03-27  8:40                 ` Pranit Bauva
2016-03-27 11:51           ` SZEDER Gábor
2016-03-27 11:59             ` Pranit Bauva
2016-03-27 12:07               ` SZEDER Gábor
2016-03-27 12:11                 ` Pranit Bauva
2016-03-27 16:48               ` Eric Sunshine
2016-03-27  2:45         ` [PATCH v10 1/3] parse-options.c: make OPTION__COUNTUP understand "unspecified" values Eric Sunshine
2016-03-27  6:10           ` Pranit Bauva
2016-03-31 14:45         ` Pranit Bauva [this message]
2016-03-31 14:45           ` [PATCH v11 3/4] t7507-commit-verbose: improve test coverage by testing number of diffs Pranit Bauva
2016-03-31 18:23             ` Junio C Hamano
2016-03-31 18:42               ` Pranit Bauva
2016-03-31 14:45           ` [PATCH v11 4/4] commit: add a commit.verbose config variable Pranit Bauva
2016-03-31 14:45           ` [PATCH v11 2/4] parse-options.c: make OPTION_COUNTUP respect "unspecified" values Pranit Bauva
2016-03-31 18:41             ` Junio C Hamano
2016-03-31 19:34               ` Pranit Bauva
2016-03-31 20:06                 ` Junio C Hamano
2016-03-31 20:41                   ` Pranit Bauva
2016-03-31 20:45                     ` Junio C Hamano
2016-03-31 18:19           ` [PATCH v11 1/4] test-parse-options: print quiet as integer Junio C Hamano
2016-03-31 18:40             ` Pranit Bauva
2016-04-02 23:33           ` [PATCH v12 1/5] t0040-test-parse-options.sh: fix style issues Pranit Bauva
2016-04-02 23:33             ` [PATCH v12 4/5] t7507-commit-verbose: improve test coverage by testing number of diffs Pranit Bauva
2016-04-04  0:02               ` Eric Sunshine
2016-04-04  1:05                 ` Eric Sunshine
2016-04-05 15:54                 ` Pranit Bauva
2016-04-02 23:33             ` [PATCH v12 3/5] parse-options.c: make OPTION_COUNTUP respect "unspecified" values Pranit Bauva
2016-04-03 23:10               ` Eric Sunshine
2016-04-05 15:51                 ` Pranit Bauva
2016-04-02 23:33             ` [PATCH v12 2/5] test-parse-options: print quiet as integer Pranit Bauva
2016-04-03 21:30               ` Eric Sunshine
2016-04-05 15:39                 ` Pranit Bauva
2016-04-06  5:56                   ` Eric Sunshine
2016-04-08 11:33                   ` Duy Nguyen
2016-04-08 16:52                 ` Junio C Hamano
2016-04-02 23:33             ` [PATCH v12 5/5] commit: add a commit.verbose config variable Pranit Bauva
2016-04-04  0:58               ` Eric Sunshine
2016-04-04 23:29                 ` Eric Sunshine
2016-04-05 15:58                   ` Pranit Bauva
2016-04-03 21:00             ` [PATCH v12 1/5] t0040-test-parse-options.sh: fix style issues Eric Sunshine
2016-04-04 12:45               ` Pranit Bauva
2016-04-04 17:30                 ` Eric Sunshine
2016-04-05  5:08                   ` Pranit Bauva
2016-04-09 12:23             ` [PATCH v13 1/6] " Pranit Bauva
2016-04-09 12:23               ` [PATCH v13 5/6] t7507-commit-verbose: improve test coverage by testing number of diffs Pranit Bauva
2016-04-09 12:23               ` [PATCH v13 3/6] t0040-parse-options: improve test coverage Pranit Bauva
2016-04-09 12:23               ` [PATCH v13 6/6] commit: add a commit.verbose config variable Pranit Bauva
2016-04-12 21:24                 ` Junio C Hamano
2016-04-12 21:28                   ` Pranit Bauva
2016-04-12 21:39                   ` Junio C Hamano
2016-04-12 22:18                     ` Junio C Hamano
2016-04-12 22:25                       ` Pranit Bauva
2016-04-09 12:23               ` [PATCH v13 4/6] parse-options.c: make OPTION_COUNTUP respect "unspecified" values Pranit Bauva
2016-04-09 12:23               ` [PATCH v13 2/6] test-parse-options: print quiet as integer Pranit Bauva
2016-04-12 21:33                 ` Junio C Hamano
2016-04-12 22:16                   ` Pranit Bauva
2016-04-12 23:11                     ` Junio C Hamano
2016-04-12 23:02               ` [PATCH v14 1/6] t0040-test-parse-options.sh: fix style issues Pranit Bauva
2016-04-12 23:02                 ` [PATCH v14 5/6] t7507-commit-verbose: improve test coverage by testing number of diffs Pranit Bauva
2016-04-13  6:03                   ` Eric Sunshine
2016-04-13  9:00                     ` Pranit Bauva
2016-04-12 23:02                 ` [PATCH v14 2/6] test-parse-options: print quiet as integer Pranit Bauva
2016-04-12 23:02                 ` [PATCH v14 4/6] parse-options.c: make OPTION_COUNTUP respect "unspecified" values Pranit Bauva
2016-04-13  5:56                   ` Eric Sunshine
2016-04-13  8:39                     ` Pranit Bauva
2016-04-13 17:33                       ` Eric Sunshine
2016-04-13 17:43                         ` Pranit Bauva
2016-04-13 17:50                           ` Eric Sunshine
2016-04-12 23:02                 ` [PATCH v14 6/6] commit: add a commit.verbose config variable Pranit Bauva
2016-04-13  6:14                   ` Eric Sunshine
2016-04-13  9:15                     ` Pranit Bauva
2016-04-13 17:44                       ` Eric Sunshine
2016-04-12 23:02                 ` [PATCH v14 3/6] t0040-parse-options: improve test coverage Pranit Bauva
2016-04-13  5:26                   ` Eric Sunshine
2016-04-13  8:59                     ` Pranit Bauva
2016-04-13 17:27                       ` Eric Sunshine
2016-04-25 18:40                         ` Pranit Bauva
2016-04-27 17:55                           ` Eric Sunshine
2016-04-27 18:16                             ` Pranit Bauva
2016-03-18 22:59   ` [PATCH v8 1/2] parse-options.c: make OPTION__COUNTUP consider negative values Junio C Hamano
2016-03-19  4:55     ` Pranit Bauva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01020153cd2340f8-4665cd5f-cd5c-41ab-a162-20acc43ca52e-000000@eu-west-1.amazonses.com \
    --to=pranit.bauva@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).