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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 EXPECT_EQ(emptyAtom, atomicString); | 281 EXPECT_EQ(emptyAtom, atomicString); |
282 } | 282 } |
283 { // AtomicString constructed from an empty char* string. | 283 { // AtomicString constructed from an empty char* string. |
284 StringBuilder builder; | 284 StringBuilder builder; |
285 builder.append("", 0); | 285 builder.append("", 0); |
286 AtomicString atomicString = builder.toAtomicString(); | 286 AtomicString atomicString = builder.toAtomicString(); |
287 EXPECT_EQ(emptyAtom, atomicString); | 287 EXPECT_EQ(emptyAtom, atomicString); |
288 } | 288 } |
289 { // Cleared StringBuilder. | 289 { // Cleared StringBuilder. |
290 StringBuilder builder; | 290 StringBuilder builder; |
291 builder.append("WebKit"); | 291 builder.appendLiteral("WebKit"); |
292 builder.clear(); | 292 builder.clear(); |
293 AtomicString atomicString = builder.toAtomicString(); | 293 AtomicString atomicString = builder.toAtomicString(); |
294 EXPECT_EQ(emptyAtom, atomicString); | 294 EXPECT_EQ(emptyAtom, atomicString); |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 TEST(StringBuilderTest, Substring) | 298 TEST(StringBuilderTest, Substring) |
299 { | 299 { |
300 { // Default constructed. | 300 { // Default constructed. |
301 StringBuilder builder; | 301 StringBuilder builder; |
(...skipping 15 matching lines...) Expand all 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 |