| OLD | NEW |
| 1 #library('Suites.dart'); | 1 #library('Suites.dart'); |
| 2 | 2 |
| 3 class Origin { | 3 class Origin { |
| 4 final String author; | 4 final String author; |
| 5 final String url; | 5 final String url; |
| 6 | 6 |
| 7 const Origin(this.author, this.url); | 7 const Origin(this.author, this.url); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class SuiteDescription { | 10 class SuiteDescription { |
| 11 final String file; | 11 final String file; |
| 12 final String name; | 12 final String name; |
| 13 final Origin origin; | 13 final Origin origin; |
| 14 final String description; | 14 final String description; |
| 15 final List<String> tags; | 15 final List<String> tags; |
| 16 | 16 |
| 17 const SuiteDescription(this.file, this.name, this.origin, | 17 const SuiteDescription(this.file, this.name, this.origin, |
| 18 this.description, this.tags); | 18 this.description, this.tags); |
| 19 } | 19 } |
| 20 | 20 |
| 21 class Suites { | 21 class Suites { |
| 22 static final JOHN_RESIG = const Origin('John Resig', 'http://ejohn.org/'); | 22 static final JOHN_RESIG = const Origin('John Resig', 'http://ejohn.org/'); |
| 23 | 23 |
| 24 static final CATEGORIES = const { | 24 static final CATEGORIES = const { |
| 25 'dom': 'DOM Core Tests (dart:dom)', | 25 'dom': 'DOM Core Tests (dart:dom)', |
| 26 'html': 'DOM Core Tests (dart:html)', | 26 'html': 'DOM Core Tests (dart:html)', |
| 27 'htmlidiomatic': 'DOM Core Tests (dart:html) Idiomatic', |
| 27 'js': 'DOM Core Tests (JavaScript)', | 28 'js': 'DOM Core Tests (JavaScript)', |
| 28 'dart': 'DOM Core Tests (dart)', | 29 'dart': 'DOM Core Tests (dart)', |
| 29 'frog': 'DOM Core Tests (frog)', | 30 'frog': 'DOM Core Tests (frog)', |
| 30 }; | 31 }; |
| 31 | 32 |
| 32 static final _CORE_SUITE_DESCRIPTIONS = const [ | 33 static final _CORE_SUITE_DESCRIPTIONS = const [ |
| 33 const SuiteDescription( | 34 const SuiteDescription( |
| 34 'dom-attr.html', | 35 'dom-attr.html', |
| 35 'DOM Attributes', | 36 'DOM Attributes', |
| 36 JOHN_RESIG, | 37 JOHN_RESIG, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 suite.description, | 69 suite.description, |
| 69 combined); | 70 combined); |
| 70 } | 71 } |
| 71 return suites.map(getVariant); | 72 return suites.map(getVariant); |
| 72 } | 73 } |
| 73 | 74 |
| 74 // Mappings from original path to Dart-specific variants. | 75 // Mappings from original path to Dart-specific variants. |
| 75 static _jsPath(path) => path; | 76 static _jsPath(path) => path; |
| 76 static _domPath(path) => path.replaceFirst('.html', '-dom.html'); | 77 static _domPath(path) => path.replaceFirst('.html', '-dom.html'); |
| 77 static _htmlPath(path) => path.replaceFirst('.html', '-html.html'); | 78 static _htmlPath(path) => path.replaceFirst('.html', '-html.html'); |
| 79 static _htmlIdiomaticPath(path) => |
| 80 path.replaceFirst('.html', '-htmlidiomatic.html'); |
| 78 static _frogDomPath(path) => | 81 static _frogDomPath(path) => |
| 79 'frog/${path.replaceFirst(".html", "-dom-js.html")}'; | 82 'frog/${path.replaceFirst(".html", "-dom-js.html")}'; |
| 80 static _frogHtmlPath(path) => | 83 static _frogHtmlPath(path) => |
| 81 'frog/${path.replaceFirst(".html", "-html-js.html")}'; | 84 'frog/${path.replaceFirst(".html", "-html-js.html")}'; |
| 85 static _frogHtmlIdiomaticPath(path) => |
| 86 'frog/${path.replaceFirst(".html", "-htmlidiomatic-js.html")}'; |
| 82 | 87 |
| 83 static var _SUITE_DESCRIPTIONS; | 88 static var _SUITE_DESCRIPTIONS; |
| 84 | 89 |
| 85 static List<SuiteDescription> get SUITE_DESCRIPTIONS() { | 90 static List<SuiteDescription> get SUITE_DESCRIPTIONS() { |
| 86 if (null !== _SUITE_DESCRIPTIONS) { | 91 if (null !== _SUITE_DESCRIPTIONS) { |
| 87 return _SUITE_DESCRIPTIONS; | 92 return _SUITE_DESCRIPTIONS; |
| 88 } | 93 } |
| 89 _SUITE_DESCRIPTIONS = <SuiteDescription>[]; | 94 _SUITE_DESCRIPTIONS = <SuiteDescription>[]; |
| 90 add(variant, mapper, tags) { | 95 add(variant, mapper, tags) { |
| 91 _SUITE_DESCRIPTIONS.addAll( | 96 _SUITE_DESCRIPTIONS.addAll( |
| 92 getVariants(_CORE_SUITE_DESCRIPTIONS, variant, mapper, tags)); | 97 getVariants(_CORE_SUITE_DESCRIPTIONS, variant, mapper, tags)); |
| 93 } | 98 } |
| 94 add('js', _jsPath, ['js']); | 99 add('js', _jsPath, ['js']); |
| 95 add('dart:dom', _domPath, ['dart', 'dom']); | 100 add('dart:dom', _domPath, ['dart', 'dom']); |
| 96 add('dart:html', _htmlPath, ['dart', 'html']); | 101 add('dart:html', _htmlPath, ['dart', 'html']); |
| 102 add('dart:html idiomatic', _htmlPath, ['dart', 'htmlidiomatic']); |
| 97 add('frog dart:dom', _frogDomPath, ['frog', 'dom']); | 103 add('frog dart:dom', _frogDomPath, ['frog', 'dom']); |
| 98 add('frog dart:html', _frogHtmlPath, ['frog', 'html']); | 104 add('frog dart:html', _frogHtmlPath, ['frog', 'html']); |
| 105 add('frog dart:html idiomatic', _frogHtmlIdiomaticPath, |
| 106 ['frog', 'htmlidiomatic']); |
| 99 return _SUITE_DESCRIPTIONS; | 107 return _SUITE_DESCRIPTIONS; |
| 100 } | 108 } |
| 101 | 109 |
| 102 static List<SuiteDescription> getSuites(String tags) { | 110 static List<SuiteDescription> getSuites(String tags) { |
| 103 // A disjunction of conjunctions (e.g., | 111 // A disjunction of conjunctions (e.g., |
| 104 // 'js&modify|dart&dom&modify'). | 112 // 'js&modify|dart&dom&modify'). |
| 105 final taglist = tags.split('|').map((tag) => tag.split('&')); | 113 final taglist = tags.split('|').map((tag) => tag.split('&')); |
| 106 | 114 |
| 107 bool match(suite) { | 115 bool match(suite) { |
| 108 // If any conjunction matches, return true. | 116 // If any conjunction matches, return true. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 124 return CATEGORIES[tags]; | 132 return CATEGORIES[tags]; |
| 125 } | 133 } |
| 126 for (final suite in _CORE_SUITE_DESCRIPTIONS) { | 134 for (final suite in _CORE_SUITE_DESCRIPTIONS) { |
| 127 if (suite.tags[0] == tags) { | 135 if (suite.tags[0] == tags) { |
| 128 return suite.name; | 136 return suite.name; |
| 129 } | 137 } |
| 130 } | 138 } |
| 131 return null; | 139 return null; |
| 132 } | 140 } |
| 133 } | 141 } |
| OLD | NEW |