// // config_test.cxx // pokemon_test_xc // // Created by Sam Jaffe on 12/22/18. // Copyright © 2018 Sam Jaffe. All rights reserved. // #include #include "stub_config.h" #include "xcode_gtest_helper.h" using testing::Eq; TEST(ConfigTest, ConfigFileLoadAbsolutePath) { Config cfg("config_test/absolute.cfg.json"); EXPECT_THAT(cfg.resource(""), Eq("/usr/local/lib/engine_test_xc/absolute/")); } TEST(ConfigTest, ConfigFileLoadSelfReferencePath) { Config cfg("config_test/at-config.cfg.json"); std::string const root = Config().resource("config_test"); EXPECT_THAT(cfg.resource(""), Eq(root + "/relative/")); } TEST(ConfigTest, ConfigFromJsonCannotPerformAtConfigSubs) { Json::Value json; json["resource_path"] = "@config/root"; Config cfg(json); EXPECT_THAT(cfg.resource(""), Eq("/root/")); }