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

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

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

Powered by Google App Engine
This is Rietveld 408576698