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

Side by Side Diff: pkg/analyzer2dart/test/test_helper.dart

Issue 669673006: Add SExpression test and share tests between dart2dart and analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. 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
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4
5 /// Helpers for defining input/output based unittests through (constant) data.
6
7 import 'package:unittest/unittest.dart';
8
9 /// A unittest group with a name and a list of input/output results.
10 class Group {
11 final String name;
12 final List<TestSpec> results;
13
14 const Group(this.name, this.results);
15 }
16
17 /// A input/output pair that defines the expected [output] of when processing
18 /// the [input].
19 class TestSpec {
20 final String input;
21 final String output;
22
23 const TestSpec(this.input, this.output);
24 }
25
26 typedef TestGroup(Group group, RunTest check);
27 typedef RunTest(TestSpec result);
28
29 /// Test [data] using [testGroup] and [check].
30 void performTests(List<Group> data, TestGroup testGroup, RunTest runTest) {
31 for (Group group in data) {
32 testGroup(group, runTest);
33 }
34 }
35
36 /// Test group using unittest.
37 unittester(Group group, RunTest runTest) {
38 test(group.name, () {
39 for (TestSpec result in group.results) {
40 runTest(result);
41 }
42 });
43 }
OLDNEW
« no previous file with comments | « pkg/analyzer2dart/test/sexpr_test.dart ('k') | tests/compiler/dart2js/backend_dart/end2end_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698