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

Side by Side Diff: test/selector_test.dart

Issue 1832993003: Fix all strong mode errors and warnings. (Closed) Base URL: https://github.com/dart-lang/csslib.git@master
Patch Set: Move type. Created 4 years, 8 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
« no previous file with comments | « test/nested_test.dart ('k') | test/var_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library selector_test; 5 library selector_test;
6 6
7 import 'package:csslib/parser.dart'; 7 import 'package:csslib/parser.dart';
8 import 'package:csslib/src/messages.dart';
8 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
9 10
10 import 'testing.dart'; 11 import 'testing.dart';
11 12
12 void testSelectorSuccesses() { 13 void testSelectorSuccesses() {
13 var errors = []; 14 var errors = <Message>[];
14 var selectorAst = selector('#div .foo', errors: errors); 15 var selectorAst = selector('#div .foo', errors: errors);
15 expect(errors.isEmpty, true, reason: errors.toString()); 16 expect(errors.isEmpty, true, reason: errors.toString());
16 expect('#div .foo', compactOuptut(selectorAst)); 17 expect('#div .foo', compactOuptut(selectorAst));
17 18
18 // Valid selectors for class names. 19 // Valid selectors for class names.
19 selectorAst = selector('.foo', errors: errors..clear()); 20 selectorAst = selector('.foo', errors: errors..clear());
20 expect(errors.isEmpty, true, reason: errors.toString()); 21 expect(errors.isEmpty, true, reason: errors.toString());
21 expect('.foo', compactOuptut(selectorAst)); 22 expect('.foo', compactOuptut(selectorAst));
22 23
23 selectorAst = selector('.foobar .xyzzy', errors: errors..clear()); 24 selectorAst = selector('.foobar .xyzzy', errors: errors..clear());
(...skipping 19 matching lines...) Expand all
43 expect('#id-number-3', compactOuptut(selectorAst)); 44 expect('#id-number-3', compactOuptut(selectorAst));
44 45
45 selectorAst = selector('#_privateId', errors: errors..clear()); 46 selectorAst = selector('#_privateId', errors: errors..clear());
46 expect(errors.isEmpty, true, reason: errors.toString()); 47 expect(errors.isEmpty, true, reason: errors.toString());
47 expect('#_privateId', compactOuptut(selectorAst)); 48 expect('#_privateId', compactOuptut(selectorAst));
48 } 49 }
49 50
50 // TODO(terry): Move this failure case to a failure_test.dart when the analyzer 51 // TODO(terry): Move this failure case to a failure_test.dart when the analyzer
51 // and validator exit then they'll be a bunch more checks. 52 // and validator exit then they'll be a bunch more checks.
52 void testSelectorFailures() { 53 void testSelectorFailures() {
53 var errors = []; 54 var errors = <Message>[];
54 55
55 // Test for invalid class name (can't start with number). 56 // Test for invalid class name (can't start with number).
56 selector('.foobar .1a-story .xyzzy', errors: errors); 57 selector('.foobar .1a-story .xyzzy', errors: errors);
57 expect(errors.isEmpty, false); 58 expect(errors.isEmpty, false);
58 expect(errors[0].toString(), 59 expect(errors[0].toString(),
59 'error on line 1, column 9: name must start with a alpha character, but ' 60 'error on line 1, column 9: name must start with a alpha character, but '
60 'found a number\n' 61 'found a number\n'
61 '.foobar .1a-story .xyzzy\n' 62 '.foobar .1a-story .xyzzy\n'
62 ' ^^'); 63 ' ^^');
63 } 64 }
64 65
65 main() { 66 main() {
66 test('Valid Selectors', testSelectorSuccesses); 67 test('Valid Selectors', testSelectorSuccesses);
67 test('Invalid Selectors', testSelectorFailures); 68 test('Invalid Selectors', testSelectorFailures);
68 } 69 }
OLDNEW
« no previous file with comments | « test/nested_test.dart ('k') | test/var_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698