From 156af801e686e34685e2ac078a48d8224f3e33b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 28 Jun 2011 16:27:16 +0200 Subject: [PATCH] Add test for section header at end of file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Martín Nieto --- tests/resources/config/config10 | Bin 0 -> 8 bytes tests/t15-config.c | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 tests/resources/config/config10 diff --git a/tests/resources/config/config10 b/tests/resources/config/config10 new file mode 100644 index 0000000000000000000000000000000000000000..dde17911bf8e44bec3a3e2ae7aad92deae75aff1 GIT binary patch literal 8 Pcmaz}%`GUYjO79V4qyWE literal 0 HcmV?d00001 diff --git a/tests/t15-config.c b/tests/t15-config.c index 25cdcbd65..a4e11c3c8 100644 --- a/tests/t15-config.c +++ b/tests/t15-config.c @@ -263,6 +263,14 @@ BEGIN_TEST(config13, "can't delete a non-existent value") git_config_free(cfg); END_TEST +BEGIN_TEST(config14, "don't fail horribly if a section header is in the last line") + git_config *cfg; + + /* By freeing the config, we make sure we flush the values */ + must_pass(git_config_open_ondisk(&cfg, CONFIG_BASE "/config10")); + git_config_free(cfg); +END_TEST + BEGIN_SUITE(config) ADD_TEST(config0); ADD_TEST(config1); @@ -278,4 +286,5 @@ BEGIN_SUITE(config) ADD_TEST(config11); ADD_TEST(config12); ADD_TEST(config13); + ADD_TEST(config14); END_SUITE