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

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

Issue 632553002: Make it easier to run engine tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
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;
6
5 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
6 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
7 9
8 void main() { 10 void main() {
9 test("parses a valid compilation unit successfully", () { 11 test("parses a valid compilation unit successfully", () {
10 var unit = parseCompilationUnit("void main() => print('Hello, world!');"); 12 var unit = parseCompilationUnit("void main() => print('Hello, world!');");
11 expect(unit.toString(), equals("void main() => print('Hello, world!');")); 13 expect(unit.toString(), equals("void main() => print('Hello, world!');"));
12 }); 14 });
13 15
14 test("throws errors for an invalid compilation unit", () { 16 test("throws errors for an invalid compilation unit", () {
15 expect(() { 17 expect(() {
16 parseCompilationUnit("void main() => print('Hello, world!')", 18 parseCompilationUnit("void main() => print('Hello, world!')",
17 name: 'test.dart'); 19 name: 'test.dart');
18 }, throwsA(predicate((error) { 20 }, throwsA(predicate((error) {
19 return error is AnalyzerErrorGroup && 21 return error is AnalyzerErrorGroup &&
20 error.toString().contains("Error in test.dart: Expected to find ';'"); 22 error.toString().contains("Error in test.dart: Expected to find ';'");
21 }))); 23 })));
22 }); 24 });
23 25
24 test("defaults to '<unknown source>' if no name is provided", () { 26 test("defaults to '<unknown source>' if no name is provided", () {
25 expect(() { 27 expect(() {
26 parseCompilationUnit("void main() => print('Hello, world!')"); 28 parseCompilationUnit("void main() => print('Hello, world!')");
27 }, throwsA(predicate((error) { 29 }, throwsA(predicate((error) {
28 return error is AnalyzerErrorGroup && 30 return error is AnalyzerErrorGroup &&
29 error.toString().contains("Error in <unknown source>: Expected to find ';'"); 31 error.toString().contains("Error in <unknown source>: Expected to find ';'");
30 }))); 32 })));
31 }); 33 });
32 } 34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698