Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: Source/platform/text/SegmentedStringTest.cpp

Issue 1308573006: [reland] SegmentedString::push() should always push a char in front (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix test / accept yosin@ suggestion Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/text/SegmentedString.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 29 matching lines...) Expand all
40 SegmentedString original(String("cde")); 40 SegmentedString original(String("cde"));
41 { 41 {
42 SegmentedString copied(original); 42 SegmentedString copied(original);
43 SegmentedString assigned; 43 SegmentedString assigned;
44 assigned = original; 44 assigned = original;
45 EXPECT_EQ("cde", original.toString()); 45 EXPECT_EQ("cde", original.toString());
46 EXPECT_EQ('c', original.currentChar()); 46 EXPECT_EQ('c', original.currentChar());
47 EXPECT_EQ('c', copied.currentChar()); 47 EXPECT_EQ('c', copied.currentChar());
48 EXPECT_EQ('c', assigned.currentChar()); 48 EXPECT_EQ('c', assigned.currentChar());
49 } 49 }
50 original.push('b');
51 {
52 SegmentedString copied(original);
53 SegmentedString assigned;
54 assigned = original;
55 EXPECT_EQ("bcde", original.toString());
56 EXPECT_EQ('b', original.currentChar());
57 EXPECT_EQ('b', copied.currentChar());
58 EXPECT_EQ('b', assigned.currentChar());
59 }
50 original.push('a'); 60 original.push('a');
51 { 61 {
52 SegmentedString copied(original); 62 SegmentedString copied(original);
53 SegmentedString assigned; 63 SegmentedString assigned;
54 assigned = original; 64 assigned = original;
55 EXPECT_EQ("acde", original.toString());
56 EXPECT_EQ('a', original.currentChar());
57 EXPECT_EQ('a', copied.currentChar());
58 EXPECT_EQ('a', assigned.currentChar());
59 }
60 original.push('b');
61 {
62 // Two consecutive push means to push the second char *after* the
63 // first char in SegmentedString.
64 SegmentedString copied(original);
65 SegmentedString assigned;
66 assigned = original;
67 EXPECT_EQ("abcde", original.toString()); 65 EXPECT_EQ("abcde", original.toString());
68 EXPECT_EQ('a', original.currentChar()); 66 EXPECT_EQ('a', original.currentChar());
69 EXPECT_EQ('a', copied.currentChar()); 67 EXPECT_EQ('a', copied.currentChar());
70 EXPECT_EQ('a', assigned.currentChar()); 68 EXPECT_EQ('a', assigned.currentChar());
71 } 69 }
72 original.advance(); 70 original.advance();
73 { 71 {
74 SegmentedString copied(original); 72 SegmentedString copied(original);
75 SegmentedString assigned; 73 SegmentedString assigned;
76 assigned = original; 74 assigned = original;
77 EXPECT_EQ("bcde", original.toString()); 75 EXPECT_EQ("bcde", original.toString());
78 EXPECT_EQ('b', original.currentChar()); 76 EXPECT_EQ('b', original.currentChar());
79 EXPECT_EQ('b', copied.currentChar()); 77 EXPECT_EQ('b', copied.currentChar());
80 EXPECT_EQ('b', assigned.currentChar()); 78 EXPECT_EQ('b', assigned.currentChar());
81 } 79 }
82 } 80 }
83 81
84 } // namespace blink 82 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/text/SegmentedString.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698