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

Side by Side Diff: chrome/browser/history/query_parser_unittest.cc

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/history/query_parser.h" 5 #include "chrome/browser/history/query_parser.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "chrome/common/scoped_vector.h" 7 #include "chrome/common/scoped_vector.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 class QueryParserTest : public testing::Test { 10 class QueryParserTest : public testing::Test {
(...skipping 28 matching lines...) Expand all
39 // KA JANG 39 // KA JANG
40 EXPECT_EQ(L"\xAC00 \xC7A5", QueryToString(L" \xAC00 \xC7A5")); 40 EXPECT_EQ(L"\xAC00 \xC7A5", QueryToString(L" \xAC00 \xC7A5"));
41 EXPECT_EQ(L"foo* bar*", QueryToString(L" foo bar ")); 41 EXPECT_EQ(L"foo* bar*", QueryToString(L" foo bar "));
42 // KA-JANG BICH-GO 42 // KA-JANG BICH-GO
43 EXPECT_EQ(L"\xAC00\xC7A5* \xBE5B\xACE0*", 43 EXPECT_EQ(L"\xAC00\xC7A5* \xBE5B\xACE0*",
44 QueryToString(L"\xAC00\xC7A5 \xBE5B\xACE0")); 44 QueryToString(L"\xAC00\xC7A5 \xBE5B\xACE0"));
45 } 45 }
46 46
47 // Quoted substring parsing. 47 // Quoted substring parsing.
48 TEST_F(QueryParserTest, Quoted) { 48 TEST_F(QueryParserTest, Quoted) {
49 EXPECT_EQ(L"\"Quoted\"", QueryToString(L"\"Quoted\"")); // ASCII quotes 49 // ASCII quotes
50 EXPECT_EQ(L"\"miss end\"", QueryToString(L"\"miss end")); // Missing end quot es 50 EXPECT_EQ(L"\"Quoted\"", QueryToString(L"\"Quoted\""));
51 EXPECT_EQ(L"miss* beg*", QueryToString(L"miss beg\"")); // Missing begin qu otes 51 // Missing end quotes
52 EXPECT_EQ(L"\"Many\" \"quotes\"", QueryToString(L"\"Many \"\"quotes")); // W eird formatting 52 EXPECT_EQ(L"\"miss end\"", QueryToString(L"\"miss end"));
53 // Missing begin quotes
54 EXPECT_EQ(L"miss* beg*", QueryToString(L"miss beg\""));
55 // Weird formatting
56 EXPECT_EQ(L"\"Many\" \"quotes\"", QueryToString(L"\"Many \"\"quotes"));
53 } 57 }
54 58
55 // Apostrophes within words should be preserved, but otherwise stripped. 59 // Apostrophes within words should be preserved, but otherwise stripped.
56 TEST_F(QueryParserTest, Apostrophes) { 60 TEST_F(QueryParserTest, Apostrophes) {
57 EXPECT_EQ(L"foo* bar's*", QueryToString(L"foo bar's")); 61 EXPECT_EQ(L"foo* bar's*", QueryToString(L"foo bar's"));
58 EXPECT_EQ(L"l'foo*", QueryToString(L"l'foo")); 62 EXPECT_EQ(L"l'foo*", QueryToString(L"l'foo"));
59 EXPECT_EQ(L"foo*", QueryToString(L"'foo")); 63 EXPECT_EQ(L"foo*", QueryToString(L"'foo"));
60 } 64 }
61 65
62 // Special characters. 66 // Special characters.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 QueryParser parser; 150 QueryParser parser;
147 parser.ExtractQueryWords(data[i].text, &results); 151 parser.ExtractQueryWords(data[i].text, &results);
148 ASSERT_EQ(data[i].word_count, results.size()); 152 ASSERT_EQ(data[i].word_count, results.size());
149 EXPECT_EQ(data[i].w1, results[0]); 153 EXPECT_EQ(data[i].w1, results[0]);
150 if (results.size() == 2) 154 if (results.size() == 2)
151 EXPECT_EQ(data[i].w2, results[1]); 155 EXPECT_EQ(data[i].w2, results[1]);
152 if (results.size() == 3) 156 if (results.size() == 3)
153 EXPECT_EQ(data[i].w3, results[2]); 157 EXPECT_EQ(data[i].w3, results[2]);
154 } 158 }
155 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/history/in_memory_history_backend.cc ('k') | chrome/browser/history/text_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698