| 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'; |
| 11 import 'package:analyzer/src/services/formatter_impl.dart'; | 11 import 'package:analyzer/src/services/formatter_impl.dart'; |
| 12 import 'package:analyzer/src/services/writer.dart'; | 12 import 'package:analyzer/src/services/writer.dart'; |
| 13 | 13 |
| 14 // Test data location ('pkg/analyzer/test/services/data') | 14 // Test data location ('pkg/analyzer/test/services/data') |
| 15 final TEST_DATA_DIR = join(dirname(fromUri(Platform.script)), 'data'); | 15 final TEST_DATA_DIR = join(dirname(fromUri(Platform.script)), 'data'); |
| 16 | 16 |
| 17 main() { | 17 main() { |
| 18 | 18 |
| 19 /// Data-driven statement tests | 19 /// Data-driven statement tests |
| 20 group('stmt_tests.data', () { | 20 group('stmt_tests.data', () { |
| 21 // NOTE: statement tests are run with transforms enabled |
| 21 runTests('stmt_tests.data', (input, expectedOutput) { | 22 runTests('stmt_tests.data', (input, expectedOutput) { |
| 22 expect(formatStatement(input) + '\n', equals(expectedOutput)); | 23 expect(formatStatement(input, |
| 24 options: new FormatterOptions(codeTransforms: true)) + '\n', |
| 25 equals(expectedOutput)); |
| 23 }); | 26 }); |
| 24 }); | 27 }); |
| 25 | 28 |
| 26 /// Data-driven compilation unit tests | 29 /// Data-driven compilation unit tests |
| 27 group('cu_tests.data', () { | 30 group('cu_tests.data', () { |
| 28 runTests('cu_tests.data', (input, expectedOutput) { | 31 runTests('cu_tests.data', (input, expectedOutput) { |
| 29 expectCUFormatsTo(input, expectedOutput); | 32 expectCUFormatsTo(input, expectedOutput); |
| 30 }); | 33 }); |
| 31 }); | 34 }); |
| 32 | 35 |
| (...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 input += lines[i++] + '\n'; | 1434 input += lines[i++] + '\n'; |
| 1432 } | 1435 } |
| 1433 while(++i < lines.length && !lines[i].startsWith('>>>')) { | 1436 while(++i < lines.length && !lines[i].startsWith('>>>')) { |
| 1434 expectedOutput += lines[i] + '\n'; | 1437 expectedOutput += lines[i] + '\n'; |
| 1435 } | 1438 } |
| 1436 test('test - (${testIndex++})', () { | 1439 test('test - (${testIndex++})', () { |
| 1437 expectClause(input, expectedOutput); | 1440 expectClause(input, expectedOutput); |
| 1438 }); | 1441 }); |
| 1439 } | 1442 } |
| 1440 } | 1443 } |
| OLD | NEW |