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

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

Issue 2984403002: dart2js_native tests: Migrate 'native STRING' to JS-calls (Closed)
Patch Set: the rest of the files Created 3 years, 4 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) 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 import "dart:mirrors" show reflect; 5 import "dart:mirrors" show reflect;
6 import "native_testing.dart"; 6 import "native_testing.dart";
7 7
8 class GetName { 8 class GetName {
9 foo(x, y, [z]) => "foo"; 9 foo(x, y, [z]) => "foo";
10 } 10 }
(...skipping 10 matching lines...) Expand all
21 foo() => 42; 21 foo() => 42;
22 } 22 }
23 23
24 class C { 24 class C {
25 static create() => new C(); 25 static create() => new C();
26 noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}"; 26 noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}";
27 } 27 }
28 28
29 makeA() native; 29 makeA() native;
30 30
31 setup() native """ 31 setup() {
32 JS('', r"""
33 (function(){
32 function A() {} 34 function A() {}
33 makeA = function() { return new A; } 35 makeA = function() { return new A(); };
34 36
35 self.nativeConstructor(A); 37 self.nativeConstructor(A);
36 """; 38 })()""");
39 }
37 40
38 main() { 41 main() {
39 nativeTesting(); 42 nativeTesting();
40 setup(); 43 setup();
41 var a = makeA(); 44 var a = makeA();
42 a.bar(); 45 a.bar();
43 var exception; 46 var exception;
44 try { 47 try {
45 a.foo(); 48 a.foo();
46 } on NoSuchMethodError catch (e) { 49 } on NoSuchMethodError catch (e) {
47 exception = e; 50 exception = e;
48 } 51 }
49 Expect.isNotNull(exception); 52 Expect.isNotNull(exception);
50 var c = C.create(); 53 var c = C.create();
51 Expect.equals("foo:[1, 2]", c.foo(1, 2)); 54 Expect.equals("foo:[1, 2]", c.foo(1, 2));
52 Expect.equals("foo:[3, 4, 5]", c.foo(3, 4, 5)); 55 Expect.equals("foo:[3, 4, 5]", c.foo(3, 4, 5));
53 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698