Fix lagi_thes unit tests on Windows
The thes file was using \r\n line ends, and \r was not stripped, causing the encoding string has a \r at its end. Use binary mode and always use \n as line ends.
This commit is contained in:
parent
336745cdb2
commit
57ee580c0f
1 changed files with 4 additions and 3 deletions
|
@ -26,13 +26,14 @@ protected:
|
|||
std::string dat_path;
|
||||
|
||||
void SetUp() override {
|
||||
using std::endl;
|
||||
// Use '\n' on all platforms, as we are mapping the file to memory as binary data, and readline can only handle '\n'
|
||||
const char endl = '\n';
|
||||
|
||||
idx_path = "data/thes.idx";
|
||||
dat_path = "data/thes.dat";
|
||||
|
||||
std::ofstream idx(idx_path.c_str());
|
||||
std::ofstream dat(dat_path.c_str());
|
||||
std::ofstream idx(idx_path.c_str(), std::ios_base::binary);
|
||||
std::ofstream dat(dat_path.c_str(), std::ios_base::binary);
|
||||
|
||||
idx << "UTF-8" << endl;
|
||||
dat << "UTF-8" << endl;
|
||||
|
|
Loading…
Reference in a new issue