blob: 735da4e0d1d74a6e1f8616470d47b2370272c219 [file] [log] [blame]
Kristian Høgsberg73274712013-04-01 12:41:23 -04001/*
2 * Copyright © 2013 Intel Corporation
3 *
Bryce Harrington2cc92972015-06-11 15:39:40 -07004 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
Kristian Høgsberg73274712013-04-01 12:41:23 -040011 *
Bryce Harrington2cc92972015-06-11 15:39:40 -070012 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial
14 * portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
Kristian Høgsberg73274712013-04-01 12:41:23 -040024 */
25
Andrew Wedgbury9cd661e2014-04-07 12:40:35 +010026#include "config.h"
27
Kristian Høgsberg73274712013-04-01 12:41:23 -040028#include <stdlib.h>
29#include <stdint.h>
Jon A. Cruza67c5412015-07-15 19:22:42 -070030#include <stdio.h>
Kristian Høgsberg73274712013-04-01 12:41:23 -040031#include <string.h>
32#include <assert.h>
33#include <errno.h>
Kristian Høgsbergac3a8b82013-07-08 19:06:06 -040034#include <unistd.h>
Kristian Høgsberg73274712013-04-01 12:41:23 -040035
36#include "config-parser.h"
37
Jon A. Cruza67c5412015-07-15 19:22:42 -070038#include "shared/helpers.h"
39#include "zunitc/zunitc.h"
40
41struct fixture_data {
42 const char *text;
Kristian Høgsberg73274712013-04-01 12:41:23 -040043 struct weston_config *config;
Jon A. Cruza67c5412015-07-15 19:22:42 -070044};
45
46static struct weston_config *
47load_config(const char *text)
48{
49 struct weston_config *config = NULL;
50 int len = 0;
51 int fd = -1;
Kristian Høgsberg73274712013-04-01 12:41:23 -040052 char file[] = "/tmp/weston-config-parser-test-XXXXXX";
Jon A. Cruza67c5412015-07-15 19:22:42 -070053
54 ZUC_ASSERTG_NOT_NULL(text, out);
Kristian Høgsberg73274712013-04-01 12:41:23 -040055
56 fd = mkstemp(file);
Jon A. Cruza67c5412015-07-15 19:22:42 -070057 ZUC_ASSERTG_NE(-1, fd, out);
58
Kristian Høgsberg73274712013-04-01 12:41:23 -040059 len = write(fd, text, strlen(text));
Jon A. Cruza67c5412015-07-15 19:22:42 -070060 ZUC_ASSERTG_EQ((int)strlen(text), len, out_close);
Kristian Høgsberg73274712013-04-01 12:41:23 -040061
Kristian Høgsberg1abe0482013-09-21 23:02:31 -070062 config = weston_config_parse(file);
Jon A. Cruza67c5412015-07-15 19:22:42 -070063
64out_close:
Kristian Høgsberg73274712013-04-01 12:41:23 -040065 close(fd);
66 unlink(file);
Jon A. Cruza67c5412015-07-15 19:22:42 -070067out:
Kristian Høgsberg73274712013-04-01 12:41:23 -040068 return config;
69}
70
Jon A. Cruza67c5412015-07-15 19:22:42 -070071static void *
72setup_test_config(void *data)
73{
74 struct weston_config *config = load_config(data);
75 ZUC_ASSERTG_NOT_NULL(config, out);
Kristian Høgsberg73274712013-04-01 12:41:23 -040076
Jon A. Cruza67c5412015-07-15 19:22:42 -070077out:
78 return config;
79}
80
81static void *
82setup_test_config_failing(void *data)
83{
84 struct weston_config *config = load_config(data);
85 ZUC_ASSERTG_NULL(config, err_free);
86
87 return config;
88err_free:
89 weston_config_destroy(config);
90 return NULL;
91}
92
93static void
94cleanup_test_config(void *data)
95{
96 struct weston_config *config = data;
97 ZUC_ASSERT_NOT_NULL(config);
98 weston_config_destroy(config);
99}
100
101static struct zuc_fixture config_test_t0 = {
102 .data = "# nothing in this file...\n",
103 .set_up = setup_test_config,
104 .tear_down = cleanup_test_config
105};
106
107static struct zuc_fixture config_test_t1 = {
108 .data =
Kristian Høgsberg73274712013-04-01 12:41:23 -0400109 "# comment line here...\n"
110 "\n"
111 "[foo]\n"
112 "a=b\n"
113 "name= Roy Batty \n"
114 "\n"
115 "\n"
116 "[bar]\n"
117 "# more comments\n"
118 "number=5252\n"
Bryce Harringtoncbc05372016-07-07 14:08:28 -0700119 "zero=0\n"
Kristian Høgsberg73274712013-04-01 12:41:23 -0400120 "flag=false\n"
121 "\n"
122 "[stuff]\n"
123 "flag= true \n"
124 "\n"
125 "[bucket]\n"
126 "color=blue \n"
127 "contents=live crabs\n"
128 "pinchy=true\n"
129 "\n"
130 "[bucket]\n"
131 "material=plastic \n"
132 "color=red\n"
Jon A. Cruza67c5412015-07-15 19:22:42 -0700133 "contents=sand\n",
134 .set_up = setup_test_config,
135 .tear_down = cleanup_test_config
136};
Kristian Høgsberg73274712013-04-01 12:41:23 -0400137
Kristian Høgsbergf73f3162013-05-26 20:50:53 -0400138static const char *section_names[] = {
139 "foo", "bar", "stuff", "bucket", "bucket"
140};
141
Jon A. Cruza67c5412015-07-15 19:22:42 -0700142/*
143 * Since these next few won't parse, we don't add the tear_down to
144 * attempt cleanup.
145 */
Kristian Høgsberg73274712013-04-01 12:41:23 -0400146
Jon A. Cruza67c5412015-07-15 19:22:42 -0700147static struct zuc_fixture config_test_t2 = {
148 .data =
149 "# invalid section...\n"
150 "[this bracket isn't closed\n",
151 .set_up = setup_test_config_failing,
152};
153
154static struct zuc_fixture config_test_t3 = {
155 .data =
Kristian Høgsberg73274712013-04-01 12:41:23 -0400156 "# line without = ...\n"
157 "[bambam]\n"
Jon A. Cruza67c5412015-07-15 19:22:42 -0700158 "this line isn't any kind of valid\n",
159 .set_up = setup_test_config_failing,
160};
Kristian Høgsberg73274712013-04-01 12:41:23 -0400161
Jon A. Cruza67c5412015-07-15 19:22:42 -0700162static struct zuc_fixture config_test_t4 = {
163 .data =
Kristian Høgsberg73274712013-04-01 12:41:23 -0400164 "# starting with = ...\n"
165 "[bambam]\n"
Jon A. Cruza67c5412015-07-15 19:22:42 -0700166 "=not valid at all\n",
167 .set_up = setup_test_config_failing,
168};
Kristian Høgsberg73274712013-04-01 12:41:23 -0400169
Jon Cruzecf819b2015-10-22 21:11:12 -0700170ZUC_TEST_F(config_test_t0, comment_only, data)
Kristian Høgsberg73274712013-04-01 12:41:23 -0400171{
Jon A. Cruza67c5412015-07-15 19:22:42 -0700172 struct weston_config *config = data;
173 ZUC_ASSERT_NOT_NULL(config);
174}
175
176/** @todo individual t1 tests should have more descriptive names. */
177
Jon Cruzecf819b2015-10-22 21:11:12 -0700178ZUC_TEST_F(config_test_t1, test001, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700179{
Kristian Høgsberg73274712013-04-01 12:41:23 -0400180 struct weston_config_section *section;
Jon A. Cruza67c5412015-07-15 19:22:42 -0700181 struct weston_config *config = data;
182 ZUC_ASSERT_NOT_NULL(config);
183 section = weston_config_get_section(config,
184 "mollusc", NULL, NULL);
185 ZUC_ASSERT_NULL(section);
186}
187
Jon Cruzecf819b2015-10-22 21:11:12 -0700188ZUC_TEST_F(config_test_t1, test002, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700189{
Kristian Høgsberg73274712013-04-01 12:41:23 -0400190 char *s;
Jon A. Cruza67c5412015-07-15 19:22:42 -0700191 int r;
192 struct weston_config_section *section;
193 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400194
195 section = weston_config_get_section(config, "foo", NULL, NULL);
196 r = weston_config_section_get_string(section, "a", &s, NULL);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700197
198 ZUC_ASSERTG_EQ(0, r, out_free);
199 ZUC_ASSERTG_STREQ("b", s, out_free);
200
201out_free:
Kristian Høgsberg73274712013-04-01 12:41:23 -0400202 free(s);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700203}
204
Jon Cruzecf819b2015-10-22 21:11:12 -0700205ZUC_TEST_F(config_test_t1, test003, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700206{
207 char *s;
208 int r;
209 struct weston_config_section *section;
210 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400211
212 section = weston_config_get_section(config, "foo", NULL, NULL);
213 r = weston_config_section_get_string(section, "b", &s, NULL);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700214
215 ZUC_ASSERT_EQ(-1, r);
216 ZUC_ASSERT_EQ(ENOENT, errno);
217 ZUC_ASSERT_NULL(s);
218}
219
Jon Cruzecf819b2015-10-22 21:11:12 -0700220ZUC_TEST_F(config_test_t1, test004, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700221{
222 char *s;
223 int r;
224 struct weston_config_section *section;
225 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400226
227 section = weston_config_get_section(config, "foo", NULL, NULL);
228 r = weston_config_section_get_string(section, "name", &s, NULL);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700229
230 ZUC_ASSERTG_EQ(0, r, out_free);
231 ZUC_ASSERTG_STREQ("Roy Batty", s, out_free);
232
233out_free:
Kristian Høgsberg73274712013-04-01 12:41:23 -0400234 free(s);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700235}
236
Jon Cruzecf819b2015-10-22 21:11:12 -0700237ZUC_TEST_F(config_test_t1, test005, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700238{
239 char *s;
240 int r;
241 struct weston_config_section *section;
242 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400243
244 section = weston_config_get_section(config, "bar", NULL, NULL);
245 r = weston_config_section_get_string(section, "a", &s, "boo");
Jon A. Cruza67c5412015-07-15 19:22:42 -0700246
247 ZUC_ASSERTG_EQ(-1, r, out_free);
248 ZUC_ASSERTG_EQ(ENOENT, errno, out_free);
249 ZUC_ASSERTG_STREQ("boo", s, out_free);
250
251out_free:
Kristian Høgsberg73274712013-04-01 12:41:23 -0400252 free(s);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700253}
254
Jon Cruzecf819b2015-10-22 21:11:12 -0700255ZUC_TEST_F(config_test_t1, test006, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700256{
257 int r;
258 int32_t n;
259 struct weston_config_section *section;
260 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400261
262 section = weston_config_get_section(config, "bar", NULL, NULL);
263 r = weston_config_section_get_int(section, "number", &n, 600);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700264
265 ZUC_ASSERT_EQ(0, r);
266 ZUC_ASSERT_EQ(5252, n);
Bryce Harringtoncbc05372016-07-07 14:08:28 -0700267 ZUC_ASSERT_EQ(0, errno);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700268}
269
Jon Cruzecf819b2015-10-22 21:11:12 -0700270ZUC_TEST_F(config_test_t1, test007, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700271{
272 int r;
273 int32_t n;
274 struct weston_config_section *section;
Derek Foremanbdc8c722015-10-07 11:51:29 -0500275 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400276
277 section = weston_config_get_section(config, "bar", NULL, NULL);
278 r = weston_config_section_get_int(section, "+++", &n, 700);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700279
280 ZUC_ASSERT_EQ(-1, r);
281 ZUC_ASSERT_EQ(ENOENT, errno);
282 ZUC_ASSERT_EQ(700, n);
283}
284
Jon Cruzecf819b2015-10-22 21:11:12 -0700285ZUC_TEST_F(config_test_t1, test008, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700286{
287 int r;
288 uint32_t u;
289 struct weston_config_section *section;
290 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400291
292 section = weston_config_get_section(config, "bar", NULL, NULL);
293 r = weston_config_section_get_uint(section, "number", &u, 600);
Bryce Harringtoncbc05372016-07-07 14:08:28 -0700294
Jon A. Cruza67c5412015-07-15 19:22:42 -0700295 ZUC_ASSERT_EQ(0, r);
296 ZUC_ASSERT_EQ(5252, u);
Bryce Harringtoncbc05372016-07-07 14:08:28 -0700297 ZUC_ASSERT_EQ(0, errno);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700298}
299
Jon Cruzecf819b2015-10-22 21:11:12 -0700300ZUC_TEST_F(config_test_t1, test009, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700301{
302 int r;
303 uint32_t u;
304 struct weston_config_section *section;
305 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400306
307 section = weston_config_get_section(config, "bar", NULL, NULL);
308 r = weston_config_section_get_uint(section, "+++", &u, 600);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700309 ZUC_ASSERT_EQ(-1, r);
310 ZUC_ASSERT_EQ(ENOENT, errno);
311 ZUC_ASSERT_EQ(600, u);
312}
313
Jon Cruzecf819b2015-10-22 21:11:12 -0700314ZUC_TEST_F(config_test_t1, test010, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700315{
316 int r, b;
317 struct weston_config_section *section;
318 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400319
320 section = weston_config_get_section(config, "bar", NULL, NULL);
321 r = weston_config_section_get_bool(section, "flag", &b, 600);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700322 ZUC_ASSERT_EQ(0, r);
323 ZUC_ASSERT_EQ(0, b);
324}
325
Jon Cruzecf819b2015-10-22 21:11:12 -0700326ZUC_TEST_F(config_test_t1, test011, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700327{
328 int r, b;
329 struct weston_config_section *section;
330 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400331
332 section = weston_config_get_section(config, "stuff", NULL, NULL);
333 r = weston_config_section_get_bool(section, "flag", &b, -1);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700334 ZUC_ASSERT_EQ(0, r);
335 ZUC_ASSERT_EQ(1, b);
336}
337
Jon Cruzecf819b2015-10-22 21:11:12 -0700338ZUC_TEST_F(config_test_t1, test012, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700339{
340 int r, b;
341 struct weston_config_section *section;
342 struct weston_config *config = data;
343
344 section = weston_config_get_section(config, "stuff", NULL, NULL);
345 r = weston_config_section_get_bool(section, "flag", &b, -1);
346 ZUC_ASSERT_EQ(0, r);
347 ZUC_ASSERT_EQ(1, b);
348}
349
Jon Cruzecf819b2015-10-22 21:11:12 -0700350ZUC_TEST_F(config_test_t1, test013, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700351{
352 int r, b;
353 struct weston_config_section *section;
354 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400355
356 section = weston_config_get_section(config, "stuff", NULL, NULL);
357 r = weston_config_section_get_bool(section, "bonk", &b, -1);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700358 ZUC_ASSERT_EQ(-1, r);
359 ZUC_ASSERT_EQ(ENOENT, errno);
360 ZUC_ASSERT_EQ(-1, b);
361}
Kristian Høgsberg73274712013-04-01 12:41:23 -0400362
Jon Cruzecf819b2015-10-22 21:11:12 -0700363ZUC_TEST_F(config_test_t1, test014, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700364{
365 char *s;
366 int r;
367 struct weston_config_section *section;
368 struct weston_config *config = data;
369
370 section = weston_config_get_section(config,
371 "bucket", "color", "blue");
Kristian Høgsberg73274712013-04-01 12:41:23 -0400372 r = weston_config_section_get_string(section, "contents", &s, NULL);
Kristian Høgsberg73274712013-04-01 12:41:23 -0400373
Jon A. Cruza67c5412015-07-15 19:22:42 -0700374 ZUC_ASSERTG_EQ(0, r, out_free);
375 ZUC_ASSERTG_STREQ("live crabs", s, out_free);
376
377out_free:
378 free(s);
379}
380
Jon Cruzecf819b2015-10-22 21:11:12 -0700381ZUC_TEST_F(config_test_t1, test015, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700382{
383 char *s;
384 int r;
385 struct weston_config_section *section;
386 struct weston_config *config = data;
387
388 section = weston_config_get_section(config,
389 "bucket", "color", "red");
Kristian Høgsberg73274712013-04-01 12:41:23 -0400390 r = weston_config_section_get_string(section, "contents", &s, NULL);
Kristian Høgsberg73274712013-04-01 12:41:23 -0400391
Jon A. Cruza67c5412015-07-15 19:22:42 -0700392 ZUC_ASSERTG_EQ(0, r, out_free);
393 ZUC_ASSERTG_STREQ("sand", s, out_free);
394
395out_free:
396 free(s);
397}
398
Jon Cruzecf819b2015-10-22 21:11:12 -0700399ZUC_TEST_F(config_test_t1, test016, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700400{
401 char *s;
402 int r;
403 struct weston_config_section *section;
404 struct weston_config *config = data;
405
406 section = weston_config_get_section(config,
407 "bucket", "color", "pink");
408 ZUC_ASSERT_NULL(section);
Kristian Høgsberg73274712013-04-01 12:41:23 -0400409 r = weston_config_section_get_string(section, "contents", &s, "eels");
Jon A. Cruza67c5412015-07-15 19:22:42 -0700410
411 ZUC_ASSERTG_EQ(-1, r, out_free);
412 ZUC_ASSERTG_EQ(ENOENT, errno, out_free);
413 ZUC_ASSERTG_STREQ("eels", s, out_free);
414
415out_free:
Kristian Høgsberg73274712013-04-01 12:41:23 -0400416 free(s);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700417}
418
Jon Cruzecf819b2015-10-22 21:11:12 -0700419ZUC_TEST_F(config_test_t1, test017, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700420{
421 const char *name;
422 int i;
423 struct weston_config_section *section;
424 struct weston_config *config = data;
Kristian Høgsberg73274712013-04-01 12:41:23 -0400425
Kristian Høgsbergf73f3162013-05-26 20:50:53 -0400426 section = NULL;
427 i = 0;
428 while (weston_config_next_section(config, &section, &name))
Jon A. Cruza67c5412015-07-15 19:22:42 -0700429 ZUC_ASSERT_STREQ(section_names[i++], name);
Kristian Høgsbergf73f3162013-05-26 20:50:53 -0400430
Jon A. Cruza67c5412015-07-15 19:22:42 -0700431 ZUC_ASSERT_EQ(5, i);
432}
Kristian Høgsberg73274712013-04-01 12:41:23 -0400433
Bryce Harringtoncbc05372016-07-07 14:08:28 -0700434ZUC_TEST_F(config_test_t1, test018, data)
435{
436 int r;
437 int32_t n;
438 struct weston_config_section *section;
439 struct weston_config *config = data;
440
441 section = weston_config_get_section(config, "bar", NULL, NULL);
442 r = weston_config_section_get_int(section, "zero", &n, 600);
443
444 ZUC_ASSERT_EQ(0, r);
445 ZUC_ASSERT_EQ(0, n);
446 ZUC_ASSERT_EQ(0, errno);
447}
448
449ZUC_TEST_F(config_test_t1, test019, data)
450{
451 int r;
452 uint32_t n;
453 struct weston_config_section *section;
454 struct weston_config *config = data;
455
456 section = weston_config_get_section(config, "bar", NULL, NULL);
457 r = weston_config_section_get_uint(section, "zero", &n, 600);
458
459 ZUC_ASSERT_EQ(0, r);
460 ZUC_ASSERT_EQ(0, n);
461 ZUC_ASSERT_EQ(0, errno);
462}
463
Jon Cruzecf819b2015-10-22 21:11:12 -0700464ZUC_TEST_F(config_test_t2, doesnt_parse, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700465{
466 struct weston_config *config = data;
467 ZUC_ASSERT_NULL(config);
468}
Kristian Høgsberg73274712013-04-01 12:41:23 -0400469
Jon Cruzecf819b2015-10-22 21:11:12 -0700470ZUC_TEST_F(config_test_t3, doesnt_parse, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700471{
472 struct weston_config *config = data;
473 ZUC_ASSERT_NULL(config);
474}
Kristian Høgsberg73274712013-04-01 12:41:23 -0400475
Jon Cruzecf819b2015-10-22 21:11:12 -0700476ZUC_TEST_F(config_test_t4, doesnt_parse, data)
Jon A. Cruza67c5412015-07-15 19:22:42 -0700477{
478 struct weston_config *config = data;
479 ZUC_ASSERT_NULL(config);
480}
Kristian Høgsberg73274712013-04-01 12:41:23 -0400481
Jon A. Cruza67c5412015-07-15 19:22:42 -0700482ZUC_TEST(config_test, destroy_null)
483{
Kristian Høgsberg82189f72013-05-28 15:34:46 -0400484 weston_config_destroy(NULL);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700485 ZUC_ASSERT_EQ(0, weston_config_next_section(NULL, NULL, NULL));
486}
Kristian Høgsberg82189f72013-05-28 15:34:46 -0400487
Jon A. Cruza67c5412015-07-15 19:22:42 -0700488ZUC_TEST(config_test, section_from_null)
489{
490 struct weston_config_section *section;
Kristian Høgsberg82189f72013-05-28 15:34:46 -0400491 section = weston_config_get_section(NULL, "bucket", NULL, NULL);
Jon A. Cruza67c5412015-07-15 19:22:42 -0700492 ZUC_ASSERT_NULL(section);
Kristian Høgsberg73274712013-04-01 12:41:23 -0400493}