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

Side by Side Diff: tests/compiler/dart2js_native/subclassing_super_call_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:_foreign_helper' show JS; 6 import 'dart:_foreign_helper' show JS;
7 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord; 7 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord;
8 import 'dart:_interceptors' show 8 import 'dart:_interceptors'
9 findInterceptorForType, findConstructorForNativeSubclassType; 9 show findInterceptorForType, findConstructorForNativeSubclassType;
10 10
11 // Test for super access from classes that extend native classes. 11 // Test for super access from classes that extend native classes.
12 12
13 @Native("N1") 13 @Native("N1")
14 class N1 { 14 class N1 {}
15 }
16 15
17 @Native("N2") 16 @Native("N2")
18 class N2 extends N1 { 17 class N2 extends N1 {
19 N2.init(); 18 N2.init();
20 String text; 19 String text;
21 foo() native; 20 foo() native ;
22 } 21 }
23 22
24 class AA extends N2 { 23 class AA extends N2 {
25 AA.init() : super.init(); 24 AA.init() : super.init();
26 String afield; 25 String afield;
27 afun() => 'afun:$afield'; 26 afun() => 'afun:$afield';
28 } 27 }
29 28
30 class BB extends AA { 29 class BB extends AA {
31 BB.init() : super.init(); 30 BB.init() : super.init();
32 31
33 get text => super.text; 32 get text => super.text;
34 set text(value) => super.text = value; 33 set text(value) => super.text = value;
35 foo() => super.foo(); 34 foo() => super.foo();
36 35
37 get afield => super.afield; 36 get afield => super.afield;
38 set afield(value) => super.afield = value; 37 set afield(value) => super.afield = value;
39 afun() => super.afun(); 38 afun() => super.afun();
40 } 39 }
41 40
42 BB makeBB() native; 41 BB makeBB() native ;
43 42
44 @Creates('=Object') 43 @Creates('=Object')
45 getBBPrototype() native; 44 getBBPrototype() native ;
46 45
47 void setup() native r""" 46 void setup() native r"""
48 function N2() {} 47 function N2() {}
49 N2.prototype.foo = function() { return "foo:" + this.text; } 48 N2.prototype.foo = function() { return "foo:" + this.text; }
50 function BB() {} 49 function BB() {}
51 BB.prototype.__proto__ = N2.prototype; 50 BB.prototype.__proto__ = N2.prototype;
52 makeBB = function(){return new BB;}; 51 makeBB = function(){return new BB;};
53 52
54 getBBPrototype = function(){return BB.prototype;}; 53 getBBPrototype = function(){return BB.prototype;};
55 """; 54 """;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 106
108 print('b1.afun() ${inscrutable(b1).afun()}'); 107 print('b1.afun() ${inscrutable(b1).afun()}');
109 print('b2.afun() ${inscrutable(b2).afun()}'); 108 print('b2.afun() ${inscrutable(b2).afun()}');
110 109
111 Expect.equals('one', b1.afield); 110 Expect.equals('one', b1.afield);
112 Expect.equals('two', b2.afield); 111 Expect.equals('two', b2.afield);
113 112
114 Expect.equals('afun:one', b1.afun()); 113 Expect.equals('afun:one', b1.afun());
115 Expect.equals('afun:two', b2.afun()); 114 Expect.equals('afun:two', b2.afun());
116 115
117
118 inscrutable(b1).afield = inscrutable('three'); 116 inscrutable(b1).afield = inscrutable('three');
119 inscrutable(b2).afield = inscrutable('four'); 117 inscrutable(b2).afield = inscrutable('four');
120 118
121 Expect.equals('three', inscrutable(b1).afield); 119 Expect.equals('three', inscrutable(b1).afield);
122 Expect.equals('four', inscrutable(b2).afield); 120 Expect.equals('four', inscrutable(b2).afield);
123 121
124 Expect.equals('afun:three', inscrutable(b1).afun()); 122 Expect.equals('afun:three', inscrutable(b1).afun());
125 Expect.equals('afun:four', inscrutable(b2).afun()); 123 Expect.equals('afun:four', inscrutable(b2).afun());
126 } 124 }
127 125
128 main() { 126 main() {
129 setup(); 127 setup();
130 inscrutable = (x) => x; 128 inscrutable = (x) => x;
131 129
132 setNativeSubclassDispatchRecord(getBBPrototype(), findInterceptorForType(BB)); 130 setNativeSubclassDispatchRecord(getBBPrototype(), findInterceptorForType(BB));
133 131
134 testSuperOnNative(); 132 testSuperOnNative();
135 testSuperOnSubclassOfNative(); 133 testSuperOnSubclassOfNative();
136 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698