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

Side by Side Diff: tests/html/js_typed_interop_default_arg_test.dart

Issue 2765893003: Fix warnings_checker.dart handling of multitests (Closed)
Patch Set: Created 3 years, 9 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 @JS() 5 @JS()
6 library js_typed_interop_test; 6 library js_typed_interop_test;
7 7
8 import 'dart:html'; 8 import 'dart:html';
9 9
10 import 'package:expect/expect.dart' show NoInline; 10 import 'package:expect/expect.dart' show NoInline;
11 import 'package:js/js.dart'; 11 import 'package:js/js.dart';
12 import 'package:unittest/unittest.dart'; 12 import 'package:unittest/unittest.dart';
13 import 'package:unittest/html_config.dart'; 13 import 'package:unittest/html_config.dart';
14 14
15 _injectJs() { 15 _injectJs() {
16 document.body.append(new ScriptElement() 16 document.body.append(new ScriptElement()
17 ..type = 'text/javascript' 17 ..type = 'text/javascript'
18 ..innerHtml = r""" 18 ..innerHtml = r"""
19 var Foo = { 19 var Foo = {
20 get42: function(b) { return arguments.length >= 1 ? b : 42; }, 20 get42: function(b) { return arguments.length >= 1 ? b : 42; },
21 get43: function(b) { return arguments.length >= 1 ? b : 43; } 21 get43: function(b) { return arguments.length >= 1 ? b : 43; }
22 }; 22 };
23 """); 23 """);
24 } 24 }
25 25
26 @JS() 26 @JS()
27 class Foo { 27 class Foo {
28 // Note: it's invalid to provide a default value. 28 // Note: it's invalid to provide a default value.
29 external static num get42([num b 29 external static num get42([num b
30 = 3 // /// default_value: compile-time error 30 = 3 // //# default_value: compile-time error
31 ]); 31 ]);
32 external static num get43([num b]); 32 external static num get43([num b]);
33 } 33 }
34 34
35 main() { 35 main() {
36 _injectJs(); 36 _injectJs();
37 useHtmlConfiguration(); 37 useHtmlConfiguration();
38 38
39 test('call directly from dart', () { 39 test('call directly from dart', () {
40 expect(Foo.get42(2), 2); 40 expect(Foo.get42(2), 2);
41 expect(Foo.get42(), 42); 41 expect(Foo.get42(), 42);
42 }); 42 });
43 43
44 test('call tearoff from dart with arg', () { 44 test('call tearoff from dart with arg', () {
45 var f = Foo.get42; 45 var f = Foo.get42;
46 expect(f(2), 2); /// explicit_argument: ok 46 expect(f(2), 2); //# explicit_argument: ok
47 }); 47 });
48 48
49 test('call tearoff from dart with default', () { 49 test('call tearoff from dart with default', () {
50 var f = Foo.get42; 50 var f = Foo.get42;
51 // Note: today both SSA and CPS remove the extra argument on static calls, 51 // Note: today both SSA and CPS remove the extra argument on static calls,
52 // but they fail to do so on tearoffs. 52 // but they fail to do so on tearoffs.
53 expect(f(), 3); /// default_value: continued 53 expect(f(), 3); //# default_value: continued
54 54
55 f = Foo.get43; 55 f = Foo.get43;
56 expect(f(), 43); 56 expect(f(), 43);
57 }); 57 });
58 } 58 }
OLDNEW
« no previous file with comments | « tests/corelib_strong/throw_half_surrogate_pair_test.dart ('k') | tests/html/js_typed_interop_type1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698