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

Side by Side Diff: dart/tests/compiler/dart2js_foreign/native_null_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 that parameters in native methods are not mangled. This test is needed 5 // Test that parameters in native methods are not mangled. This test is needed
6 // until we change all libraries to using the JS foreign element. 6 // until we change all libraries to using the JS foreign element.
7 7
8 @native("*A") 8 import 'native_metadata.dart';
9
10 @Native("*A")
9 class A { 11 class A {
10 @native("return null;") 12 @Native("return null;")
11 returnNull(); 13 returnNull();
12 @native("return undefined;") 14 @Native("return undefined;")
13 returnUndefined(); 15 returnUndefined();
14 @native("return '';") 16 @Native("return '';")
15 returnEmptyString(); 17 returnEmptyString();
16 @native("return 0;") 18 @Native("return 0;")
17 returnZero(); 19 returnZero();
18 } 20 }
19 21
20 @native A makeA(); 22 @native A makeA();
21 23
22 @native(""" 24 @Native("""
23 function A() {} 25 function A() {}
24 makeA = function(){return new A;}; 26 makeA = function(){return new A;};
25 """) 27 """)
26 void setup(); 28 void setup();
27 29
28 30
29 main() { 31 main() {
30 setup(); 32 setup();
31 A a = makeA(); 33 A a = makeA();
32 Expect.equals(null, a.returnNull()); 34 Expect.equals(null, a.returnNull());
33 Expect.equals(null, a.returnUndefined()); 35 Expect.equals(null, a.returnUndefined());
34 36
35 Expect.equals('', a.returnEmptyString()); 37 Expect.equals('', a.returnEmptyString());
36 Expect.isTrue(a.returnEmptyString().isEmpty); 38 Expect.isTrue(a.returnEmptyString().isEmpty);
37 Expect.isTrue(a.returnEmptyString() is String); 39 Expect.isTrue(a.returnEmptyString() is String);
38 40
39 Expect.isTrue(a.returnZero() is int); 41 Expect.isTrue(a.returnZero() is int);
40 Expect.equals(0, a.returnZero()); 42 Expect.equals(0, a.returnZero());
41 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698