Patchwork D9463: tests: conditionalize return code on chg in test-config.t

login
register
mail settings
Submitter phabricator
Date Nov. 30, 2020, 9:42 a.m.
Message ID <differential-rev-PHID-DREV-bqd4stkfkleqzoxxlf5c-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47742/
State Superseded
Headers show

Comments

phabricator - Nov. 30, 2020, 9:42 a.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If there is any error while reading config, chg just returns 255 instead of 30.
  
  It seems to me that we cannot conditionalize only return codes in output using
  trailing `(chg !)` and hence used testcases.
  
  The test was failing with chg but after this patch, it now passes.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D9463

AFFECTED FILES
  tests/test-config.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -6,35 +6,59 @@ 
   $ cat > .hg/hgrc << EOF
   > novaluekey
   > EOF
+#if chg
+  $ hg showconfig
+  config error at $TESTTMP/.hg/hgrc:1: novaluekey
+  [255]
+#else
   $ hg showconfig
   config error at $TESTTMP/.hg/hgrc:1: novaluekey
   [30]
+#endif
 
 Invalid syntax: no key
 
   $ cat > .hg/hgrc << EOF
   > =nokeyvalue
   > EOF
+#if chg
+  $ hg showconfig
+  config error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
+  [255]
+#else
   $ hg showconfig
   config error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
   [30]
+#endif
 
 Test hint about invalid syntax from leading white space
 
   $ cat > .hg/hgrc << EOF
   >  key=value
   > EOF
+#if chg
+  $ hg showconfig
+  config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace:  key=value
+  [255]
+#else
   $ hg showconfig
   config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace:  key=value
   [30]
+#endif
 
   $ cat > .hg/hgrc << EOF
   >  [section]
   > key=value
   > EOF
+#if chg
+  $ hg showconfig
+  config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace:  [section]
+  [255]
+#else
   $ hg showconfig
   config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace:  [section]
   [30]
+#endif
 
 Reset hgrc