Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: pkg/analyzer/test/services/formatter_test.dart

Issue 254133006: Test fixes to catch up with Parser changes (dartbug.com/18315). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/test/services/data/cu_tests.data ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library formatter_test; 5 library formatter_test;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:path/path.dart'; 9 import 'package:path/path.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 11 matching lines...) Expand all
22 group('stmt_tests.data', () { 22 group('stmt_tests.data', () {
23 // NOTE: statement tests are run with transforms enabled 23 // NOTE: statement tests are run with transforms enabled
24 runTests('stmt_tests.data', (input, expectedOutput) { 24 runTests('stmt_tests.data', (input, expectedOutput) {
25 expect(formatStatement(input, 25 expect(formatStatement(input,
26 options: new FormatterOptions(codeTransforms: true)) + '\n', 26 options: new FormatterOptions(codeTransforms: true)) + '\n',
27 equals(expectedOutput)); 27 equals(expectedOutput));
28 }); 28 });
29 }); 29 });
30 30
31 /// Data-driven compilation unit tests 31 /// Data-driven compilation unit tests
32 /// TODO(scheglov) https://code.google.com/p/dart/issues/detail?id=18315 32 group('cu_tests.data', () {
33 // group('cu_tests.data', () { 33 runTests('cu_tests.data', (input, expectedOutput) {
34 // runTests('cu_tests.data', (input, expectedOutput) { 34 expectCUFormatsTo(input, expectedOutput);
35 // expectCUFormatsTo(input, expectedOutput); 35 });
36 // }); 36 });
37 // });
38 37
39 /// Data-driven Style Guide acceptance tests 38 /// Data-driven Style Guide acceptance tests
40 group('style_guide_tests.data', () { 39 group('style_guide_tests.data', () {
41 runTests('style_guide_tests.data', (input, expectedOutput) { 40 runTests('style_guide_tests.data', (input, expectedOutput) {
42 expectCUFormatsTo(input, expectedOutput); 41 expectCUFormatsTo(input, expectedOutput);
43 }); 42 });
44 }); 43 });
45 44
46 /// Formatter tests 45 /// Formatter tests
47 group('formatter', () { 46 group('formatter', () {
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 expectStmtFormatsTo(src, expected, {transforms: true}) => 1471 expectStmtFormatsTo(src, expected, {transforms: true}) =>
1473 expect(formatStatement(src, options: 1472 expect(formatStatement(src, options:
1474 new FormatterOptions(codeTransforms: transforms)), equals(expected)); 1473 new FormatterOptions(codeTransforms: transforms)), equals(expected));
1475 1474
1476 1475
1477 runTests(testFileName, expectClause(input, output)) { 1476 runTests(testFileName, expectClause(input, output)) {
1478 1477
1479 var testIndex = 1; 1478 var testIndex = 1;
1480 var testFile = new File(join(TEST_DATA_DIR, testFileName)); 1479 var testFile = new File(join(TEST_DATA_DIR, testFileName));
1481 var lines = testFile.readAsLinesSync(); 1480 var lines = testFile.readAsLinesSync();
1482
1483 for (var i = 1; i < lines.length; ++i) { 1481 for (var i = 1; i < lines.length; ++i) {
1484 var input = '', expectedOutput = ''; 1482 var input = '', expectedOutput = '';
1485 while(!lines[i].startsWith('<<<')) { 1483 while(!lines[i].startsWith('<<<')) {
1486 input += lines[i++] + '\n'; 1484 input += lines[i++] + '\n';
1487 } 1485 }
1488 while(++i < lines.length && !lines[i].startsWith('>>>')) { 1486 while(++i < lines.length && !lines[i].startsWith('>>>')) {
1489 expectedOutput += lines[i] + '\n'; 1487 expectedOutput += lines[i] + '\n';
1490 } 1488 }
1491 test('test - (${testIndex++})', () { 1489 test('test - (${testIndex++})', () {
1492 expectClause(input, expectedOutput); 1490 expectClause(input, expectedOutput);
1493 }); 1491 });
1494 } 1492 }
1495 } 1493 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/services/data/cu_tests.data ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698