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

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

Issue 11293272: Update dart2js_foreign suite as we now validate annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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
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 // Test the feature where the native string declares the native method's name. 5 // Test the feature where the native string declares the native method's name.
6 6
7 @native("*A") 7 import 'native_metadata.dart';
8
9 @Native("*A")
8 class A { 10 class A {
9 @native('fooA') 11 @Native('fooA')
10 int foo(); 12 int foo();
11 } 13 }
12 14
13 @native("*B") 15 @Native("*B")
14 class B extends A { 16 class B extends A {
15 @native('fooB') 17 @Native('fooB')
16 int foo(); 18 int foo();
17 } 19 }
18 20
19 @native makeA(); 21 @native makeA();
20 @native makeB(); 22 @native makeB();
21 23
22 @native(""" 24 @Native("""
23 // This code is all inside 'setup' and so not accesible from the global scope. 25 // This code is all inside 'setup' and so not accesible from the global scope.
24 function inherits(child, parent) { 26 function inherits(child, parent) {
25 if (child.prototype.__proto__) { 27 if (child.prototype.__proto__) {
26 child.prototype.__proto__ = parent.prototype; 28 child.prototype.__proto__ = parent.prototype;
27 } else { 29 } else {
28 function tmp() {}; 30 function tmp() {};
29 tmp.prototype = parent.prototype; 31 tmp.prototype = parent.prototype;
30 child.prototype = new tmp(); 32 child.prototype = new tmp();
31 child.prototype.constructor = child; 33 child.prototype.constructor = child;
32 } 34 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 expectNoSuchMethod(action, note) { 77 expectNoSuchMethod(action, note) {
76 bool caught = false; 78 bool caught = false;
77 try { 79 try {
78 action(); 80 action();
79 } catch (ex) { 81 } catch (ex) {
80 caught = true; 82 caught = true;
81 Expect.isTrue(ex is NoSuchMethodError, note); 83 Expect.isTrue(ex is NoSuchMethodError, note);
82 } 84 }
83 Expect.isTrue(caught, note); 85 Expect.isTrue(caught, note);
84 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698