Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // Test that parameters keep their names in the output. | 4 // Test that parameters keep their names in the output. |
| 5 | 5 |
| 6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
| 9 | 9 |
| 10 // TODO(johnniwinther): This value is some what arbitrary. With the old | |
| 11 // [ResolvedVisitor] we could handle 2000, with the new [ResolvedVisitor] build | |
| 12 // upon the [SemanticVisitor] we can handle <1300. Update (increase) the value | |
| 13 // when the [SssBuilder] is no longer build upon the [ResolvedVisitor] . | |
| 14 const int NUMBER_OF_PARAMETERS = 1250; | |
|
Siggi Cherem (dart-lang)
2015/04/13 17:44:34
FYI - this test is failing for me locally with a s
Siggi Cherem (dart-lang)
2015/04/13 17:46:47
I went ahead and filed https://code.google.com/p/d
| |
| 15 | |
| 10 main() { | 16 main() { |
| 11 var buffer = new StringBuffer(); | 17 var buffer = new StringBuffer(); |
| 12 buffer.write("foo("); | 18 buffer.write("foo("); |
| 13 for (int i = 0; i < 2000; i++) { | 19 for (int i = 0; i < NUMBER_OF_PARAMETERS; i++) { |
| 14 buffer.write("x$i, "); | 20 buffer.write("x$i, "); |
| 15 } | 21 } |
| 16 buffer.write("x) { int i = "); | 22 buffer.write("x) { int i = "); |
| 17 for (int i = 0; i < 2000; i++) { | 23 for (int i = 0; i < NUMBER_OF_PARAMETERS; i++) { |
| 18 buffer.write("x$i+"); | 24 buffer.write("x$i+"); |
| 19 } | 25 } |
| 20 buffer.write("2000; return i; }"); | 26 buffer.write("$NUMBER_OF_PARAMETERS; return i; }"); |
| 21 String code = buffer.toString(); | 27 String code = buffer.toString(); |
| 22 | 28 |
| 23 asyncTest(() => compile(code, entry: 'foo', minify: true) | 29 asyncTest(() => compile(code, entry: 'foo', minify: true) |
| 24 .then((String generated) { | 30 .then((String generated) { |
| 25 RegExp re = new RegExp(r"\(a,b,c"); | 31 RegExp re = new RegExp(r"\(a,b,c"); |
| 26 Expect.isTrue(re.hasMatch(generated)); | 32 Expect.isTrue(re.hasMatch(generated)); |
| 27 | 33 |
| 28 re = new RegExp(r"x,y,z,a0,a1,a2"); | 34 re = new RegExp(r"x,y,z,a0,a1,a2"); |
| 29 Expect.isTrue(re.hasMatch(generated)); | 35 Expect.isTrue(re.hasMatch(generated)); |
| 30 | 36 |
| 31 re = new RegExp(r"y,z,a0,a1,a2,a3,a4,a5,a6"); | 37 re = new RegExp(r"y,z,a0,a1,a2,a3,a4,a5,a6"); |
| 32 Expect.isTrue(re.hasMatch(generated)); | 38 Expect.isTrue(re.hasMatch(generated)); |
| 33 | 39 |
| 34 re = new RegExp(r"g8,g9,h0,h1"); | 40 re = new RegExp(r"g8,g9,h0,h1"); |
| 35 Expect.isTrue(re.hasMatch(generated)); | 41 Expect.isTrue(re.hasMatch(generated)); |
| 36 | 42 |
| 37 re = new RegExp(r"z8,z9,aa0,aa1,aa2"); | 43 re = new RegExp(r"z8,z9,aa0,aa1,aa2"); |
| 38 Expect.isTrue(re.hasMatch(generated)); | 44 Expect.isTrue(re.hasMatch(generated)); |
| 39 | 45 |
| 40 re = new RegExp(r"aa9,ab0,ab1"); | 46 re = new RegExp(r"aa9,ab0,ab1"); |
| 41 Expect.isTrue(re.hasMatch(generated)); | 47 Expect.isTrue(re.hasMatch(generated)); |
| 42 | 48 |
| 43 re = new RegExp(r"az9,ba0,ba1"); | 49 re = new RegExp(r"az9,ba0,ba1"); |
| 44 Expect.isTrue(re.hasMatch(generated)); | 50 Expect.isTrue(re.hasMatch(generated)); |
| 45 })); | 51 })); |
| 46 } | 52 } |
| OLD | NEW |