| 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 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:path/path.dart'; | 7 import 'package:path/path.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/scanner.dart'; | 10 import 'package:analyzer/src/generated/scanner.dart'; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 'foo() {\n' | 181 'foo() {\n' |
| 182 '}\n', | 182 '}\n', |
| 183 'import "dart:io";\n\n' | 183 'import "dart:io";\n\n' |
| 184 'import "package:unittest/unittest.dart";\n' | 184 'import "package:unittest/unittest.dart";\n' |
| 185 'foo() {\n' | 185 'foo() {\n' |
| 186 '}\n' | 186 '}\n' |
| 187 ); | 187 ); |
| 188 expectCUFormatsTo( | 188 expectCUFormatsTo( |
| 189 'library a; class B { }', | 189 'library a; class B { }', |
| 190 'library a;\n' | 190 'library a;\n' |
| 191 'class B {\n' | 191 'class B {}\n' |
| 192 '}\n' | |
| 193 ); | 192 ); |
| 194 }); | 193 }); |
| 195 | 194 |
| 196 test('CU - method invocations', () { | 195 test('CU - method invocations', () { |
| 197 expectCUFormatsTo( | 196 expectCUFormatsTo( |
| 198 'class A {\n' | 197 'class A {\n' |
| 199 ' foo() {\n' | 198 ' foo() {\n' |
| 200 ' bar();\n' | 199 ' bar();\n' |
| 201 ' for (int i = 0; i < 42; i++) {\n' | 200 ' for (int i = 0; i < 42; i++) {\n' |
| 202 ' baz();\n' | 201 ' baz();\n' |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 transforms: false); | 944 transforms: false); |
| 946 }); | 945 }); |
| 947 | 946 |
| 948 // smoketest to ensure we're enforcing the 'no gratuitous linebreaks' | 947 // smoketest to ensure we're enforcing the 'no gratuitous linebreaks' |
| 949 // opinion | 948 // opinion |
| 950 test('CU (eat newlines)', () { | 949 test('CU (eat newlines)', () { |
| 951 expectCUFormatsTo( | 950 expectCUFormatsTo( |
| 952 'abstract\n' | 951 'abstract\n' |
| 953 'class\n' | 952 'class\n' |
| 954 'A{}', | 953 'A{}', |
| 955 'abstract class A {\n' | 954 'abstract class A {}\n' |
| 956 '}\n' | |
| 957 ); | 955 ); |
| 958 }); | 956 }); |
| 959 | 957 |
| 960 // test('line continuations - 1', () { | 958 // test('line continuations - 1', () { |
| 961 // expectStmtFormatsTo( | 959 // expectStmtFormatsTo( |
| 962 // 'if (x &&\n' | 960 // 'if (x &&\n' |
| 963 // ' y) {\n' | 961 // ' y) {\n' |
| 964 // ' print("yes!");\n' | 962 // ' print("yes!");\n' |
| 965 // '}', | 963 // '}', |
| 966 // 'if (x &&\n' | 964 // 'if (x &&\n' |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 input += lines[i++] + '\n'; | 1445 input += lines[i++] + '\n'; |
| 1448 } | 1446 } |
| 1449 while(++i < lines.length && !lines[i].startsWith('>>>')) { | 1447 while(++i < lines.length && !lines[i].startsWith('>>>')) { |
| 1450 expectedOutput += lines[i] + '\n'; | 1448 expectedOutput += lines[i] + '\n'; |
| 1451 } | 1449 } |
| 1452 test('test - (${testIndex++})', () { | 1450 test('test - (${testIndex++})', () { |
| 1453 expectClause(input, expectedOutput); | 1451 expectClause(input, expectedOutput); |
| 1454 }); | 1452 }); |
| 1455 } | 1453 } |
| 1456 } | 1454 } |
| OLD | NEW |