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

Side by Side Diff: tests/compiler/dart2js_native/native_no_such_method_exception5_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]) => "foo"; 9 foo(x, [y]) => "foo";
10 baz(x, y, z) => "baz"; 10 baz(x, y, z) => "baz";
(...skipping 12 matching lines...) Expand all
23 baz() => 42; 23 baz() => 42;
24 } 24 }
25 25
26 class C { 26 class C {
27 static create() => new C(); 27 static create() => new C();
28 noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}"; 28 noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}";
29 } 29 }
30 30
31 makeA() native; 31 makeA() native;
32 32
33 setup() native """ 33 setup() {
34 JS('', r"""
35 (function(){
34 function A() {} 36 function A() {}
35 makeA = function() { return new A; } 37 makeA = function() { return new A(); };
36 self.nativeConstructor(A); 38 self.nativeConstructor(A);
37 """; 39 })()""");
40 }
38 41
39 main() { 42 main() {
40 nativeTesting(); 43 nativeTesting();
41 setup(); 44 setup();
42 var a = makeA(); 45 var a = makeA();
43 a.bar(); 46 a.bar();
44 Expect.equals("native(foo:[1, 2])", a.foo(1, 2)); 47 Expect.equals("native(foo:[1, 2])", a.foo(1, 2));
45 Expect.equals("native(baz:[3, 4, 5])", a.baz(3, 4, 5)); 48 Expect.equals("native(baz:[3, 4, 5])", a.baz(3, 4, 5));
46 var c = C.create(); 49 var c = C.create();
47 Expect.equals("foo:[6]", c.foo(6)); 50 Expect.equals("foo:[6]", c.foo(6));
48 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698