blob: aeb1ef82b2e3617dff9bced28d5b2d71bf6c1ca1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/*
* This source code is released into the public domain.
*/
#include <string>
#include <catch2/catch_test_macros.hpp>
import nihil.config;
TEST_CASE("nihil.config: string option", "[nihil][nihil.config]")
{
std::string storage;
auto opt = nihil::config::get_option("test_option");
REQUIRE(!opt);
{
auto string_option = nihil::config::string(
storage, "test_option", "This is a test option");
auto opt = nihil::config::get_option("test_option");
REQUIRE(opt);
REQUIRE((*opt)->name() == "test_option");
REQUIRE((*opt)->description() == "This is a test option");
REQUIRE((*opt)->is_default() == true);
REQUIRE((*opt)->string() == "");
REQUIRE((*opt)->string("testing"));
REQUIRE(storage == "testing");
}
opt = nihil::config::get_option("test_option");
REQUIRE(!opt);
}
|