Enable test to handle attempt to load non-existing file in csv importer

This commit is contained in:
Geert Janssens 2018-03-08 14:24:02 +01:00
parent 89c1534d51
commit 6fe7d88548
2 changed files with 10 additions and 11 deletions

View File

@ -73,7 +73,7 @@ public:
const std::string& encoding();
virtual int tokenize() = 0;
const std::vector<StrVec>& get_tokens();
protected:
std::string m_utf8_contents;
std::vector<StrVec> m_tokenized_contents;

View File

@ -84,16 +84,15 @@ std::string GncTokenizerTest::get_filepath(const std::string& filename)
return std::string(srcdir) + "/" + filename;
}
//TEST_F (GncTokenizerTest, load_file_nonexisting)
//{
//
// auto file1 = get_filepath ("notexist.csv");
//
// /* Test loading of a non-existing file */
// // FIXME determine what is actually thrown as I can't find it by trial and error
// EXPECT_THROW (fw_tok->load_file (file1), std::ios_base::failure);
// EXPECT_THROW (csv_tok->load_file (file1), std::ios_base::failure);
//}
TEST_F (GncTokenizerTest, load_file_nonexisting)
{
auto file1 = get_filepath ("notexist.csv");
/* Test loading of a non-existing file */
EXPECT_THROW (fw_tok->load_file (file1), std::ios_base::failure);
EXPECT_THROW (csv_tok->load_file (file1), std::ios_base::failure);
}
TEST_F (GncTokenizerTest, load_file_existing)
{