| 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 "package:expect/expect.dart"; |
| 6 | 6 |
| 7 const WHITESPACE = const [ | 7 const WHITESPACE = const [ |
| 8 0x09, | 8 0x09, |
| 9 0x0A, | 9 0x0A, |
| 10 0x0B, | 10 0x0B, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 0x202F, | 29 0x202F, |
| 30 0x205F, | 30 0x205F, |
| 31 0x3000, | 31 0x3000, |
| 32 0x2028, | 32 0x2028, |
| 33 0x2029, | 33 0x2029, |
| 34 0xFEFF, | 34 0xFEFF, |
| 35 ]; | 35 ]; |
| 36 | 36 |
| 37 main() { | 37 main() { |
| 38 for (var ws in WHITESPACE) { | 38 for (var ws in WHITESPACE) { |
| 39 Expect.equals("", new String.fromCharCode(ws).trim()); | 39 var name = ws.toRadixString(16); |
| 40 var c = new String.fromCharCode(ws); |
| 41 Expect.equals("", c.trim(), "$name"); |
| 42 Expect.equals("a", ("a" + c).trim(), "a-$name"); |
| 43 Expect.equals("a", (c + "a").trim(), "$name-a"); |
| 44 Expect.equals("a", (c + c + "a" + c + c).trim(), "$name around"); |
| 45 Expect.equals("a" + c + "a", (c + c + "a" + c + "a" + c + c).trim(), |
| 46 "$name many"); |
| 40 } | 47 } |
| 41 Expect.equals("", new String.fromCharCodes(WHITESPACE).trim()); | 48 Expect.equals("", new String.fromCharCodes(WHITESPACE).trim(), "ALL"); |
| 42 for (var ws in WHITESPACE) { | |
| 43 var c = new String.fromCharCode(ws); | |
| 44 Expect.equals("a", ("a" + c).trim()); | |
| 45 Expect.equals("a", (c + "a").trim()); | |
| 46 Expect.equals("a", (c + c + "a" + c + c).trim()); | |
| 47 Expect.equals("a" + c + "a", (c + c + "a" + c + "a" + c + c).trim()); | |
| 48 } | |
| 49 } | 49 } |
| OLD | NEW |