Fix tests compilation

This commit is contained in:
Thomas Goyne 2014-03-31 10:16:59 -07:00
parent fcd0df2e96
commit 371f602100
5 changed files with 18 additions and 6 deletions

View file

@ -101,6 +101,10 @@ public:
/// @param default_config Default config.
Hotkey(agi::fs::path const& file, std::pair<const char *, size_t> default_config);
template<size_t N>
Hotkey(agi::fs::path const& file, const char (&default_config)[N])
: Hotkey(file, std::make_pair(default_config, N - 1)) { }
/// Scan for a matching key.
/// @param context Context requested.
/// @param str Hyphen separated key sequence.

View file

@ -56,6 +56,10 @@ public:
/// @param config File to load MRU values from
MRUManager(agi::fs::path const& config, std::pair<const char *, size_t> default_config, agi::Options *options = nullptr);
template<size_t N>
MRUManager(agi::fs::path const& file, const char (&default_config)[N])
: MRUManager(file, std::make_pair(default_config, N - 1)) { }
/// Destructor
~MRUManager();

View file

@ -76,6 +76,10 @@ public:
/// @param default_config Default configuration.
Options(agi::fs::path const& file, std::pair<const char *, size_t> default_config, const OptionSetting setting = NONE);
template<size_t N>
Options(agi::fs::path const& file, const char (&default_config)[N], const OptionSetting setting = NONE)
: Options(file, std::make_pair(default_config, N - 1), setting) { }
/// Destructor
~Options();

View file

@ -17,13 +17,13 @@
#include "main.h"
static const char default_mru[] = "{\"Valid\" : []}";
class lagi_mru : public libagi {
protected:
std::string default_mru;
std::string conf_ok;
void SetUp() override {
default_mru = "{\"Valid\" : []}";
conf_ok = "./data/mru_ok.json";
}
};

View file

@ -21,13 +21,13 @@
#include <fstream>
static const char default_opt[] = "{\"Valid\" : \"This is valid\"}";
class lagi_option : public libagi {
protected:
std::string default_opt;
std::string conf_ok;
void SetUp() override {
default_opt = "{\"Valid\" : \"This is valid\"}";
conf_ok = "data/options/string.json";
}
};
@ -107,7 +107,7 @@ TEST_F(lagi_option, bad_default_throws_and_null_is_rejected) {
}
TEST_F(lagi_option, nested_options) {
const char *conf = "{ \"a\" : { \"b\" : { \"c\" : { \"c\" : \"value\" } } } }";
const char conf[] = "{ \"a\" : { \"b\" : { \"c\" : { \"c\" : \"value\" } } } }";
ASSERT_NO_THROW(agi::Options("", conf, agi::Options::FLUSH_SKIP));
agi::Options opt("", conf, agi::Options::FLUSH_SKIP);
ASSERT_NO_THROW(opt.Get("a/b/c/c"));
@ -169,7 +169,7 @@ TEST_F(lagi_option, flush_roundtrip) {
}
TEST_F(lagi_option, mixed_valid_and_invalid_in_user_conf_loads_all_valid) {
const char *def = "{\"1\" : false, \"2\" : 1, \"3\" : false }";
const char def[] = "{\"1\" : false, \"2\" : 1, \"3\" : false }";
agi::Options opt("data/options/all_bool.json", def, agi::Options::FLUSH_SKIP);
ASSERT_NO_THROW(opt.ConfigUser());
EXPECT_EQ(true, opt.Get("1")->GetBool());