| 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 | 10 // TODO(johnniwinther): This value is some what arbitrary. With the old |
| 11 // [ResolvedVisitor] we could handle 2000, with the new [ResolvedVisitor] build | 11 // [ResolvedVisitor] we could handle 2000, with the new [ResolvedVisitor] build |
| 12 // upon the [SemanticVisitor] we can handle <=1000. Update (increase) the value | 12 // upon the [SemanticVisitor] we can handle <=1000. Update (increase) the value |
| 13 // when the [SssBuilder] is no longer build upon the [ResolvedVisitor] . | 13 // when the [SssBuilder] is no longer build upon the [ResolvedVisitor] . |
| 14 const int NUMBER_OF_PARAMETERS = 1000; | 14 const int NUMBER_OF_PARAMETERS = 1000; |
| 15 | 15 |
| 16 main() { | 16 main() { |
| 17 var buffer = new StringBuffer(); | 17 var buffer = new StringBuffer(); |
| 18 buffer.write("foo("); | 18 buffer.write("foo("); |
| 19 for (int i = 0; i < NUMBER_OF_PARAMETERS; i++) { | 19 for (int i = 0; i < NUMBER_OF_PARAMETERS; i++) { |
| 20 buffer.write("x$i, "); | 20 buffer.write("x$i, "); |
| 21 } | 21 } |
| 22 buffer.write("x) { int i = "); | 22 buffer.write("x) { int i = "); |
| 23 for (int i = 0; i < NUMBER_OF_PARAMETERS; i++) { | 23 for (int i = 0; i < NUMBER_OF_PARAMETERS; i++) { |
| 24 buffer.write("x$i+"); | 24 buffer.write("x$i+"); |
| 25 } | 25 } |
| 26 buffer.write("$NUMBER_OF_PARAMETERS; return i; }"); | 26 buffer.write("$NUMBER_OF_PARAMETERS; return i; }"); |
| 27 String code = buffer.toString(); | 27 String code = buffer.toString(); |
| 28 | 28 |
| 29 asyncTest(() => compile(code, entry: 'foo', minify: true) | 29 asyncTest( |
| 30 .then((String generated) { | 30 () => compile(code, entry: 'foo', minify: true).then((String generated) { |
| 31 RegExp re = new RegExp(r"\(a,b,c"); | 31 RegExp re = new RegExp(r"\(a,b,c"); |
| 32 Expect.isTrue(re.hasMatch(generated)); | 32 Expect.isTrue(re.hasMatch(generated)); |
| 33 | 33 |
| 34 re = new RegExp(r"x,y,z,a0,a1,a2"); | 34 re = new RegExp(r"x,y,z,a0,a1,a2"); |
| 35 Expect.isTrue(re.hasMatch(generated)); | 35 Expect.isTrue(re.hasMatch(generated)); |
| 36 | 36 |
| 37 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"); |
| 38 Expect.isTrue(re.hasMatch(generated)); | 38 Expect.isTrue(re.hasMatch(generated)); |
| 39 | 39 |
| 40 re = new RegExp(r"g8,g9,h0,h1"); | 40 re = new RegExp(r"g8,g9,h0,h1"); |
| 41 Expect.isTrue(re.hasMatch(generated)); | 41 Expect.isTrue(re.hasMatch(generated)); |
| 42 | 42 |
| 43 re = new RegExp(r"z8,z9,aa0,aa1,aa2"); | 43 re = new RegExp(r"z8,z9,aa0,aa1,aa2"); |
| 44 Expect.isTrue(re.hasMatch(generated)); | 44 Expect.isTrue(re.hasMatch(generated)); |
| 45 | 45 |
| 46 re = new RegExp(r"aa9,ab0,ab1"); | 46 re = new RegExp(r"aa9,ab0,ab1"); |
| 47 Expect.isTrue(re.hasMatch(generated)); | 47 Expect.isTrue(re.hasMatch(generated)); |
| 48 | 48 |
| 49 re = new RegExp(r"az9,ba0,ba1"); | 49 re = new RegExp(r"az9,ba0,ba1"); |
| 50 Expect.isTrue(re.hasMatch(generated)); | 50 Expect.isTrue(re.hasMatch(generated)); |
| 51 })); | 51 })); |
| 52 } | 52 } |
| OLD | NEW |