Skip to content

Commit f23387a

Browse files
sideshowbarkerhsivonen
authored andcommitted
testharness: Use right lastStartTag w/ script data
This change ensures that TokenizerTester uses the correct, expected lastStartTag value from the test source when the initialStates value in the test source includes “Script data state” — or else if the test source specifies no lastStartTag, then “script” is used as the value. Otherwise, without this change, TokenizerTester is hardcoded to always use “script” as the lastStartTag when running a test case with “Script data state” as the initial state. That discrepancy causes us to fail the following case from the html5lib-tests suite: * https://github.com/html5lib/html5lib-tests/blob/master/tokenizer/domjs.test#L219-L223 ("lowercase endtags")
1 parent 7f0ae26 commit f23387a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ private void runTest(JSONObject test) throws SAXException, IOException {
164164
runTestInner(inputString, expectedTokens, description,
165165
Tokenizer.PLAINTEXT, lastStartTag);
166166
} else if (SCRIPT_DATA.equals(value)) {
167+
lastStartTag = lastStartTag == null ? "script" : lastStartTag;
167168
runTestInner(inputString, expectedTokens, description,
168-
Tokenizer.SCRIPT_DATA, "script");
169+
Tokenizer.SCRIPT_DATA, lastStartTag);
169170
} else {
170171
throw new RuntimeException("Broken test data.");
171172
}

0 commit comments

Comments
 (0)