Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: utils/tests/css/src/SelectorLiteralTest.dart

Issue 9695048: Template parser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix GIT mixup - ugh Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #import("../../../css/css.dart"); 5 #import("../../../css/css.dart");
6 #import('../../../../frog/lang.dart', prefix:'lang'); 6 #import('../../../../frog/lang.dart', prefix:'lang');
7 7
8 class SelectorLiteralTest { 8 class SelectorLiteralTest {
9 static final String ERROR = 'CompilerException: <buffer>:'; 9 static final String ERROR = 'CompilerException: <buffer>:';
10 10
11 static testMain() { 11 static testMain() {
12 initCssWorld(); 12 initCssWorld();
13 lang.options.useColors = false; 13 options.useColors = false;
14 14
15 testSimpleClassSelectorSuccesses(); 15 testSimpleClassSelectorSuccesses();
16 testSimpleClassSelectorFailures(); 16 testSimpleClassSelectorFailures();
17 testPrivateNameFailures(); 17 testPrivateNameFailures();
18 } 18 }
19 19
20 static void testSimpleClassSelectorSuccesses() { 20 static void testSimpleClassSelectorSuccesses() {
21 List<String> knownClasses = ['foobar', 'xyzzy', 'a-story', 'b-story']; 21 List<String> knownClasses = ['foobar', 'xyzzy', 'a-story', 'b-story'];
22 List<String> knownIds = ['id1', 'id2', 'id-number-3']; 22 List<String> knownIds = ['id1', 'id2', 'id-number-3'];
23 23
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 Expect.equals("CssSelectorException: Unknown selector name .xyzzy1", 83 Expect.equals("CssSelectorException: Unknown selector name .xyzzy1",
84 e.toString()); 84 e.toString());
85 } 85 }
86 86
87 // Test for invalid class name (can't start with number). 87 // Test for invalid class name (can't start with number).
88 css = '@{.foobar .1a-story .xyzzy}'; 88 css = '@{.foobar .1a-story .xyzzy}';
89 try { 89 try {
90 cssParseAndValidate('${css}', cssWorld); 90 cssParseAndValidate('${css}', cssWorld);
91 Expect.fail("${css} should not succeed."); 91 Expect.fail("${css} should not succeed.");
92 } catch (final e) { 92 } catch (final e) {
93 Expect.equals("${ERROR}1:11: fatal: expected }, but found double(.1)\n" + 93 Expect.equals("${ERROR}1:11: fatal: parsing error expected }\n" +
94 "${css}\n ^^", e.toString()); 94 "${css}\n ^^", e.toString());
95 } 95 }
96 96
97 // element id must be single selector. 97 // element id must be single selector.
98 css = '@{#id1 #id2}'; 98 css = '@{#id1 #id2}';
99 try { 99 try {
100 cssParseAndValidate('${css}', cssWorld); 100 cssParseAndValidate('${css}', cssWorld);
101 Expect.fail("${css} should not succeed."); 101 Expect.fail("${css} should not succeed.");
102 } catch (final e) { 102 } catch (final e) {
103 Expect.equals("CssSelectorException: Use of Id selector must be " + 103 Expect.equals("CssSelectorException: Use of Id selector must be " +
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 Expect.equals("CssSelectorException: Use of Id selector must be " + 233 Expect.equals("CssSelectorException: Use of Id selector must be " +
234 "singleton starting at #_privateId2", e.toString()); 234 "singleton starting at #_privateId2", e.toString());
235 } 235 }
236 } 236 }
237 237
238 } 238 }
239 239
240 main() { 240 main() {
241 SelectorLiteralTest.testMain(); 241 SelectorLiteralTest.testMain();
242 } 242 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698