tests/test-config.t
author Augie Fackler <raf@durin42.com>
Thu, 04 Sep 2014 09:59:23 -0400
changeset 22367 c5df4af17110
parent 22276 b13b99d39a46
parent 22316 816be4ca4ae2
child 23172 e955549cd045
permissions -rw-r--r--
merge with stable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17015
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
     1
hide outer repo
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
     2
  $ hg init
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
     3
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     4
Invalid syntax: no value
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     5
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     6
  $ cat > .hg/hgrc << EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     7
  > novaluekey
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     8
  > EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     9
  $ hg showconfig
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    10
  hg: parse error at $TESTTMP/.hg/hgrc:1: novaluekey
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    11
  [255]
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    12
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    13
Invalid syntax: no key
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    14
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    15
  $ cat > .hg/hgrc << EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    16
  > =nokeyvalue
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    17
  > EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    18
  $ hg showconfig
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    19
  hg: parse error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    20
  [255]
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    21
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    22
Test hint about invalid syntax from leading white space
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    23
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    24
  $ cat > .hg/hgrc << EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    25
  >  key=value
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    26
  > EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    27
  $ hg showconfig
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    28
  hg: parse error at $TESTTMP/.hg/hgrc:1:  key=value
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    29
  unexpected leading whitespace
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    30
  [255]
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    31
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    32
  $ cat > .hg/hgrc << EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    33
  >  [section]
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    34
  > key=value
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    35
  > EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    36
  $ hg showconfig
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    37
  hg: parse error at $TESTTMP/.hg/hgrc:1:  [section]
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    38
  unexpected leading whitespace
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    39
  [255]
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    40
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    41
Reset hgrc
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    42
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    43
  $ echo > .hg/hgrc
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    44
19086
8fb8dce3f9b6 tests: rename from test-config-case.t to test-config.t for centralization
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17015
diff changeset
    45
Test case sensitive configuration
8fb8dce3f9b6 tests: rename from test-config-case.t to test-config.t for centralization
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17015
diff changeset
    46
12082
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    47
  $ echo '[Section]' >> $HGRCPATH
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    48
  $ echo 'KeY = Case Sensitive' >> $HGRCPATH
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    49
  $ echo 'key = lower case' >> $HGRCPATH
3425
ec6f400cff4d Use a case-sensitive version of SafeConfigParser everywhere
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    50
12082
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    51
  $ hg showconfig Section
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    52
  Section.KeY=Case Sensitive
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    53
  Section.key=lower case
3425
ec6f400cff4d Use a case-sensitive version of SafeConfigParser everywhere
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    54
19087
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    55
Test "%unset"
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    56
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    57
  $ cat >> $HGRCPATH <<EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    58
  > [unsettest]
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    59
  > local-hgrcpath = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    60
  > %unset local-hgrcpath
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    61
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    62
  > global = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    63
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    64
  > both = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    65
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    66
  > set-after-unset = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    67
  > EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    68
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    69
  $ cat >> .hg/hgrc <<EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    70
  > [unsettest]
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    71
  > local-hgrc = should be unset (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    72
  > %unset local-hgrc
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    73
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    74
  > %unset global
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    75
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    76
  > both = should be unset (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    77
  > %unset both
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    78
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    79
  > set-after-unset = should be unset (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    80
  > %unset set-after-unset
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    81
  > set-after-unset = should be set (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    82
  > EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    83
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    84
  $ hg showconfig unsettest
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    85
  unsettest.set-after-unset=should be set (.hg/hgrc)
22316
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
    86
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
    87
Test exit code when no config matches
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
    88
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
    89
  $ hg config Section.idontexist
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
    90
  [1]