changeset 45989:60523483897c

tests: conditionalize return code on chg in test-config.t 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. Differential Revision: https://phab.mercurial-scm.org/D9463
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 30 Nov 2020 14:48:02 +0530
parents c6da62004c0f
children 5de27798d2af
files tests/test-config.t
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-config.t	Fri Nov 27 21:32:42 2020 +0530
+++ b/tests/test-config.t	Mon Nov 30 14:48:02 2020 +0530
@@ -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