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

Side by Side Diff: pkg/analyzer/test/error_test.dart

Issue 189443009: Analzyzer test fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « pkg/analyzer/lib/src/error.dart ('k') | pkg/analyzer/test/parse_compilation_unit_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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 'package:unittest/unittest.dart'; 5 import 'package:unittest/unittest.dart';
6 6
7 import 'utils.dart'; 7 import 'utils.dart';
8 8
9 void main() { 9 void main() {
10 test("a valid Dart file doesn't throw any errors", () { 10 test("a valid Dart file doesn't throw any errors", () {
11 expect( 11 expect(
12 errorsForFile('void main() => print("Hello, world!");'), 12 errorsForFile('void main() => print("Hello, world!");'),
13 isNull); 13 isNull);
14 }); 14 });
15 15
16 test("an error on the first line", () { 16 test("an error on the first line", () {
17 expect(errorsForFile('void foo;\n'), 17 expect(errorsForFile('void foo;\n'),
18 equals('Error on line 1 of test.dart: ...\n' 18 equals("Error in test.dart: Variables cannot have a type of 'void'\n"));
19 'void foo;\n'
20 '^^^^\n'));
21 }); 19 });
22 20
23 test("an error on the last line", () { 21 test("an error on the last line", () {
24 expect(errorsForFile('\nvoid foo;'), 22 expect(errorsForFile('\nvoid foo;'),
25 equals('Error on line 2 of test.dart: ...\n' 23 equals("Error in test.dart: Variables cannot have a type of 'void'\n"));
26 'void foo;\n'
27 '^^^^\n'));
28 }); 24 });
29 25
30 test("an error in the middle", () { 26 test("an error in the middle", () {
31 expect(errorsForFile('\nvoid foo;\n'), 27 expect(errorsForFile('\nvoid foo;\n'),
32 equals('Error on line 2 of test.dart: ...\n' 28 equals("Error in test.dart: Variables cannot have a type of 'void'\n"));
33 'void foo;\n'
34 '^^^^\n'));
35 }); 29 });
36 30
37 var veryLongString = new List.filled(107, ' ').join(''); 31 var veryLongString = new List.filled(107, ' ').join('');
38 32
39 test("an error at the end of a very long line", () { 33 test("an error at the end of a very long line", () {
40 expect(errorsForFile('$veryLongString void foo;'), 34 expect(errorsForFile('$veryLongString void foo;'),
41 equals('Error on line 1 of test.dart: ...\n' 35 equals("Error in test.dart: Variables cannot have a type of 'void'\n"));
42 '...$veryLongString void foo;\n'
43 '$veryLongString ^^^^\n'));
44 }); 36 });
45 37
46 test("an error at the beginning of a very long line", () { 38 test("an error at the beginning of a very long line", () {
47 expect(errorsForFile('void foo; $veryLongString'), 39 expect(errorsForFile('void foo; $veryLongString'),
48 equals('Error on line 1 of test.dart: ...\n' 40 equals("Error in test.dart: Variables cannot have a type of 'void'\n"));
49 'void foo; $veryLongString...\n'
50 '^^^^\n'));
51 }); 41 });
52 42
53 test("an error in the middle of a very long line", () { 43 test("an error in the middle of a very long line", () {
54 expect(errorsForFile('$veryLongString void foo;$veryLongString'), 44 expect(errorsForFile('$veryLongString void foo;$veryLongString'),
55 equals('Error on line 1 of test.dart: ...\n' 45 equals("Error in test.dart: Variables cannot have a type of 'void'\n"));
56 '... '
57 'void foo; '
58 '...\n'
59 ' '
60 '^^^^\n'));
61 }); 46 });
62 } 47 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/error.dart ('k') | pkg/analyzer/test/parse_compilation_unit_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698