Patchwork D8798: tests: add test for bad template %include and __base__

login
register
mail settings
Submitter phabricator
Date July 23, 2020, 5:49 a.m.
Message ID <differential-rev-PHID-DREV-oregtofiae2au2klf4bx-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46843/
State Superseded
Headers show

Comments

phabricator - July 23, 2020, 5:49 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It doesn't seem like we had any tests for `%include non-existent` and
  `__base__ = non-existent`. The latter raises an error while the former
  ignores the include. We should probably also make the former an error.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-template-map.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-template-map.t b/tests/test-template-map.t
--- a/tests/test-template-map.t
+++ b/tests/test-template-map.t
@@ -125,6 +125,15 @@ 
   date:        Wed Jan 01 10:01:00 2020 +0000
   summary:     third
   
+Test map inheritance with non-existent base
+
+  $ echo "__base__ = non-existent" > map-base-nonexistent
+  $ printf 'cset = "changeset: ***{rev}***\\n"\n' >> map-simple
+  $ hg log -l1 -T./map-base-nonexistent
+  abort: style '$TESTTMP/a/non-existent' not found
+  (available styles: bisect, changelog, compact, default, phases, show, status, xml)
+  [255]
+
 Test including a built-in template map
 
   $ cat <<'EOF' > map-include-builtin
@@ -136,6 +145,17 @@ 
   8:95c24699272e
   
 
+Test including a nonexistent template map
+BROKEN: This should probably be an error just like the bad __base__ above
+
+  $ cat <<'EOF' > map-include-nonexistent
+  > %include nonexistent
+  > [templates]
+  > changeset = "test\n"
+  > EOF
+  $ hg log -l1 -T./map-include-nonexistent
+  test
+
 Test docheader, docfooter and separator in template map
 
   $ cat <<'EOF' > map-myjson