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

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

Issue 2984403002: dart2js_native tests: Migrate 'native STRING' to JS-calls (Closed)
Patch Set: the rest of the files Created 3 years, 4 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 "native_testing.dart";
6 6
7 // Test for values of some basic types. 7 // Test for values of some basic types.
8 8
9 @Native("A") 9 @Native("A")
10 class A { 10 class A {
11 returnNull() native; 11 returnNull() native;
12 returnUndefined() native; 12 returnUndefined() native;
13 returnEmptyString() native; 13 returnEmptyString() native;
14 returnZero() native; 14 returnZero() native;
15 } 15 }
16 16
17 A makeA() native; 17 A makeA() native;
18 18
19 void setup() native """ 19 void setup() {
20 function A() {} 20 JS('', r"""
21 A.prototype.returnNull = function() { return null; }; 21 (function(){
22 A.prototype.returnUndefined = function() { return void 0; }; 22 function A() {}
23 A.prototype.returnEmptyString = function() { return ""; }; 23 A.prototype.returnNull = function() { return null; };
24 A.prototype.returnZero = function() { return 0; }; 24 A.prototype.returnUndefined = function() { return void 0; };
25 makeA = function(){return new A;}; 25 A.prototype.returnEmptyString = function() { return ""; };
26 self.nativeConstructor(A); 26 A.prototype.returnZero = function() { return 0; };
27 """; 27 makeA = function(){return new A()};
28 self.nativeConstructor(A);
29 })()""");
30 }
28 31
29 @NoInline() 32 @NoInline()
30 staticTests() { 33 staticTests() {
31 A a = makeA(); 34 A a = makeA();
32 Expect.equals(null, a.returnNull()); 35 Expect.equals(null, a.returnNull());
33 Expect.equals(null, a.returnUndefined()); 36 Expect.equals(null, a.returnUndefined());
34 37
35 Expect.equals('', a.returnEmptyString()); 38 Expect.equals('', a.returnEmptyString());
36 Expect.isTrue(a.returnEmptyString().isEmpty); 39 Expect.isTrue(a.returnEmptyString().isEmpty);
37 Expect.isTrue(a.returnEmptyString() is String); 40 Expect.isTrue(a.returnEmptyString() is String);
(...skipping 15 matching lines...) Expand all
53 Expect.isTrue(confuse(a).returnZero() is int); 56 Expect.isTrue(confuse(a).returnZero() is int);
54 Expect.equals(0, confuse(a).returnZero()); 57 Expect.equals(0, confuse(a).returnZero());
55 } 58 }
56 59
57 main() { 60 main() {
58 nativeTesting(); 61 nativeTesting();
59 setup(); 62 setup();
60 staticTests(); 63 staticTests();
61 dynamicTests(); 64 dynamicTests();
62 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698