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