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

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

Issue 2399913002: Remove 'initializeTestEnvironment' from 'analyzer'. (Closed)
Patch Set: Created 4 years, 2 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
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 analyzer.test.parse_compilation_unit_test; 5 library analyzer.test.parse_compilation_unit_test;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 9
10 import 'utils.dart';
11
12 void main() { 10 void main() {
13 initializeTestEnvironment();
14 test("parses a valid compilation unit successfully", () { 11 test("parses a valid compilation unit successfully", () {
15 var unit = parseCompilationUnit("void main() => print('Hello, world!');"); 12 var unit = parseCompilationUnit("void main() => print('Hello, world!');");
16 expect(unit.toString(), equals("void main() => print('Hello, world!');")); 13 expect(unit.toString(), equals("void main() => print('Hello, world!');"));
17 }); 14 });
18 15
19 test("throws errors for an invalid compilation unit", () { 16 test("throws errors for an invalid compilation unit", () {
20 expect(() { 17 expect(() {
21 parseCompilationUnit("void main() => print('Hello, world!')", 18 parseCompilationUnit("void main() => print('Hello, world!')",
22 name: 'test.dart'); 19 name: 'test.dart');
23 }, throwsA(predicate((error) { 20 }, throwsA(predicate((error) {
(...skipping 12 matching lines...) Expand all
36 .contains("Error in <unknown source>: Expected to find ';'"); 33 .contains("Error in <unknown source>: Expected to find ';'");
37 }))); 34 })));
38 }); 35 });
39 36
40 test("allows you to specify whether or not to parse function bodies", () { 37 test("allows you to specify whether or not to parse function bodies", () {
41 var unit = parseCompilationUnit("void main() => print('Hello, world!');", 38 var unit = parseCompilationUnit("void main() => print('Hello, world!');",
42 parseFunctionBodies: false); 39 parseFunctionBodies: false);
43 expect(unit.toString(), equals("void main();")); 40 expect(unit.toString(), equals("void main();"));
44 }); 41 });
45 } 42 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/utilities_test.dart ('k') | pkg/analyzer/test/source/analysis_options_provider_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698