All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Prestwood <james.prestwood@linux.intel.com>
To: ell@lists.01.org
Subject: [PATCH 2/2] unit: test-settings: added test with no group
Date: Thu, 21 Feb 2019 10:22:16 -0800	[thread overview]
Message-ID: <20190221182216.29956-2-james.prestwood@linux.intel.com> (raw)
In-Reply-To: <20190221182216.29956-1-james.prestwood@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

---
 unit/test-settings.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/unit/test-settings.c b/unit/test-settings.c
index c31c379..71f3341 100644
--- a/unit/test-settings.c
+++ b/unit/test-settings.c
@@ -290,6 +290,20 @@ static void test_to_data(const void *test_data)
 	l_settings_free(settings);
 }
 
+static const char *no_group_data = "key_without_group=value\n";
+
+static void test_invalid_data(const void *test_data)
+{
+	struct l_settings *settings;
+	bool r;
+
+	settings = l_settings_new();
+
+	r = l_settings_load_from_data(settings, no_group_data,
+					strlen(no_group_data));
+	assert(r == false);
+}
+
 int main(int argc, char *argv[])
 {
 	l_test_init(&argc, &argv);
@@ -298,6 +312,7 @@ int main(int argc, char *argv[])
 	l_test_add("Load from File", test_load_from_file, NULL);
 	l_test_add("Set Methods", test_set_methods, NULL);
 	l_test_add("Export to Data 1", test_to_data, data2);
+	l_test_add("Invalid Data (no group)", test_invalid_data, NULL);
 
 	return l_test_run();
 }
-- 
2.17.1


  reply	other threads:[~2019-02-21 18:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 18:22 [PATCH 1/2] settings: fix segfault if when settings has no group James Prestwood
2019-02-21 18:22 ` James Prestwood [this message]
2019-02-21 20:10   ` [PATCH 2/2] unit: test-settings: added test with " Denis Kenzior
2019-02-21 20:12 ` [PATCH 1/2] settings: fix segfault if when settings has " Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190221182216.29956-2-james.prestwood@linux.intel.com \
    --to=james.prestwood@linux.intel.com \
    --cc=ell@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.