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

Side by Side Diff: chrome/third_party/hunspell/google/hunspell_tests.cc

Issue 6005: Cross-platform equivalent of fopen, _wfopen_s etc.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2008 Google Inc. All Rights Reserved. 1 // Copyright 2008 Google Inc. All Rights Reserved.
2 2
3 #include <string> 3 #include <string>
4 #include <vector> 4 #include <vector>
5 5
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/third_party/hunspell/google/bdict_reader.h" 9 #include "chrome/third_party/hunspell/google/bdict_reader.h"
10 #include "chrome/third_party/hunspell/google/bdict_writer.h" 10 #include "chrome/third_party/hunspell/google/bdict_writer.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // Actually generate the bdic data. 98 // Actually generate the bdic data.
99 std::string serialized = writer.GetBDict(); 99 std::string serialized = writer.GetBDict();
100 ASSERT_FALSE(serialized.empty()); 100 ASSERT_FALSE(serialized.empty());
101 101
102 // Create a hunspell object to read that data. 102 // Create a hunspell object to read that data.
103 Hunspell hunspell(reinterpret_cast<const unsigned char*>(serialized.data()), 103 Hunspell hunspell(reinterpret_cast<const unsigned char*>(serialized.data()),
104 serialized.size()); 104 serialized.size());
105 #else 105 #else
106 // Use "regular" Hunspell. 106 // Use "regular" Hunspell.
107 FILE *aff_file, *dic_file; 107 FILE* aff_file = file_util::OpenFile(aff_name, "r");
108 fopen_s(&aff_file, aff_name.c_str(), "r"); 108 FILE* dic_file = file_util::OpenFile(dic_name, "r");
109 fopen_s(&dic_file, dic_name.c_str(), "r");
110 EXPECT_TRUE(aff_file && dic_file); 109 EXPECT_TRUE(aff_file && dic_file);
111 110
112 Hunspell hunspell(aff_file, dic_file); 111 Hunspell hunspell(aff_file, dic_file);
113 #endif 112 #endif
114 113
115 // Read the good words file and check it. 114 // Read the good words file and check it.
116 std::vector<std::string> good_words = ReadFileLines(test_base + L".good"); 115 std::vector<std::string> good_words = ReadFileLines(test_base + L".good");
117 for (size_t i = 0; i < good_words.size(); i++) { 116 for (size_t i = 0; i < good_words.size(); i++) {
118 #ifdef HUNSPELL_CHROME_CLIENT 117 #ifdef HUNSPELL_CHROME_CLIENT
119 std::string cur_word; 118 std::string cur_word;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 RunTest("rep"); 203 RunTest("rep");
205 RunTest("reputf"); 204 RunTest("reputf");
206 RunTest("slash"); 205 RunTest("slash");
207 RunTest("sug"); 206 RunTest("sug");
208 RunTest("utf8"); 207 RunTest("utf8");
209 RunTest("utf8_bom"); 208 RunTest("utf8_bom");
210 RunTest("utf8_bom2"); 209 RunTest("utf8_bom2");
211 RunTest("utf8_nonbmp"); 210 RunTest("utf8_nonbmp");
212 RunTest("utfcompound"); 211 RunTest("utfcompound");
213 RunTest("zeroaffix"); 212 RunTest("zeroaffix");
214 } 213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698