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

Side by Side Diff: test/runtime/dart_logging_runtime_test.dart

Issue 1148283010: Remove dart backend (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « test/dart_codegen/types/d.dart ('k') | test/runtime/dart_runtime_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, 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 import 'package:dev_compiler/runtime/dart_logging_runtime.dart' as devc;
6 import 'package:test/test.dart';
7
8 class A<T> {
9 T x;
10 A(this.x);
11 }
12
13 class B extends A<String> {
14 B() : super("B!");
15 }
16
17 void runTest() {
18 var astring = new A<String>("").runtimeType;
19 var l = [new A<String>("hello"), new A("world"), new B(), 42];
20 for (var item in l) {
21 try {
22 devc.cast(item, dynamic, astring);
23 } catch (e) {
24 // Do nothing
25 }
26 }
27 }
28
29 final expected = '''
30 Key test/runtime/dart_logging_runtime_test.dart 22:16 in runTest:
31 - static type: A<String>
32 - runtime types: {A, int}
33 - success: 0 (0.0)
34 - failure: 1 (0.5)
35 - mismatch: 1 (0.5)
36 - error: 0 (0.0)
37 ''';
38
39 void main() {
40 test('summary', () {
41 runTest();
42 var output = devc.summary();
43 expect(output, equals(expected));
44 });
45
46 test('handler', () {
47 int devcFailures = 0;
48 int dartFailures = 0;
49 devc.castRecordHandler = (String key, devc.CastRecord record) {
50 devcFailures += record.soundCast ? 0 : 1;
51 dartFailures += record.dartCast ? 0 : 1;
52 };
53 runTest();
54 expect(devcFailures, equals(2));
55 expect(dartFailures, equals(1));
56 });
57 }
OLDNEW
« no previous file with comments | « test/dart_codegen/types/d.dart ('k') | test/runtime/dart_runtime_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698