| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 | |
| 6 library analyzer_cli.test.error; | 5 library analyzer_cli.test.error; |
| 7 | 6 |
| 8 import 'package:unittest/unittest.dart'; | 7 import 'package:test/test.dart'; |
| 9 | 8 |
| 10 import 'utils.dart'; | 9 import 'utils.dart'; |
| 11 | 10 |
| 12 void main() { | 11 void main() { |
| 13 group('error', () { | 12 group('error', () { |
| 14 test("a valid Dart file doesn't throw any errors", () { | 13 test("a valid Dart file doesn't throw any errors", () { |
| 15 expect(errorsForFile('void main() => print("Hello, world!");'), isNull); | 14 expect(errorsForFile('void main() => print("Hello, world!");'), isNull); |
| 16 }); | 15 }); |
| 17 | 16 |
| 18 test("an empty Dart file doesn't throw any errors", () { | 17 test("an empty Dart file doesn't throw any errors", () { |
| 19 expect(errorsForFile(''), isNull); | 18 expect(errorsForFile(''), isNull); |
| 20 }); | 19 }); |
| 21 | 20 |
| 22 test("an error on the first line", () { | 21 test("an error on the first line", () { |
| 23 expect(errorsForFile('void foo;\n'), equals( | 22 expect( |
| 24 "Error in test.dart: Variables cannot have a type of 'void'\n")); | 23 errorsForFile('void foo;\n'), |
| 24 equals( |
| 25 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 25 }); | 26 }); |
| 26 | 27 |
| 27 test("an error on the last line", () { | 28 test("an error on the last line", () { |
| 28 expect(errorsForFile('\nvoid foo;'), equals( | 29 expect( |
| 29 "Error in test.dart: Variables cannot have a type of 'void'\n")); | 30 errorsForFile('\nvoid foo;'), |
| 31 equals( |
| 32 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 30 }); | 33 }); |
| 31 | 34 |
| 32 test("an error in the middle", () { | 35 test("an error in the middle", () { |
| 33 expect(errorsForFile('\nvoid foo;\n'), equals( | 36 expect( |
| 34 "Error in test.dart: Variables cannot have a type of 'void'\n")); | 37 errorsForFile('\nvoid foo;\n'), |
| 38 equals( |
| 39 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 35 }); | 40 }); |
| 36 | 41 |
| 37 var veryLongString = new List.filled(107, ' ').join(''); | 42 var veryLongString = new List.filled(107, ' ').join(''); |
| 38 | 43 |
| 39 test("an error at the end of a very long line", () { | 44 test("an error at the end of a very long line", () { |
| 40 expect(errorsForFile('$veryLongString void foo;'), equals( | 45 expect( |
| 41 "Error in test.dart: Variables cannot have a type of 'void'\n")); | 46 errorsForFile('$veryLongString void foo;'), |
| 47 equals( |
| 48 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 42 }); | 49 }); |
| 43 | 50 |
| 44 test("an error at the beginning of a very long line", () { | 51 test("an error at the beginning of a very long line", () { |
| 45 expect(errorsForFile('void foo; $veryLongString'), equals( | 52 expect( |
| 46 "Error in test.dart: Variables cannot have a type of 'void'\n")); | 53 errorsForFile('void foo; $veryLongString'), |
| 54 equals( |
| 55 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 47 }); | 56 }); |
| 48 | 57 |
| 49 test("an error in the middle of a very long line", () { | 58 test("an error in the middle of a very long line", () { |
| 50 expect(errorsForFile('$veryLongString void foo;$veryLongString'), equals( | 59 expect( |
| 51 "Error in test.dart: Variables cannot have a type of 'void'\n")); | 60 errorsForFile('$veryLongString void foo;$veryLongString'), |
| 61 equals( |
| 62 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 52 }); | 63 }); |
| 53 }); | 64 }); |
| 54 } | 65 } |
| OLD | NEW |