[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 982321d3: Make a unit test more robust
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 982321d3: Make a unit test more robust |
Date: |
Fri, 7 Jan 2022 09:29:01 -0500 (EST) |
branch: master
commit 982321d3cd8d2c4005fd73820bb3c693e0c6c1c0
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Make a unit test more robust
Certain values have long been tested only to ensure that writing a new
'configurable_settings.xml' does not change them, although it does
change historically-renamed variants that have nearly identical names.
Formerly, those values were validated against lmi's built-in defaults;
now, they're tested against the possibly customozied values in effect
before a new 'configurable_settings.xml' is written.
Incidentally improved a block comment to make it more clear that
every item in that comment actually is tested. For example, the
"version" attribute is omitted for the <configurable_settings>
element, but not for the <?xml version="1.0"?> declaration.
---
configurable_settings_test.cpp | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/configurable_settings_test.cpp b/configurable_settings_test.cpp
index b52efa79..1cb6c110 100644
--- a/configurable_settings_test.cpp
+++ b/configurable_settings_test.cpp
@@ -62,18 +62,24 @@ void configurable_settings_test::test_writability()
}
/// Test each aspect of backward compatibility:
-/// - missing 'version' attribute
-/// - missing elements
+/// - missing <configurable_settings version=""> attribute
+/// - missing elements (most are omitted in this test)
/// - renamed elements
/// - a withdrawn element
/// - an obsolete skin name
void configurable_settings_test::test_backward_compatibility()
{
+ configurable_settings& c = configurable_settings::instance();
+
+ // Historical renaming should not affect these two:
+ std::string const c_i_1 = c.custom_input_1_filename();
+ std::string const c_o_1 = c.custom_output_1_filename();
+
fs::path const filename("eraseme");
fs::ofstream ofs(filename, ios_out_trunc_binary());
ofs
- << "<?xml version=\"1.0\"?>\n"
+// << "<?xml version=\"1.0\"?>\n"
<< "<configurable_settings>\n"
<< "<custom_input_filename>[renamed]</custom_input_filename>\n"
<< "<custom_output_filename>[renamed]</custom_output_filename>\n"
@@ -83,12 +89,11 @@ void
configurable_settings_test::test_backward_compatibility()
;
ofs.close();
- configurable_settings& c = configurable_settings::instance();
c.xml_serializable<configurable_settings>::load(filename);
LMI_TEST_EQUAL("[renamed]" , c.custom_input_0_filename());
- LMI_TEST_EQUAL("custom.inix" , c.custom_input_1_filename());
+ LMI_TEST_EQUAL(c_i_1 , c.custom_input_1_filename());
LMI_TEST_EQUAL("[renamed]" , c.custom_output_0_filename());
- LMI_TEST_EQUAL("custom.out1" , c.custom_output_1_filename());
+ LMI_TEST_EQUAL(c_o_1 , c.custom_output_1_filename());
LMI_TEST_EQUAL("skin.xrc" , c.skin_filename());
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [lmi] master 982321d3: Make a unit test more robust,
Greg Chicares <=