| OLD | NEW |
| 1 /** Support code for the tests in this directory. */ | 1 /** Support code for the tests in this directory. */ |
| 2 library support; | 2 library support; |
| 3 | 3 |
| 4 import 'dart:async'; | 4 import 'dart:async'; |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'package:path/path.dart' as path; | 7 import 'package:path/path.dart' as path; |
| 8 import 'package:html5lib/src/treebuilder.dart'; | 8 import 'package:html5lib/src/treebuilder.dart'; |
| 9 import 'package:html5lib/dom.dart'; | 9 import 'package:html5lib/dom.dart'; |
| 10 import 'package:html5lib/dom_parsing.dart'; | 10 import 'package:html5lib/dom_parsing.dart'; |
| 11 | 11 |
| 12 typedef TreeBuilder TreeBuilderFactory(bool namespaceHTMLElements); | 12 typedef TreeBuilder TreeBuilderFactory(bool namespaceHTMLElements); |
| 13 | 13 |
| 14 Map _treeTypes; | 14 Map _treeTypes; |
| 15 Map<String, TreeBuilderFactory> get treeTypes { | 15 Map<String, TreeBuilderFactory> get treeTypes { |
| 16 if (_treeTypes == null) { | 16 if (_treeTypes == null) { |
| 17 // TODO(jmesserly): add DOM here once it's implemented | 17 // TODO(jmesserly): add DOM here once it's implemented |
| 18 _treeTypes = { "simpletree": (useNs) => new TreeBuilder(useNs) }; | 18 _treeTypes = { "simpletree": (useNs) => new TreeBuilder(useNs) }; |
| 19 } | 19 } |
| 20 return _treeTypes; | 20 return _treeTypes; |
| 21 } | 21 } |
| 22 | 22 |
| 23 final testDataDir = Platform.script.resolve('data').toFilePath(); | 23 final testDataDir = path.join(path.dirname(Platform.script), 'data'); |
| 24 | 24 |
| 25 Iterable<String> getDataFiles(String subdirectory) { | 25 Iterable<String> getDataFiles(String subdirectory) { |
| 26 var dir = new Directory(path.join(testDataDir, subdirectory)); | 26 var dir = new Directory(path.join(testDataDir, subdirectory)); |
| 27 return dir.listSync().where((f) => f is File).map((f) => f.path); | 27 return dir.listSync().where((f) => f is File).map((f) => f.path); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // TODO(jmesserly): make this class simpler. We could probably split on | 30 // TODO(jmesserly): make this class simpler. We could probably split on |
| 31 // "\n#" instead of newline and remove a lot of code. | 31 // "\n#" instead of newline and remove a lot of code. |
| 32 class TestData extends IterableBase<Map> { | 32 class TestData extends IterableBase<Map> { |
| 33 final String _text; | 33 final String _text; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 key = "${attr.prefix} ${attr.name}"; | 159 key = "${attr.prefix} ${attr.name}"; |
| 160 } | 160 } |
| 161 _newline(); | 161 _newline(); |
| 162 _str.write('$key="$v"'); | 162 _str.write('$key="$v"'); |
| 163 } | 163 } |
| 164 indent -= 2; | 164 indent -= 2; |
| 165 } | 165 } |
| 166 visitChildren(node); | 166 visitChildren(node); |
| 167 } | 167 } |
| 168 } | 168 } |
| OLD | NEW |