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

Side by Side Diff: tests/compiler/dart2js_native/subclassing_1_test.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord; 6 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord;
7 import 'dart:_interceptors' show findInterceptorForType; 7 import 'dart:_interceptors' show findInterceptorForType;
8 8
9 // Test that subclasses of native classes can be defined by setting the dispatch 9 // Test that subclasses of native classes can be defined by setting the dispatch
10 // record. 10 // record.
11 11
12 @Native("A") 12 @Native("A")
13 class A { 13 class A {
14 foo(x) => '$x,${this.oof()}'; 14 foo(x) => '$x,${this.oof()}';
15 oof() => 'A'; 15 oof() => 'A';
16 } 16 }
17 17
18 class B extends A { 18 class B extends A {
19 oof() => 'B'; 19 oof() => 'B';
20 } 20 }
21 21
22 B makeB1() native; 22 B makeB1() native ;
23 B makeB2() native; 23 B makeB2() native ;
24 B makeC() native; 24 B makeC() native ;
25 25
26 @Creates('=Object') 26 @Creates('=Object')
27 getBPrototype() native; 27 getBPrototype() native ;
28 28
29 @Creates('=Object') 29 @Creates('=Object')
30 getCPrototype() native; 30 getCPrototype() native ;
31 31
32 void setup() native r""" 32 void setup() native r"""
33 function A() {} 33 function A() {}
34 function B() {} 34 function B() {}
35 function C() {} 35 function C() {}
36 makeA = function(){return new A;}; 36 makeA = function(){return new A;};
37 makeB1 = function(){return new B;}; 37 makeB1 = function(){return new B;};
38 makeB2 = function(){return new B;}; 38 makeB2 = function(){return new B;};
39 makeC = function(){return new C;}; 39 makeC = function(){return new C;};
40 40
41 getBPrototype = function(){return B.prototype;}; 41 getBPrototype = function(){return B.prototype;};
42 getCPrototype = function(){return C.prototype;}; 42 getCPrototype = function(){return C.prototype;};
43 """; 43 """;
44 44
45 main() { 45 main() {
46 setup(); 46 setup();
47 47
48 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); 48 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B));
49 setNativeSubclassDispatchRecord(getCPrototype(), findInterceptorForType(B)); 49 setNativeSubclassDispatchRecord(getCPrototype(), findInterceptorForType(B));
50 50
51 B b1 = makeB1(); 51 B b1 = makeB1();
52 Expect.equals('1,B', b1.foo(1)); 52 Expect.equals('1,B', b1.foo(1));
53 53
54 B b2 = makeB2(); 54 B b2 = makeB2();
55 Expect.equals('2,B', b2.foo(2)); 55 Expect.equals('2,B', b2.foo(2));
56 56
57 B b3 = makeC(); 57 B b3 = makeC();
58 Expect.equals('3,B', b3.foo(3)); 58 Expect.equals('3,B', b3.foo(3));
59 } 59 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_native/static_methods_test.dart ('k') | tests/compiler/dart2js_native/subclassing_2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698