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

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

Issue 2383273002: Revert "Add native_testing library to mock @Native classes" (Closed)
Patch Set: Created 4 years, 2 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "native_testing.dart"; 5 import "dart:_js_helper";
6 import "package:expect/expect.dart";
6 7
7 // This is a similar test to NativeCallArity1FrogTest, but makes sure 8 // This is a similar test to NativeCallArity1FrogTest, but makes sure
8 // that subclasses also get the right number of arguments. 9 // that subclasses also get the right number of arguments.
9 10
10 @Native("A") 11 @Native("A")
11 class A { 12 class A {
12 int foo([x, y]) native ; 13 int foo([x, y]) native ;
13 } 14 }
14 15
15 @Native("B") 16 @Native("B")
(...skipping 17 matching lines...) Expand all
33 } 34 }
34 function A() {} 35 function A() {}
35 A.prototype.foo = function () { return arguments.length; }; 36 A.prototype.foo = function () { return arguments.length; };
36 37
37 function B() {} 38 function B() {}
38 B.prototype.foo = function () { return arguments.length; }; 39 B.prototype.foo = function () { return arguments.length; };
39 inherits(B, A); 40 inherits(B, A);
40 41
41 makeA = function(){return new A;}; 42 makeA = function(){return new A;};
42 makeB = function(){return new B;}; 43 makeB = function(){return new B;};
43
44 self.nativeConstructor(A);
45 self.nativeConstructor(B);
46 """; 44 """;
47 45
48 testDynamicContext() { 46 testDynamicContext() {
49 var a = confuse(makeA()); 47 var things = [makeA(), makeB()];
50 var b = confuse(makeB()); 48 var a = things[0];
49 var b = things[1];
51 50
52 Expect.equals(0, a.foo()); 51 Expect.equals(0, a.foo());
53 Expect.equals(1, a.foo(10)); 52 Expect.equals(1, a.foo(10));
54 Expect.equals(2, a.foo(10, 20)); 53 Expect.equals(2, a.foo(10, 20));
55 Expect.throws(() => a.foo(10, 20, 30)); 54 Expect.throws(() => a.foo(10, 20, 30));
56 55
57 Expect.equals(1, a.foo(10)); 56 Expect.equals(1, a.foo(10));
58 Expect.equals(2, a.foo(null, 20)); 57 Expect.equals(2, a.foo(null, 20));
59 Expect.throws(() => a.foo(10, 20, 30)); 58 Expect.throws(() => a.foo(10, 20, 30));
60 59
(...skipping 24 matching lines...) Expand all
85 Expect.equals(1, b.foo(10)); 84 Expect.equals(1, b.foo(10));
86 Expect.equals(2, b.foo(10, 20)); 85 Expect.equals(2, b.foo(10, 20));
87 Expect.throws(() => b.foo(10, 20, 30)); 86 Expect.throws(() => b.foo(10, 20, 30));
88 87
89 Expect.equals(1, b.foo(10)); 88 Expect.equals(1, b.foo(10));
90 Expect.equals(2, b.foo(null, 20)); 89 Expect.equals(2, b.foo(null, 20));
91 Expect.throws(() => b.foo(10, 20, 30)); 90 Expect.throws(() => b.foo(10, 20, 30));
92 } 91 }
93 92
94 main() { 93 main() {
95 nativeTesting();
96 setup(); 94 setup();
97 testDynamicContext(); 95 testDynamicContext();
98 testStaticContext(); 96 testStaticContext();
99 } 97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698