From 5410589f431f72fde56b796a1a4d455b558769c3 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Thu, 4 Apr 2013 13:37:10 -0400 Subject: [PATCH] Move bold/italic parser tests from Parsoid's whitelist into upstream. Parsoid has been maintaining a whitelist for tests where its output diverges from the PHP parser. This patch upstreams part of that whitelist, creating separate PHP and Parsoid test cases to document in one place where the parsed output diverges and why. (Uses the recently-added 'php' and 'parsoid' options in parserTests.) Change-Id: I07ca6ec1e039a2842c641fe543b2d92eb964d932 --- tests/parser/parserTests.txt | 170 +++++++++++++++++++++++++++++++++-- 1 file changed, 161 insertions(+), 9 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 0165cb2753..baf9a6175b 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -397,13 +397,26 @@ Italics and bold: 2-quote opening sequence: (2,4) !! test -Italics and bold: 2-quote opening sequence: (2,5) +Italics and bold: 2-quote opening sequence: (2,5) (php) +!! options +php !! input ''foo''''' !! result

foo

!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: 2-quote opening sequence: (2,5) (parsoid) +!! options +parsoid +!! input +''foo''''' +!! result +

foo +

+!!end ### @@ -441,13 +454,26 @@ Italics and bold: 3-quote opening sequence: (3,4) !! test -Italics and bold: 3-quote opening sequence: (3,5) +Italics and bold: 3-quote opening sequence: (3,5) (php) +!! options +php !! input '''foo''''' !! result

foo

!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: 3-quote opening sequence: (3,5) (parsoid) +!! options +parsoid +!! input +'''foo''''' +!! result +

foo +

+!!end ### @@ -485,13 +511,26 @@ Italics and bold: 4-quote opening sequence: (4,4) !! test -Italics and bold: 4-quote opening sequence: (4,5) +Italics and bold: 4-quote opening sequence: (4,5) (php) +!! options +php !! input ''''foo''''' !! result

'foo

!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: 4-quote opening sequence: (4,5) (parsoid) +!! options +parsoid +!! input +''''foo''''' +!! result +

'foo +

+!!end ### @@ -499,13 +538,26 @@ Italics and bold: 4-quote opening sequence: (4,5) ### !! test -Italics and bold: 5-quote opening sequence: (5,2) +Italics and bold: 5-quote opening sequence: (5,2) (php) +!! options +php !! input '''''foo'' !! result

foo

!!end +# Parsoid reverses the nesting order, compared to the PHP parser +!! test +Italics and bold: 5-quote opening sequence: (5,2) (parsoid) +!! options +parsoid +!! input +'''''foo'' +!! result +

foo +

+!!end !! test @@ -571,23 +623,49 @@ Italics and bold: multiple quote sequences: (2,4,4) !! test -Italics and bold: multiple quote sequences: (3,4,2) +Italics and bold: multiple quote sequences: (3,4,2) (php) +!! options +php !! input '''foo''''bar'' !! result

foo'bar

!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: multiple quote sequences: (3,4,2) (parsoid) +!! options +parsoid +!! input +'''foo''''bar'' +!! result +

foo'bar +

+!!end !! test -Italics and bold: multiple quote sequences: (3,4,3) +Italics and bold: multiple quote sequences: (3,4,3) (php) +!! options +php !! input '''foo''''bar''' !! result

foo'bar

!!end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +Italics and bold: multiple quote sequences: (3,4,3) (parsoid) +!! options +parsoid +!! input +'''foo''''bar''' +!! result +

foo'bar +

+!!end ### ### other quote tests @@ -622,14 +700,32 @@ Italics and bold: other quote tests: (3,2,3,2) !!end +# The Parsoid team believes the PHP parser's output on this test is wrong. +# It only checks for convert-to-bold-on-single-character-word when the word +# matches with a bold tag ("'''") that is *odd* in the list of quote tokens. +# This means that the bold token in position 2 (0-indexed) gets converted by +# parsoid, but doesn't get changed by the PHP parser. !! test -Italics and bold: other quote tests: (3,2,3,3) +Italics and bold: other quote tests: (3,2,3,3) (php) +!! options +php !! input '''this is about ''foo'''s family''' !! result

'this is about foos family

!!end +# This is the output the Parsoid team believes to be correct. +!! test +Italics and bold: other quote tests: (3,2,3,3) (parsoid) +!! options +parsoid +!! input +'''this is about ''foo'''s family''' +!! result +

this is about foo's family +

+!!end !! test @@ -2932,7 +3028,9 @@ Normal text. '''''Bold italic text.''''' Normal text. !! test -Unclosed and unmatched quotes +Unclosed and unmatched quotes (php) +!! options +php !! input '''''Bold italic text '''with bold deactivated''' in between.''''' @@ -2967,6 +3065,48 @@ Plain ''italic'''s plain

Plain italic's plain

!! end +# Parsoid inserts an empty bold tag pair at the end of the line, that the PHP +# parser strips. The wikitext contains just the first half of the bold +# quote pair. (There's also a case where Parsoid nests and +# differently than the PHP parser.) +!! test +Unclosed and unmatched quotes (parsoid) +!! options +parsoid +!! input +'''''Bold italic text '''with bold deactivated''' in between.''''' + +'''''Bold italic text ''with italic deactivated'' in between.''''' + +'''Bold text.. + +..spanning two paragraphs (should not work).''' + +'''Bold tag left open + +''Italic tag left open + +Normal text. + + +'''This year''''s election ''should'' beat '''last year''''s. + +''Tom'''s car is bigger than ''Susan'''s. + +Plain ''italic'''s plain +!! result +

Bold italic text with bold deactivated in between. +

Bold italic text with italic deactivated in between. +

Bold text.. +

..spanning two paragraphs (should not work). +

Bold tag left open +

Italic tag left open +

Normal text. +

This year's election should beat last year's. +

Toms car is bigger than Susans. +

Plain italic's plain +

+!! end ### ### Tables @@ -10701,10 +10841,22 @@ Handling of in URLs !!end !! test -5 quotes, code coverage +1 line +5 quotes, code coverage +1 line (php) +!! options +php +!! input +''''' +!! result +!! end +# The PHP parser strips the empty tags out for giggles; parsoid doesn't. +!! test +5 quotes, code coverage +1 line (parsoid) +!! options +parsoid !! input ''''' !! result +

!! end !! test -- 2.20.1