Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Fixed issues with loadTestDataFile and loadTestDataFileDir in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrekV committed Oct 9, 2019
1 parent 2b9c28f commit b1520b3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/test/app_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ TEST(User, DeletesZombies) {
ASSERT_FALSE(te->IsMarkedAsDeletedOnServer());

std::string json =
loadTestDataFile("../testdata/me_without_time_entries.json");
loadTestDataFile(std::string("../testdata/me_without_time_entries.json"));

ASSERT_EQ(noError,
user.LoadUserAndRelatedDataFromJSONString(json, true));
Expand Down Expand Up @@ -394,7 +394,7 @@ TEST(Database, AllowsSameEmail) {
ASSERT_EQ(noError, db.instance()->SaveUser(&user, true, &changes));

User user2;
std::string json = loadTestDataFile("../testdata/same_email.json");
std::string json = loadTestDataFile(std::string("../testdata/same_email.json"));
ASSERT_EQ(noError,
user2.LoadUserAndRelatedDataFromJSONString(json, true));

Expand Down Expand Up @@ -470,7 +470,7 @@ TEST(Database, SavesAndLoadsObmExperiments) {
ASSERT_EQ(noError,
user.LoadUserAndRelatedDataFromJSONString(loadTestData(), true));

std::string json = loadTestDataFile("../testdata/obm_response.json");
std::string json = loadTestDataFile(std::string("../testdata/obm_response.json"));
Json::Value data = jsonStringToValue(json);
user.LoadObmExperiments(data);

Expand Down Expand Up @@ -502,7 +502,7 @@ TEST(Database, SavesAndLoadsObmExperimentsArray) {
ASSERT_EQ(noError,
user.LoadUserAndRelatedDataFromJSONString(loadTestData(), true));

std::string json = loadTestDataFile("../testdata/obm_response_array.json");
std::string json = loadTestDataFile(std::string("../testdata/obm_response_array.json"));
Json::Value data = jsonStringToValue(json);
user.LoadObmExperiments(data);

Expand Down Expand Up @@ -1300,7 +1300,7 @@ TEST(User, Continue) {
TEST(TimeEntry, SetDurationOnRunningTimeEntryWithDurOnlySetting) {
testing::Database db;

std::string json = loadTestDataFile("../testdata/user_with_duronly.json");
std::string json = loadTestDataFile(std::string("../testdata/user_with_duronly.json"));

User user;
ASSERT_EQ(noError,
Expand Down
2 changes: 1 addition & 1 deletion src/test/test_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ std::string loadTestData() {
return loadFromTestDataDir("me.json");
}

std::string loadFromTestDataDir(const char* filename) {
std::string loadFromTestDataDir(const std::string &filename) {
return loadTestDataFile(std::string(TESTDATADIR) + filename);
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/test_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <string>

std::string loadTestData();
std::string loadFromTestDataDir(const char* filename);
std::string loadFromTestDataDir(const std::string &filename);
std::string loadTestDataFile(const std::string &filename);

#endif // SRC_TEST_TEST_DATA_H_
2 changes: 1 addition & 1 deletion src/test/toggl_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@ TEST(toggl_api, toggl_set_time_entry_end) {
TEST(toggl_api, toggl_set_time_entry_end_prefers_same_day) {
testing::App app;
std::string json =
loadFromTestDataDir("time_entry_ending_tomorrow.json");
loadFromTestDataDir(std::string("time_entry_ending_tomorrow.json"));
ASSERT_TRUE(testing_set_logged_in_user(app.ctx(), json.c_str()));

toggl::TimeEntry te = testing::testresult::time_entry_by_id(89818605);
Expand Down

0 comments on commit b1520b3

Please sign in to comment.