OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 EXPECT_EQ(expected, String(builder.characters16(), builder.length())); | 50 EXPECT_EQ(expected, String(builder.characters16(), builder.length())); |
51 } | 51 } |
52 | 52 |
53 void expectEmpty(const StringBuilder& builder) | 53 void expectEmpty(const StringBuilder& builder) |
54 { | 54 { |
55 EXPECT_EQ(0U, builder.length()); | 55 EXPECT_EQ(0U, builder.length()); |
56 EXPECT_TRUE(builder.isEmpty()); | 56 EXPECT_TRUE(builder.isEmpty()); |
57 EXPECT_EQ(0, builder.characters8()); | 57 EXPECT_EQ(0, builder.characters8()); |
58 } | 58 } |
59 | 59 |
60 } | 60 } // namespace |
61 | 61 |
62 TEST(StringBuilderTest, DefaultConstructor) | 62 TEST(StringBuilderTest, DefaultConstructor) |
63 { | 63 { |
64 StringBuilder builder; | 64 StringBuilder builder; |
65 expectEmpty(builder); | 65 expectEmpty(builder); |
66 } | 66 } |
67 | 67 |
68 TEST(StringBuilderTest, Append) | 68 TEST(StringBuilderTest, Append) |
69 { | 69 { |
70 StringBuilder builder; | 70 StringBuilder builder; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 StringBuilder reference; | 317 StringBuilder reference; |
318 reference.append(replacementCharacter); // Make it UTF-16. | 318 reference.append(replacementCharacter); // Make it UTF-16. |
319 reference.append(String::number(someNumber)); | 319 reference.append(String::number(someNumber)); |
320 StringBuilder test; | 320 StringBuilder test; |
321 test.append(replacementCharacter); | 321 test.append(replacementCharacter); |
322 test.appendNumber(someNumber); | 322 test.appendNumber(someNumber); |
323 EXPECT_EQ(reference, test); | 323 EXPECT_EQ(reference, test); |
324 } | 324 } |
325 | 325 |
326 } // namespace WTF | 326 } // namespace WTF |
OLD | NEW |