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

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

Issue 421483002: Remove old frog-style dummy bodies from dart2js native class tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Test that exception unwrapping handle cases like ({foo:null}).foo(). 5 // Test that exception unwrapping handle cases like ({foo:null}).foo().
6 6
7 import "dart:_js_helper"; 7 import "dart:_js_helper";
8 8
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 10
11 typedef void MyFunctionType(); 11 typedef void MyFunctionType();
12 12
13 @Native("A") 13 @Native("A")
14 class A { 14 class A {
15 setClosure(MyFunctionType f) native; 15 setClosure(MyFunctionType f) native;
16 check(MyFunctionType f) native; 16 check(MyFunctionType f) native;
17 invoke() native; 17 invoke() native;
18 } 18 }
19 19
20 makeA() native { return new A(); } 20 makeA() native;
21 21
22 void setup() native """ 22 void setup() native """
23 function A() {} 23 function A() {}
24 A.prototype.setClosure = function(f) { this.f = f; }; 24 A.prototype.setClosure = function(f) { this.f = f; };
25 A.prototype.check = function(f) { return this.f === f; }; 25 A.prototype.check = function(f) { return this.f === f; };
26 A.prototype.invoke = function() { return this.f(); }; 26 A.prototype.invoke = function() { return this.f(); };
27 makeA = function(){return new A;}; 27 makeA = function(){return new A;};
28 """; 28 """;
29 29
30 main() { 30 main() {
31 setup(); 31 setup();
32 A a = makeA(); 32 A a = makeA();
33 a.setClosure(null); 33 a.setClosure(null);
34 Expect.isTrue(a.check(null)); 34 Expect.isTrue(a.check(null));
35 bool caughtException = false; 35 bool caughtException = false;
36 try { 36 try {
37 a.invoke(); 37 a.invoke();
38 } on JsNoSuchMethodError catch (e) { 38 } on JsNoSuchMethodError catch (e) {
39 print(e); 39 print(e);
40 caughtException = true; 40 caughtException = true;
41 } 41 }
42 Expect.isTrue(caughtException); 42 Expect.isTrue(caughtException);
43 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698