Skip to content

Commit 62ab37a

Browse files
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 4ce4598 commit 62ab37a

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)