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

Side by Side Diff: dart/tests/compiler/dart2js_foreign/native_missing_method2_test.dart

Issue 23477028: Remove dart2js_foreign. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6 import 'native_metadata.dart';
7
8 @Native("*A")
9 class A {
10 }
11
12 @native makeA();
13
14 @Native("""
15 function A() {};
16 A.prototype.foo = function() { return 42; }
17 makeA = function() { return new A; }
18 """)
19 void setup();
20
21 class B {
22 foo() { return 42; }
23 }
24
25 class C {
26 // By having two 'foo' defined in the application, Frog will mangle
27 // all calls to 'foo', which makes this test pass.
28 foo(x) { return 43; }
29 }
30
31 typedContext() {
32 var things = [ makeA(), new B() ];
33 A a = things[0];
34 Expect.throws(() => a.foo(),
35 (e) => e is NoSuchMethodError);
36 Expect.throws(() => a.foo,
37 (e) => e is NoSuchMethodError);
38 Expect.throws(() => a.foo = 4,
39 (e) => e is NoSuchMethodError);
40 }
41
42 untypedContext() {
43 var things = [ makeA(), new B() ];
44 var a = things[0];
45 Expect.throws(() => a.foo(),
46 (e) => e is NoSuchMethodError);
47 Expect.throws(() => a.foo,
48 (e) => e is NoSuchMethodError);
49 Expect.throws(() => a.foo = 4,
50 (e) => e is NoSuchMethodError);
51 }
52
53 main() {
54 setup();
55 typedContext();
56 untypedContext();
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698