Skip to content

Commit 23a8b13

Browse files
sideshowbarkerhsivonen
authored andcommitted
Set default lastStartTag in TokenizerTester
This change causes TokenizerTester to set a default lastStartTag value for any test which has a initialStates value but no lastStartTag value. Otherwise, without this change, the tokenizer is never actually run for such missing-lastStartTag tests — which results in us failing 5 tests from the html5lib-tests suite.
1 parent aea39d8 commit 23a8b13

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test-src/nu/validator/htmlparser/test/TokenizerTester.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,23 @@ private void runTest(JSONObject test) throws SAXException, IOException {
140140
} else {
141141
for (JSONValue value : contentModelFlags.getValue()) {
142142
if (PCDATA.equals(value)) {
143+
lastStartTag = lastStartTag == null ? "xmp" : lastStartTag;
143144
runTestInner(inputString, expectedTokens, description,
144145
Tokenizer.DATA, lastStartTag);
145146
} else if (RAWTEXT.equals(value)) {
147+
lastStartTag = lastStartTag == null ? "xmp" : lastStartTag;
146148
runTestInner(inputString, expectedTokens, description,
147149
Tokenizer.RAWTEXT, lastStartTag);
148150
} else if (RCDATA.equals(value)) {
151+
lastStartTag = lastStartTag == null ? "xmp" : lastStartTag;
149152
runTestInner(inputString, expectedTokens, description,
150153
Tokenizer.RCDATA, lastStartTag);
151154
} else if (CDATA.equals(value)) {
155+
lastStartTag = lastStartTag == null ? "xmp" : lastStartTag;
152156
runTestInner(inputString, expectedTokens, description,
153157
Tokenizer.CDATA_SECTION, lastStartTag);
154158
} else if (PLAINTEXT.equals(value)) {
159+
lastStartTag = lastStartTag == null ? "plaintext" : lastStartTag;
155160
runTestInner(inputString, expectedTokens, description,
156161
Tokenizer.PLAINTEXT, lastStartTag);
157162
} else if (SCRIPT_DATA.equals(value)) {

0 commit comments

Comments
 (0)