OLD | NEW |
1 library Suites; | 1 library Suites; |
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 { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 return _SUITE_DESCRIPTIONS; | 130 return _SUITE_DESCRIPTIONS; |
131 } | 131 } |
132 | 132 |
133 static List<SuiteDescription> getSuites(String tags) { | 133 static List<SuiteDescription> getSuites(String tags) { |
134 // Allow AND and OR in place of '&' and '|' for browsers where | 134 // Allow AND and OR in place of '&' and '|' for browsers where |
135 // those symbols are escaped. | 135 // those symbols are escaped. |
136 tags = tags.replaceAll('OR', '|').replaceAll('AND', '&'); | 136 tags = tags.replaceAll('OR', '|').replaceAll('AND', '&'); |
137 // A disjunction of conjunctions (e.g., | 137 // A disjunction of conjunctions (e.g., |
138 // 'js&modify|dart&dom&modify'). | 138 // 'js&modify|dart&dom&modify'). |
139 final taglist = tags.split('|').mappedBy((tag) => tag.split('&')).toList(); | 139 final taglist = tags.split('|').map((tag) => tag.split('&')).toList(); |
140 | 140 |
141 bool match(suite) { | 141 bool match(suite) { |
142 // If any conjunction matches, return true. | 142 // If any conjunction matches, return true. |
143 for (final tagset in taglist) { | 143 for (final tagset in taglist) { |
144 if (tagset.every((tag) => suite.tags.indexOf(tag) >= 0)) { | 144 if (tagset.every((tag) => suite.tags.indexOf(tag) >= 0)) { |
145 return true; | 145 return true; |
146 } | 146 } |
147 } | 147 } |
148 return false; | 148 return false; |
149 } | 149 } |
150 final suites = SUITE_DESCRIPTIONS.where(match).toList(); | 150 final suites = SUITE_DESCRIPTIONS.where(match).toList(); |
151 | 151 |
152 suites.sort((s1, s2) => s1.name.compareTo(s2.name)); | 152 suites.sort((s1, s2) => s1.name.compareTo(s2.name)); |
153 return suites; | 153 return suites; |
154 } | 154 } |
155 | 155 |
156 static getCategory(String tags) { | 156 static getCategory(String tags) { |
157 if (CATEGORIES.containsKey(tags)) { | 157 if (CATEGORIES.containsKey(tags)) { |
158 return CATEGORIES[tags]; | 158 return CATEGORIES[tags]; |
159 } | 159 } |
160 for (final suite in _CORE_SUITE_DESCRIPTIONS) { | 160 for (final suite in _CORE_SUITE_DESCRIPTIONS) { |
161 if (suite.tags[0] == tags) { | 161 if (suite.tags[0] == tags) { |
162 return suite.name; | 162 return suite.name; |
163 } | 163 } |
164 } | 164 } |
165 return null; | 165 return null; |
166 } | 166 } |
167 } | 167 } |
OLD | NEW |