| OLD | NEW |
| 1 library tokenizer_test; | 1 library tokenizer_test; |
| 2 | 2 |
| 3 // Note: mirrors used to match the getattr usage in the original test | 3 // Note: mirrors used to match the getattr usage in the original test |
| 4 import 'dart:convert'; | 4 import 'dart:convert'; |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'dart:mirrors'; | 6 import 'dart:mirrors'; |
| 7 import 'package:path/path.dart' as pathos; | 7 import 'package:path/path.dart' as pathos; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 import 'package:html5lib/src/char_encodings.dart'; | 9 import 'package:html5lib/src/char_encodings.dart'; |
| 10 import 'package:html5lib/src/token.dart'; | 10 import 'package:html5lib/src/token.dart'; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 for (int i = 0; i < tokens.length; i++) { | 127 for (int i = 0; i < tokens.length; i++) { |
| 128 var token = tokens[i]; | 128 var token = tokens[i]; |
| 129 if (token[0] == 'ParseError') { | 129 if (token[0] == 'ParseError') { |
| 130 tokens[i] = token[0]; | 130 tokens[i] = token[0]; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 return tokens; | 133 return tokens; |
| 134 } | 134 } |
| 135 | 135 |
| 136 | 136 |
| 137 /** | 137 /// Test whether the test has passed or failed |
| 138 * Test whether the test has passed or failed | 138 /// |
| 139 * | 139 /// If the ignoreErrorOrder flag is set to true we don't test the relative |
| 140 * If the ignoreErrorOrder flag is set to true we don't test the relative | 140 /// positions of parse errors and non parse errors. |
| 141 * positions of parse errors and non parse errors. | |
| 142 */ | |
| 143 void expectTokensMatch(List expectedTokens, List receivedTokens, | 141 void expectTokensMatch(List expectedTokens, List receivedTokens, |
| 144 bool ignoreErrorOrder, [bool ignoreErrors = false, String message]) { | 142 bool ignoreErrorOrder, [bool ignoreErrors = false, String message]) { |
| 145 | 143 |
| 146 var checkSelfClosing = false; | 144 var checkSelfClosing = false; |
| 147 for (var token in expectedTokens) { | 145 for (var token in expectedTokens) { |
| 148 if (token[0] == "StartTag" && token.length == 4 | 146 if (token[0] == "StartTag" && token.length == 4 |
| 149 || token[0] == "EndTag" && token.length == 3) { | 147 || token[0] == "EndTag" && token.length == 3) { |
| 150 checkSelfClosing = true; | 148 checkSelfClosing = true; |
| 151 break; | 149 break; |
| 152 } | 150 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 for (var initialState in testInfo["initialStates"]) { | 256 for (var initialState in testInfo["initialStates"]) { |
| 259 test(testInfo["description"], () { | 257 test(testInfo["description"], () { |
| 260 testInfo["initialState"] = camelCase(initialState); | 258 testInfo["initialState"] = camelCase(initialState); |
| 261 runTokenizerTest(testInfo); | 259 runTokenizerTest(testInfo); |
| 262 }); | 260 }); |
| 263 } | 261 } |
| 264 } | 262 } |
| 265 }); | 263 }); |
| 266 } | 264 } |
| 267 } | 265 } |
| OLD | NEW |