OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 "native_testing.dart"; |
6 | 6 |
7 @Native("NNative") | 7 @Native("NNative") |
8 class NNative { | 8 class NNative { |
9 var status; | 9 var status; |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 g(val) => "### $val ###"; | 25 g(val) => "### $val ###"; |
26 } | 26 } |
27 | 27 |
28 wrap(cb) { | 28 wrap(cb) { |
29 return (val) { | 29 return (val) { |
30 return cb("!!! $val !!!"); | 30 return cb("!!! $val !!!"); |
31 }; | 31 }; |
32 } | 32 } |
33 | 33 |
34 nativeId(x) native ; | 34 nativeId(x) native; |
35 | 35 |
36 void setup() native """ | 36 void setup() native """ |
37 nativeId = function(x) { return x; } | 37 nativeId = function(x) { return x; } |
38 """; | 38 """; |
39 | 39 |
40 | |
41 main() { | 40 main() { |
42 setup(); | 41 setup(); |
43 // Make sure the ClickCounter class goes through interceptors. | 42 // Make sure the ClickCounter class goes through interceptors. |
44 Expect.equals("### !!! 42 !!! ###", nativeId(new ClickCounter()).f(42)); | 43 Expect.equals("### !!! 42 !!! ###", nativeId(new ClickCounter()).f(42)); |
45 // We are interested in the direct call, where the type is known. | 44 // We are interested in the direct call, where the type is known. |
46 Expect.equals("### !!! 499 !!! ###", new ClickCounter().f(499)); | 45 Expect.equals("### !!! 499 !!! ###", new ClickCounter().f(499)); |
47 } | 46 } |
OLD | NEW |