readconf/tests/test.d

35 lines
1016 B
D
Raw Permalink Normal View History

2023-03-23 23:26:02 +00:00
import readconf;
unittest
{
2023-03-25 22:45:41 +00:00
rc.read("./tests/settings.conf");
2023-03-23 23:26:02 +00:00
2023-03-26 00:26:31 +00:00
assert(rc.sn.key("value1") == "text without quotes");
assert(rc.sn.key("value2") == "Yes!");
assert(rc.sn.key("value3") == "value in apostrophes");
assert(rc.sn.key("value4") == "1000");
assert(rc.sn.key("value5") == "0.000");
assert(rc.sn.key("value7") == "//path");
assert(rc.sn.key("value8") == "\"Hey!\"");
assert(rc.sn("part2").key("value1") == "this value will be in the new section");
assert(rc.sn("part2").key("value3") == "good value!");
assert(rc.sn("part3").key("value1") == "-2");
assert(rc.sn("part3").key("value3") == "100");
2023-03-23 23:26:02 +00:00
}
// void main()
// {
// import std.stdio;
2023-03-26 00:26:31 +00:00
// rc.read("./tests/settings.conf");
// foreach (key, param; rc.sn.keys())
// writefln("%s => %s", key, param);
// writeln(rc.sn.key("value1"));
2023-03-23 23:26:02 +00:00
2023-03-26 00:26:31 +00:00
// foreach (key, param; rc.sn("part2").keys())
2023-03-23 23:26:02 +00:00
// writefln("%s => %s", key, param);
2023-03-26 00:26:31 +00:00
// writeln(rc.sn("part2").key("value1"));
2023-03-23 23:26:02 +00:00
// }