blob: 6027e6a2e991eb53fbbb4d6bc8bb7793c27370e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
* Copyright (c) 2023 Ralf Habacker
* SPDX-License-Identifier: MIT
*/
#include <config.h>
#include "dbus/dbus-string.h"
#include "dbus/dbus-test.h"
#include "dbus/dbus-test-tap.h"
#include "test/test-utils.h"
static dbus_bool_t
_dbus_string_skip_blank_test (const char *test_data_dir _DBUS_GNUC_UNUSED)
{
int end;
DBusString s = _DBUS_STRING_INIT_INVALID;
const char *p = " \rT\r\n";
_dbus_string_init (&s);
if (!_dbus_string_append (&s, p))
{
_dbus_string_free (&s);
return FALSE;
}
_dbus_string_skip_blank (&s, 0, &end);
_dbus_string_free (&s);
return TRUE;
}
static const DBusTestCase test[] =
{
{ "skip_blank", _dbus_string_skip_blank_test },
};
int
main (int argc,
char **argv)
{
return _dbus_test_main (argc, argv, sizeof(test) / sizeof (DBusTestCase), test,
DBUS_TEST_FLAGS_CHECK_MEMORY_LEAKS,
NULL, NULL);
}
|