diff options
Diffstat (limited to 'unittest/test_conf.c')
-rw-r--r-- | unittest/test_conf.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/unittest/test_conf.c b/unittest/test_conf.c index 4773f8b1..889a13e2 100644 --- a/unittest/test_conf.c +++ b/unittest/test_conf.c @@ -195,6 +195,7 @@ TEST(conf_read_with_missing_equal_sign) char *errmsg; create_file("ccache.conf", "no equal sign"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: missing equal sign", errmsg); conf_free(conf); @@ -206,6 +207,7 @@ TEST(conf_read_with_bad_config_key) char *errmsg; create_file("ccache.conf", "# Comment\nfoo = bar"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:2: unknown configuration option \"foo\"", errmsg); conf_free(conf); @@ -218,11 +220,13 @@ TEST(conf_read_invalid_bool) create_file("ccache.conf", "disable="); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: not a boolean value: \"\"", errmsg); create_file("ccache.conf", "disable=foo"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: not a boolean value: \"foo\"", errmsg); conf_free(conf); @@ -234,6 +238,7 @@ TEST(conf_read_invalid_env_string) char *errmsg; create_file("ccache.conf", "base_dir = ${foo"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: syntax error: missing '}' after \"foo\"", errmsg); // Other cases tested in test_util.c. @@ -256,6 +261,7 @@ TEST(conf_read_invalid_size) char *errmsg; create_file("ccache.conf", "max_size = foo"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: invalid size: \"foo\"", errmsg); // Other cases tested in test_util.c. @@ -268,6 +274,7 @@ TEST(conf_read_invalid_sloppiness) char *errmsg; create_file("ccache.conf", "sloppiness = file_macro, foo"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: unknown sloppiness: \"foo\"", errmsg); conf_free(conf); @@ -280,6 +287,7 @@ TEST(conf_read_invalid_unsigned) create_file("ccache.conf", "max_files ="); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: invalid unsigned integer: \"\"", errmsg); @@ -296,6 +304,14 @@ TEST(conf_read_invalid_unsigned) conf_free(conf); } +TEST(conf_read_missing_config_file) +{ + struct conf *conf = conf_create(); + char *errmsg; + CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, ENOENT); +} + TEST(verify_absolute_base_dir) { struct conf *conf = conf_create(); |