Changeset View
Changeset View
Standalone View
Standalone View
source/test_setup.cpp
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | void ScriptTestSetup(const ScriptInterface& scriptinterface) | ||||
scriptinterface.RegisterFunction<void, std::wstring, script_TS_FAIL>("TS_FAIL"); | scriptinterface.RegisterFunction<void, std::wstring, script_TS_FAIL>("TS_FAIL"); | ||||
// Load the TS_* function definitions | // Load the TS_* function definitions | ||||
// (We don't use VFS because tests might not have the normal VFS paths loaded) | // (We don't use VFS because tests might not have the normal VFS paths loaded) | ||||
OsPath path = DataDir()/"tests"/"test_setup.js"; | OsPath path = DataDir()/"tests"/"test_setup.js"; | ||||
std::ifstream ifs(OsString(path).c_str()); | std::ifstream ifs(OsString(path).c_str()); | ||||
ENSURE(ifs.good()); | ENSURE(ifs.good()); | ||||
std::string content((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>()); | std::string content((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>()); | ||||
bool ok = scriptinterface.LoadScript(L"test_setup.js", content); | ENSURE(scriptinterface.LoadScript(L"test_setup.js", content)); | ||||
ENSURE(ok); | |||||
} | } |
Wildfire Games · Phabricator