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:io'; | 4 import 'dart:io'; |
5 import 'dart:json'; | 5 import 'dart:json'; |
6 import 'dart:mirrors'; | 6 import 'dart:mirrors'; |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'package:unittest/vm_config.dart'; | 8 import 'package:unittest/vm_config.dart'; |
9 import 'package:html5lib/src/char_encodings.dart'; | 9 import 'package:html5lib/src/char_encodings.dart'; |
10 import 'package:html5lib/src/constants.dart' as constants; | 10 import 'package:html5lib/src/constants.dart' as constants; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // Note: we can't get a closure of the state method. However, we can | 67 // Note: we can't get a closure of the state method. However, we can |
68 // create a new closure to invoke it via mirrors. | 68 // create a new closure to invoke it via mirrors. |
69 var mtok = reflect(tokenizer); | 69 var mtok = reflect(tokenizer); |
70 tokenizer.state = () => mtok.invoke(_state, const []).value.reflectee; | 70 tokenizer.state = () => mtok.invoke(_state, const []).value.reflectee; |
71 | 71 |
72 if (_lastStartTag != null) { | 72 if (_lastStartTag != null) { |
73 tokenizer.currentToken = new StartTagToken(_lastStartTag); | 73 tokenizer.currentToken = new StartTagToken(_lastStartTag); |
74 } | 74 } |
75 | 75 |
76 while (tokenizer.hasNext()) { | 76 while (tokenizer.hasNext) { |
77 var token = tokenizer.next(); | 77 var token = tokenizer.next(); |
78 switch (token.kind) { | 78 switch (token.kind) { |
79 case TokenKind.characters: | 79 case TokenKind.characters: |
80 processCharacters(token); | 80 processCharacters(token); |
81 break; | 81 break; |
82 case TokenKind.spaceCharacters: | 82 case TokenKind.spaceCharacters: |
83 processSpaceCharacters(token); | 83 processSpaceCharacters(token); |
84 break; | 84 break; |
85 case TokenKind.startTag: | 85 case TokenKind.startTag: |
86 processStartTag(token); | 86 processStartTag(token); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 test(testInfo["description"], () { | 295 test(testInfo["description"], () { |
296 testInfo["initialState"] = camelCase(initialState); | 296 testInfo["initialState"] = camelCase(initialState); |
297 runTokenizerTest(testInfo); | 297 runTokenizerTest(testInfo); |
298 }); | 298 }); |
299 } | 299 } |
300 } | 300 } |
301 }); | 301 }); |
302 } | 302 } |
303 }); | 303 }); |
304 } | 304 } |
OLD | NEW |