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

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: update tests 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 wor\\6c\n\rd", "world worl d" },
68 { "cod\\65point esca\\70\fe \\74\test", "codepoint escape test" },
69 { "esca\\70\f\te \\74 \nest", "escap e t est" },
65 { 0, 0 } // Do not remove the terminator line. 70 { 0, 0 } // Do not remove the terminator line.
66 }; 71 };
67 72
68 for (int i = 0; testCases[i].input; ++i) { 73 for (int i = 0; testCases[i].input; ++i) {
69 Vector<CSSParserToken> tokens; 74 Vector<CSSParserToken> tokens;
70 CSSTokenizer::tokenize(testCases[i].input, tokens); 75 CSSTokenizer::tokenize(testCases[i].input, tokens);
71 StringBuilder output; 76 StringBuilder output;
72 for (size_t j = 0; j < tokens.size(); ++j) 77 for (size_t j = 0; j < tokens.size(); ++j)
73 output.append(tokens[j].textForUnitTests()); 78 output.append(tokens[j].textForUnitTests());
74 ASSERT_STREQ(testCases[i].output, output.toString().ascii().data()); 79 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); 174 testToken(c, EOFToken);
170 else if (c > SCHAR_MAX) 175 else if (c > SCHAR_MAX)
171 testToken(c, IdentToken); 176 testToken(c, IdentToken);
172 else 177 else
173 testToken(c, DelimiterToken); 178 testToken(c, DelimiterToken);
174 } 179 }
175 testToken(USHRT_MAX, IdentToken); 180 testToken(USHRT_MAX, IdentToken);
176 } 181 }
177 182
178 } // namespace 183 } // 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