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

Side by Side Diff: Source/core/css/parser/CSSTokenizerTest.cpp

Issue 649493003: CSS Tokenizer: Consume a single whitespace after escapes if present (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getfraction
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/core/css/parser/CSSTokenizer.cpp ('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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/css/parser/CSSTokenizer.h" 6 #include "core/css/parser/CSSTokenizer.h"
7 7
8 #include "core/css/parser/MediaQueryBlockWatcher.h" 8 #include "core/css/parser/MediaQueryBlockWatcher.h"
9 #include "wtf/PassOwnPtr.h" 9 #include "wtf/PassOwnPtr.h"
10 #include <gtest/gtest.h> 10 #include <gtest/gtest.h>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 { "(max-aspect-ratio: +-5)", "(max-aspect-ratio: '+'-5)" }, 55 { "(max-aspect-ratio: +-5)", "(max-aspect-ratio: '+'-5)" },
56 { "(max-aspect-ratio: +bla5)", "(max-aspect-ratio: '+'bla5)" }, 56 { "(max-aspect-ratio: +bla5)", "(max-aspect-ratio: '+'bla5)" },
57 { "(max-aspect-ratio: +5bla)", "(max-aspect-ratio: 5other)" }, 57 { "(max-aspect-ratio: +5bla)", "(max-aspect-ratio: 5other)" },
58 { "(max-aspect-ratio: -bla)", "(max-aspect-ratio: -bla)" }, 58 { "(max-aspect-ratio: -bla)", "(max-aspect-ratio: -bla)" },
59 { "(max-aspect-ratio: --bla)", "(max-aspect-ratio: '-'-bla)" }, 59 { "(max-aspect-ratio: --bla)", "(max-aspect-ratio: '-'-bla)" },
60 { "5e0", "5.000000" }, 60 { "5e0", "5.000000" },
61 { "5.0", "5.000000" }, 61 { "5.0", "5.000000" },
62 { "5.", "5'.'" }, 62 { "5.", "5'.'" },
63 { "5.0e-1", "0.500000" }, 63 { "5.0e-1", "0.500000" },
64 { "5.e-1", "5'.'e-1" }, 64 { "5.e-1", "5'.'e-1" },
65 { "hel\\6co", "hello" },
66 { "wor\\6c d", "world" },
67 { "wor\\6c\r\nd", "world" },
68 { "wor\\6c\n\rd", "worl d" },
Yoav Weiss 2014/10/20 07:42:07 Can you add tests for '\f' and '\t' as well?
Timothy Loh 2014/10/20 13:05:15 Done.
65 { 0, 0 } // Do not remove the terminator line. 69 { 0, 0 } // Do not remove the terminator line.
66 }; 70 };
67 71
68 for (int i = 0; testCases[i].input; ++i) { 72 for (int i = 0; testCases[i].input; ++i) {
69 Vector<CSSParserToken> tokens; 73 Vector<CSSParserToken> tokens;
70 CSSTokenizer::tokenize(testCases[i].input, tokens); 74 CSSTokenizer::tokenize(testCases[i].input, tokens);
71 StringBuilder output; 75 StringBuilder output;
72 for (size_t j = 0; j < tokens.size(); ++j) 76 for (size_t j = 0; j < tokens.size(); ++j)
73 output.append(tokens[j].textForUnitTests()); 77 output.append(tokens[j].textForUnitTests());
74 ASSERT_STREQ(testCases[i].output, output.toString().ascii().data()); 78 ASSERT_STREQ(testCases[i].output, output.toString().ascii().data());
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 testToken(c, EOFToken); 173 testToken(c, EOFToken);
170 else if (c > SCHAR_MAX) 174 else if (c > SCHAR_MAX)
171 testToken(c, IdentToken); 175 testToken(c, IdentToken);
172 else 176 else
173 testToken(c, DelimiterToken); 177 testToken(c, DelimiterToken);
174 } 178 }
175 testToken(USHRT_MAX, IdentToken); 179 testToken(USHRT_MAX, IdentToken);
176 } 180 }
177 181
178 } // namespace 182 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSTokenizer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698