32class ValueWithDefaultTests :
public UnitTest
37 void runTest()
override
39 beginTest (
"default constructor");
42 expect (
vwd.isUsingDefault());
43 expect (
vwd.get() == var());
46 beginTest (
"missing property");
49 ValueWithDefault
vwd (
t,
"testKey",
nullptr,
"default");
51 expect (
vwd.isUsingDefault());
52 expectEquals (
vwd.get().toString(), String (
"default"));
55 beginTest (
"non-empty property");
58 t.setProperty (
"testKey",
"non-default",
nullptr);
60 ValueWithDefault
vwd (
t,
"testKey",
nullptr,
"default");
62 expect (!
vwd.isUsingDefault());
63 expectEquals (
vwd.get().toString(), String (
"non-default"));
66 beginTest (
"set default");
70 ValueWithDefault
vwd (
t,
"testkey",
nullptr);
71 vwd.setDefault (
"default");
73 expect (
vwd.isUsingDefault());
74 expectEquals (
vwd.get().toString(), String (
"default"));
77 beginTest (
"set value");
80 t.setProperty (
"testkey",
"testvalue",
nullptr);
82 ValueWithDefault
vwd (
t,
"testkey",
nullptr,
"default");
85 expect (!
vwd.isUsingDefault());
86 expectEquals (
t[
"testkey"].toString(), String (
"newvalue"));
90 expect (
vwd.isUsingDefault());
91 expect (
t[
"testkey"] == var());
96static ValueWithDefaultTests valueWithDefaultTests;
Array()=default
Creates an empty array.