| OLD | NEW |
| 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 empty Dart file doesn't throw any errors", () { |
| 17 expect( |
| 18 errorsForFile(''), |
| 19 isNull); |
| 20 }); |
| 21 |
| 16 test("an error on the first line", () { | 22 test("an error on the first line", () { |
| 17 expect(errorsForFile('void foo;\n'), | 23 expect(errorsForFile('void foo;\n'), |
| 18 equals("Error in test.dart: Variables cannot have a type of 'void'\n")); | 24 equals("Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 19 }); | 25 }); |
| 20 | 26 |
| 21 test("an error on the last line", () { | 27 test("an error on the last line", () { |
| 22 expect(errorsForFile('\nvoid foo;'), | 28 expect(errorsForFile('\nvoid foo;'), |
| 23 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")); |
| 24 }); | 30 }); |
| 25 | 31 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 test("an error at the beginning of a very long line", () { | 44 test("an error at the beginning of a very long line", () { |
| 39 expect(errorsForFile('void foo; $veryLongString'), | 45 expect(errorsForFile('void foo; $veryLongString'), |
| 40 equals("Error in test.dart: Variables cannot have a type of 'void'\n")); | 46 equals("Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 41 }); | 47 }); |
| 42 | 48 |
| 43 test("an error in the middle of a very long line", () { | 49 test("an error in the middle of a very long line", () { |
| 44 expect(errorsForFile('$veryLongString void foo;$veryLongString'), | 50 expect(errorsForFile('$veryLongString void foo;$veryLongString'), |
| 45 equals("Error in test.dart: Variables cannot have a type of 'void'\n")); | 51 equals("Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 46 }); | 52 }); |
| 47 } | 53 } |
| OLD | NEW |