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

Side by Side Diff: pkg/analyzer/test/parse_compilation_unit_test.dart

Issue 1081083002: expose option to not parse function bodies when calling parseCompilationUnit (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/lib/analyzer.dart ('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 test.parse.compilation.unit; 5 library test.parse.compilation.unit;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 void main() { 10 void main() {
(...skipping 14 matching lines...) Expand all
25 }); 25 });
26 26
27 test("defaults to '<unknown source>' if no name is provided", () { 27 test("defaults to '<unknown source>' if no name is provided", () {
28 expect(() { 28 expect(() {
29 parseCompilationUnit("void main() => print('Hello, world!')"); 29 parseCompilationUnit("void main() => print('Hello, world!')");
30 }, throwsA(predicate((error) { 30 }, throwsA(predicate((error) {
31 return error is AnalyzerErrorGroup && 31 return error is AnalyzerErrorGroup &&
32 error.toString().contains("Error in <unknown source>: Expected to find ';'"); 32 error.toString().contains("Error in <unknown source>: Expected to find ';'");
33 }))); 33 })));
34 }); 34 });
35
36 test("allows you to specify whether or not to parse function bodies", () {
37 var unit = parseCompilationUnit(
38 "void main() => print('Hello, world!');", parseFunctionBodies: false);
39 expect(unit.toString(), equals("void main() ;"));
40 });
35 } 41 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/analyzer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698