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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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 "dart:_js_helper"; 5 import "dart:_js_helper";
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 @Native("A") 8 @Native("A")
9 class A { 9 class A {}
10 }
11 10
12 makeA() native; 11 makeA() native ;
13 12
14 void setup() native """ 13 void setup() native """
15 function A() {}; 14 function A() {};
16 A.prototype.foo = function() { return 42; } 15 A.prototype.foo = function() { return 42; }
17 makeA = function() { return new A; } 16 makeA = function() { return new A; }
18 """; 17 """;
19 18
20 class B { 19 class B {
21 // We need to define a foo method so that Frog sees it. Because it's 20 // We need to define a foo method so that Frog sees it. Because it's
22 // the only occurence of 'foo', Frog does not bother mangling the 21 // the only occurence of 'foo', Frog does not bother mangling the
23 // call sites. It thinks all calls will either go to this method, or 22 // call sites. It thinks all calls will either go to this method, or
24 // throw a NoSuchMethodError. 23 // throw a NoSuchMethodError.
25 foo() { return 42; } 24 foo() {
25 return 42;
26 }
26 } 27 }
27 28
28 typedContext() { 29 typedContext() {
29 var things = [ makeA(), new B() ]; 30 var things = [makeA(), new B()];
30 A a = things[0]; 31 A a = things[0];
31 Expect.throws(() => a.foo(), 32 Expect.throws(() => a.foo(), (e) => e is NoSuchMethodError);
32 (e) => e is NoSuchMethodError); 33 Expect.throws(() => a.foo, (e) => e is NoSuchMethodError);
33 Expect.throws(() => a.foo, 34 Expect.throws(() => a.foo = 4, (e) => e is NoSuchMethodError);
34 (e) => e is NoSuchMethodError);
35 Expect.throws(() => a.foo = 4,
36 (e) => e is NoSuchMethodError);
37 } 35 }
38 36
39 untypedContext() { 37 untypedContext() {
40 var things = [ makeA(), new B() ]; 38 var things = [makeA(), new B()];
41 var a = things[0]; 39 var a = things[0];
42 Expect.throws(() => a.foo(), 40 Expect.throws(() => a.foo(), (e) => e is NoSuchMethodError);
43 (e) => e is NoSuchMethodError); 41 Expect.throws(() => a.foo, (e) => e is NoSuchMethodError);
44 Expect.throws(() => a.foo, 42 Expect.throws(() => a.foo = 4, (e) => e is NoSuchMethodError);
45 (e) => e is NoSuchMethodError);
46 Expect.throws(() => a.foo = 4,
47 (e) => e is NoSuchMethodError);
48 } 43 }
49 44
50 main() { 45 main() {
51 setup(); 46 setup();
52 typedContext(); 47 typedContext();
53 untypedContext(); 48 untypedContext();
54 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698