| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 'package:expect/expect.dart'; |
| 5 import 'compiler_helper.dart'; | 6 import 'compiler_helper.dart'; |
| 6 | 7 |
| 7 // Tests for | 8 // Tests for |
| 8 const String TEST_1 = r""" | 9 const String TEST_1 = r""" |
| 9 foo() { | 10 foo() { |
| 10 int a = 120; | 11 int a = 120; |
| 11 String b = 'hello'; | 12 String b = 'hello'; |
| 12 return 'u${a}v${b}w'; | 13 return 'u${a}v${b}w'; |
| 13 } | 14 } |
| 14 """; | 15 """; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 check(TEST_2, r'"xxxxxyyyyy"'); | 49 check(TEST_2, r'"xxxxxyyyyy"'); |
| 49 | 50 |
| 50 // 1. No merging of fragments that are multi-use. Prevents exponential code | 51 // 1. No merging of fragments that are multi-use. Prevents exponential code |
| 51 // and keeps author's manual CSE. | 52 // and keeps author's manual CSE. |
| 52 // 2. Know string values require no stringification. | 53 // 2. Know string values require no stringification. |
| 53 check(TEST_3, r'return b + "x" + b'); | 54 check(TEST_3, r'return b + "x" + b'); |
| 54 | 55 |
| 55 // Known int value can be formatted directly. | 56 // Known int value can be formatted directly. |
| 56 check(TEST_4, r'return "" + b.length'); | 57 check(TEST_4, r'return "" + b.length'); |
| 57 } | 58 } |
| OLD | NEW |