Chromium Code Reviews| Index: tests/compiler/dart2js/drop_trailing_null_arguments_test.dart |
| diff --git a/tests/compiler/dart2js/drop_trailing_null_arguments_test.dart b/tests/compiler/dart2js/drop_trailing_null_arguments_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..10860c6c595c2f8803f78c7b78686edafe898777 |
| --- /dev/null |
| +++ b/tests/compiler/dart2js/drop_trailing_null_arguments_test.dart |
| @@ -0,0 +1,33 @@ |
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| +// Test that parameters keep their names in the output. |
| + |
| +import 'package:async_helper/async_helper.dart'; |
| +import 'package:expect/expect.dart'; |
| +import 'compiler_helper.dart'; |
| + |
| +main() { |
| + // If a function call has trailing 'null' arguments, we can safely skip |
| + // them as JavaScript will fill missing arguments with 'undefined'. |
| + asyncTest(() => compile(r""" |
| + class It<A, B> { |
| + It([a, b, c]) : super; |
| + } |
| + |
| + foo(a,b,c) => a; |
| + test() { |
| + foo(1, null, null); |
| + foo(2, 3, null); |
| + new It(); |
| + new It(null, 1); |
| + } |
| + """, |
| + entry: 'test', minify: false).then((String generated) { |
| + print(generated); |
|
sra1
2014/10/24 23:32:00
Remove debug print
herhut
2014/11/06 13:14:43
Done.
|
| + Expect.isTrue(generated.contains(r"foo(1)")); |
| + Expect.isTrue(generated.contains(r"foo(2, 3)")); |
| + Expect.isTrue(generated.contains(r"It$()")); |
| + Expect.isTrue(generated.contains(r"It$(null, 1)")); |
| + })); |
| +} |