From aeb3f45c20fc6a30b2d3858f668d1fa4a589213e Mon Sep 17 00:00:00 2001
From: "C. Scott Ananian"
Date: Wed, 29 Jul 2020 14:59:27 -0400
Subject: Tracking category and parser warning for deprecated uses of {{=}}
We plan to add {{=}} as a built-in parser function, expanding to `=`,
in the same way that `{{!}}` is a built-in. It will be used to
automatically escape uses of `=` in template arguments (again, in the
same way that `{{!}}` can be used to protect uses of `|` in template
arguments).
Some wikis have non-standard definitions of `Template:=`; add a
tracking category to warn these wikis to transition before we turn on
the built-in parser function in a future release.
New parser test file added, so we can re-define Template:= and test
both cases of this new warning.
Bug: T91154
Change-Id: I50ff8a7b6be95901ebb14ffbe64940a0f499cfac
---
tests/parser/ParserTestRunner.php | 1 +
tests/parser/parserTests.txt | 24 ++++++++++++++++++++++++
tests/parser/pfeqParserTests.txt | 30 ++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+)
create mode 100644 tests/parser/pfeqParserTests.txt
(limited to 'tests/parser')
diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php
index d3a86e98aea7..1f82f393687e 100644
--- a/tests/parser/ParserTestRunner.php
+++ b/tests/parser/ParserTestRunner.php
@@ -49,6 +49,7 @@ class ParserTestRunner {
*/
private static $coreTestFiles = [
'parserTests.txt',
+ 'pfeqParserTests.txt',
'extraParserTests.txt',
];
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 9245137323c5..3eed41c1f477 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -26206,6 +26206,30 @@ Special:Foobar
!! end
+# {{=}} will be converted to a parser function which expands to `=`
+# If you have it defined as a Template that expands to `=` that's ok;
+# and using it explicitly as {{Template:=}} (regardless of what it
+# expands to) is also ok and will not generate a tracking category.
+# T91154
+!! test
+Using {{=}} when it expands to "=" should not create a tracking category
+!! wikitext
+This uses {{=}} and {{Template:=}}.
+!! html
+This uses = and =.
+
+!! end
+
+# Repeat the test, looking at categories. Note: none should be emitted!
+!! test
+Using {{=}} when it expands to "=" should not create a tracking category (cat)
+!! options
+cat
+!! wikitext
+This uses {{=}} and {{Template:=}}.
+!! html/php
+!! end
+
!!test
T36939 - Case insensitive link parsing ([HttP://])
!! wikitext
diff --git a/tests/parser/pfeqParserTests.txt b/tests/parser/pfeqParserTests.txt
new file mode 100644
index 000000000000..6e56ca2f52ad
--- /dev/null
+++ b/tests/parser/pfeqParserTests.txt
@@ -0,0 +1,30 @@
+!! Version 2
+!! article
+Template:=
+!! text
+no
+!! endarticle
+
+# {{=}} will be converted to a parser function which expands to `=`
+# If you have it defined as a Template that expands to something other
+# than `=` that will generate a warning and a tracking category, although
+# referencing the template explicitly as {{Template:=}} is fine
+# regardless of what it expands to. (T91154)
+!! test
+Using {{=}} when that doesn't expand to "=" should create a tracking category
+!! options
+cat
+!! wikitext
+This uses {{=}}.
+!! html/php
+cat=Pages_which_use_=_as_a_template sort=
+!! end
+
+!! test
+Using {{Template:=}} shouldn't create tracking category regardless of definition
+!! options
+cat
+!! wikitext
+This uses {{Template:=}}.
+!! html/php
+!! end
--
cgit v1.2.3