From d07717dd0df526ea5c4297b8f04475762f6b975e Mon Sep 17 00:00:00 2001 From: Huji Lee Date: Fri, 4 Sep 2020 13:07:53 -0400 Subject: [PATCH] Use triple equals in abuse filter parser tests The only exception is mwexamples-comparisons.t which intentionally includes examples with = and == to test the "weak" version of the comparison operator. Bug: T262063 Change-Id: I6f92aadc69489da481a606bfda89617b8efbb261 --- tests/parserTests/comparisons.t | 30 ++++++++++++++++++++++ tests/parserTests/lcase.t | 2 +- tests/parserTests/mwexamples-comparisons.t | 1 - tests/parserTests/prec.t | 2 +- tests/parserTests/rcount.t | 4 +-- tests/parserTests/rmdoubles.t | 2 +- tests/parserTests/rmspecials.t | 2 +- tests/parserTests/sanitize.t | 2 +- tests/parserTests/ucase.t | 2 +- tests/parserTests/wptest2.t | 2 +- 10 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 tests/parserTests/comparisons.t diff --git a/tests/parserTests/comparisons.t b/tests/parserTests/comparisons.t new file mode 100644 index 000000000..1d3f0ef75 --- /dev/null +++ b/tests/parserTests/comparisons.t @@ -0,0 +1,30 @@ +(2 = 2) & +(2 == 2) & +(2 === 2) & +('2' = 2) & +('2' == 2) & +('2' !== 2) & +(['1','2'] = ['1','2']) & +(['1','2'] == ['1','2']) & +(['1','2'] === ['1','2']) & +(['1','2'] != ['2','1']) & +(['1','2'] = ['1',2]) & +(['1','2'] == ['1',2]) & +(['1','2'] !== ['1',2]) & +(true = 1) & +(true == 1) & +(true !== 1) & +(false != 0) & +(false = '') & +(false == '') & +(false !== '') & +(false = []) & +(false == []) & +(false !== []) & +(false = null) & +(false == null) & +(false !== null) & +([] = null) & +([] == null) & +([] !== null) & +([] != '') diff --git a/tests/parserTests/lcase.t b/tests/parserTests/lcase.t index 6995baf77..204d12f16 100644 --- a/tests/parserTests/lcase.t +++ b/tests/parserTests/lcase.t @@ -1 +1 @@ -lcase("FÁmí") = "fámí" +lcase("FÁmí") === "fámí" diff --git a/tests/parserTests/mwexamples-comparisons.t b/tests/parserTests/mwexamples-comparisons.t index 76582590c..2527a36a1 100644 --- a/tests/parserTests/mwexamples-comparisons.t +++ b/tests/parserTests/mwexamples-comparisons.t @@ -19,4 +19,3 @@ ([] == false) & ([] == null) & !(['1'] == '1') - diff --git a/tests/parserTests/prec.t b/tests/parserTests/prec.t index 3aff6ab15..7162270f0 100644 --- a/tests/parserTests/prec.t +++ b/tests/parserTests/prec.t @@ -1 +1 @@ -(1 + 2 * 3 = 7) & (2 ** 2 * 2 = 8) & (1 - 1 - 1 = -1) +(1 + 2 * 3 === 7) & (2 ** 2 * 2 === 8) & (1 - 1 - 1 === -1) diff --git a/tests/parserTests/rcount.t b/tests/parserTests/rcount.t index a514dad5f..32f8aa71c 100644 --- a/tests/parserTests/rcount.t +++ b/tests/parserTests/rcount.t @@ -1,3 +1,3 @@ -rcount("a,b,c,d") = 4 & -rcount(".", "abcd") = 4 +rcount("a,b,c,d") === 4 & +rcount(".", "abcd") === 4 diff --git a/tests/parserTests/rmdoubles.t b/tests/parserTests/rmdoubles.t index 7a0a3f8fc..bdf132445 100644 --- a/tests/parserTests/rmdoubles.t +++ b/tests/parserTests/rmdoubles.t @@ -1 +1 @@ -rmdoubles("foobarééqq") = "fobaréq" +rmdoubles("foobarééqq") === "fobaréq" diff --git a/tests/parserTests/rmspecials.t b/tests/parserTests/rmspecials.t index a4df5cd59..401dc44e4 100644 --- a/tests/parserTests/rmspecials.t +++ b/tests/parserTests/rmspecials.t @@ -1 +1 @@ -rmspecials("foo;bar!") = "foobar" +rmspecials("foo;bar!") === "foobar" diff --git a/tests/parserTests/sanitize.t b/tests/parserTests/sanitize.t index 06036c0c4..107afd9b5 100644 --- a/tests/parserTests/sanitize.t +++ b/tests/parserTests/sanitize.t @@ -1 +1 @@ -sanitize('یک') = 'یک' +sanitize('یک') === 'یک' diff --git a/tests/parserTests/ucase.t b/tests/parserTests/ucase.t index be058b8be..ce2189b33 100644 --- a/tests/parserTests/ucase.t +++ b/tests/parserTests/ucase.t @@ -1 +1 @@ -ucase("FÁmí") = "FÁMÍ" +ucase("FÁmí") === "FÁMÍ" diff --git a/tests/parserTests/wptest2.t b/tests/parserTests/wptest2.t index 0e1375033..0aabd8ee4 100644 --- a/tests/parserTests/wptest2.t +++ b/tests/parserTests/wptest2.t @@ -16,6 +16,6 @@ removed_lines_test := ['testtest2']; /*Counts of more reference tags are removed than added */ & (rcount("(|)",removed_lines_test) > rcount("(|)",added_lines_test)) /*Excludes changing to the named reference format and removing closing tags attached to formerly named refs. Unequality is to account for closing the first named tag */ -& !(rcount("",removed_lines_test) = rcount("",removed_lines_test) <= rcount("",removed_lines_test) === rcount("",removed_lines_test) <= rcount(" count("http://en.wikipedia.org",string(added_lines_test)))