aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/tests/suites/test_settings.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2015-08-25 11:29:42 +0200
committerTobias Brunner <tobias@strongswan.org>2015-08-27 11:47:36 +0200
commit0737e936e0c7b196493946d8a10a9b90e456c3e4 (patch)
tree239d54ae1cbaca0c72f402d2aae05621396b536f /src/libstrongswan/tests/suites/test_settings.c
parentfe2443b01cfedb269a8305a07540c38347b852cf (diff)
downloadstrongswan-0737e936e0c7b196493946d8a10a9b90e456c3e4.tar.bz2
strongswan-0737e936e0c7b196493946d8a10a9b90e456c3e4.tar.xz
unit-tests: Additional test cases to increase coverage
Diffstat (limited to 'src/libstrongswan/tests/suites/test_settings.c')
-rw-r--r--src/libstrongswan/tests/suites/test_settings.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/libstrongswan/tests/suites/test_settings.c b/src/libstrongswan/tests/suites/test_settings.c
index ec79a6288..bead9d795 100644
--- a/src/libstrongswan/tests/suites/test_settings.c
+++ b/src/libstrongswan/tests/suites/test_settings.c
@@ -607,6 +607,27 @@ START_TEST(test_include)
}
END_TEST
+START_TEST(test_include_string)
+{
+ chunk_t contents = chunk_from_str(
+ "main {\n"
+ " key1 = val1\n"
+ " key2 = val2\n"
+ " none = x\n"
+ " sub1 {\n"
+ " include this/does/not/exist.conf\n"
+ " include = value\n"
+ " key2 = value2\n"
+ " include \"" include2 "\"\n"
+ " }\n"
+ "}\n"
+ "include \"" include1 "\"");
+
+ create_settings(contents);
+ verify_include();
+}
+END_TEST
+
START_TEST(test_load_files)
{
chunk_t contents = chunk_from_str(
@@ -1009,7 +1030,7 @@ END_TEST
START_SETUP(setup_string_config)
{
create_settings(chunk_from_str(
- "string = \" with accurate\twhitespace\"\n"
+ "string = \" with accurate\twhite\\tspace\"\n"
"special = \"all { special } characters # can be used.\"\n"
"newlines = \"can be encoded explicitly\\nor implicitly\n"
"or \\\n"
@@ -1022,7 +1043,7 @@ END_SETUP
START_TEST(test_strings)
{
- verify_string(" with accurate\twhitespace", "string");
+ verify_string(" with accurate\twhite\tspace", "string");
verify_string("all { special } characters # can be used.", "special");
verify_string("can be encoded explicitly\nor implicitly\nor escaped", "newlines");
verify_string("\"and\" slashes \\ can \\ be", "quotes");
@@ -1162,6 +1183,7 @@ Suite *settings_suite_create()
tc = tcase_create("include/load_files[_section]");
tcase_add_checked_fixture(tc, setup_include_config, teardown_include_config);
tcase_add_test(tc, test_include);
+ tcase_add_test(tc, test_include_string);
tcase_add_test(tc, test_load_files);
tcase_add_test(tc, test_load_files_section);
tcase_add_test(tc, test_order_kv);