OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 @TestOn("vm") |
| 6 |
| 7 library analyzer_cli.test.error; |
| 8 |
| 9 import 'package:test/test.dart'; |
| 10 |
| 11 import 'utils.dart'; |
| 12 |
| 13 void main() { |
| 14 group('error', () { |
| 15 test("a valid Dart file doesn't throw any errors", () { |
| 16 expect(errorsForFile('void main() => print("Hello, world!");'), isNull); |
| 17 }); |
| 18 |
| 19 test("an empty Dart file doesn't throw any errors", () { |
| 20 expect(errorsForFile(''), isNull); |
| 21 }); |
| 22 |
| 23 test("an error on the first line", () { |
| 24 expect(errorsForFile('void foo;\n'), equals( |
| 25 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 26 }); |
| 27 |
| 28 test("an error on the last line", () { |
| 29 expect(errorsForFile('\nvoid foo;'), equals( |
| 30 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 31 }); |
| 32 |
| 33 test("an error in the middle", () { |
| 34 expect(errorsForFile('\nvoid foo;\n'), equals( |
| 35 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 36 }); |
| 37 |
| 38 var veryLongString = new List.filled(107, ' ').join(''); |
| 39 |
| 40 test("an error at the end of a very long line", () { |
| 41 expect(errorsForFile('$veryLongString void foo;'), equals( |
| 42 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 43 }); |
| 44 |
| 45 test("an error at the beginning of a very long line", () { |
| 46 expect(errorsForFile('void foo; $veryLongString'), equals( |
| 47 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 48 }); |
| 49 |
| 50 test("an error in the middle of a very long line", () { |
| 51 expect(errorsForFile('$veryLongString void foo;$veryLongString'), equals( |
| 52 "Error in test.dart: Variables cannot have a type of 'void'\n")); |
| 53 }); |
| 54 }); |
| 55 } |
OLD | NEW |