| 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 | 4 |
| 5 // TODO(ngeoffray): test String methods with null arguments. | 5 // TODO(ngeoffray): test String methods with null arguments. |
| 6 class StringTest { | 6 class StringTest { |
| 7 | 7 |
| 8 static testMain() { | 8 static testMain() { |
| 9 testOutOfRange(); | 9 testOutOfRange(); |
| 10 testIllegalArgument(); | 10 testIllegalArgument(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 static testCodeUnitAt() { | 58 static testCodeUnitAt() { |
| 59 String str = "string"; | 59 String str = "string"; |
| 60 for (int i = 0; i < str.length; i++) { | 60 for (int i = 0; i < str.length; i++) { |
| 61 Expect.equals(true, str.codeUnitAt(i) is int); | 61 Expect.equals(true, str.codeUnitAt(i) is int); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 static testConcat() { | 65 static testConcat() { |
| 66 var a = "One"; | 66 var a = "One"; |
| 67 var b = "Four"; | 67 var b = "Four"; |
| 68 var c = a.concat(b); | 68 var c = a + b; |
| 69 Expect.equals(7, c.length); | 69 Expect.equals(7, c.length); |
| 70 Expect.equals("OneFour", c); | 70 Expect.equals("OneFour", c); |
| 71 } | 71 } |
| 72 | 72 |
| 73 static testEquals() { | 73 static testEquals() { |
| 74 Expect.equals("str", "str"); | 74 Expect.equals("str", "str"); |
| 75 | 75 |
| 76 Expect.equals("str", "s".concat("t").concat("r")); | 76 Expect.equals("str", "s" + "t" + "r"); |
| 77 Expect.equals("s".concat("t").concat("r"), "str"); | 77 Expect.equals("s" + "t" + "r", "str"); |
| 78 | 78 |
| 79 Expect.equals(false, "str" == "s"); | 79 Expect.equals(false, "str" == "s"); |
| 80 Expect.equals(false, "str" == "r"); | 80 Expect.equals(false, "str" == "r"); |
| 81 Expect.equals(false, "str" == "st"); | 81 Expect.equals(false, "str" == "st"); |
| 82 Expect.equals(false, "str" == "tr"); | 82 Expect.equals(false, "str" == "tr"); |
| 83 | 83 |
| 84 Expect.equals(false, "s" == "str"); | 84 Expect.equals(false, "s" == "str"); |
| 85 Expect.equals(false, "r" == "str"); | 85 Expect.equals(false, "r" == "str"); |
| 86 Expect.equals(false, "st" == "str"); | 86 Expect.equals(false, "st" == "str"); |
| 87 Expect.equals(false, "tr" == "str"); | 87 Expect.equals(false, "tr" == "str"); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 280 } |
| 281 test("abc"); | 281 test("abc"); |
| 282 test(""); | 282 test(""); |
| 283 test(" "); | 283 test(" "); |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 | 286 |
| 287 main() { | 287 main() { |
| 288 StringTest.testMain(); | 288 StringTest.testMain(); |
| 289 } | 289 } |
| OLD | NEW |