Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
steam
systemd
Commits
682cfdff
Commit
682cfdff
authored
Jan 30, 2013
by
Daniel Buch
Committed by
Zbigniew Jędrzejewski-Szmek
Jan 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test-strv.c: test strv_join added
parent
3a7719d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
src/test/test-strv.c
src/test/test-strv.c
+45
-0
No files found.
src/test/test-strv.c
View file @
682cfdff
...
...
@@ -23,6 +23,7 @@
#include "util.h"
#include "specifier.h"
#include "strv.h"
static
void
test_specifier_printf
(
void
)
{
char
*
w
;
...
...
@@ -52,6 +53,49 @@ static void test_foreach_word_quoted(void) {
}
}
static
void
test_strv_join
(
void
)
{
char
*
r
;
const
char
*
const
input_table_multiple
[]
=
{
"one"
,
"two"
,
"three"
,
NULL
};
const
char
*
const
input_table_one
[]
=
{
"one"
,
NULL
};
const
char
*
const
input_table_none
[]
=
{
NULL
};
r
=
strv_join
((
char
**
)
input_table_multiple
,
", "
);
assert_se
(
streq
(
r
,
"one, two, three"
));
puts
(
r
);
free
(
r
);
r
=
strv_join
((
char
**
)
input_table_multiple
,
";"
);
assert_se
(
streq
(
r
,
"one;two;three"
));
puts
(
r
);
free
(
r
);
r
=
strv_join
((
char
**
)
input_table_multiple
,
NULL
);
assert_se
(
streq
(
r
,
"one two three"
));
puts
(
r
);
free
(
r
);
r
=
strv_join
((
char
**
)
input_table_one
,
", "
);
assert_se
(
streq
(
r
,
"one"
));
puts
(
r
);
free
(
r
);
r
=
strv_join
((
char
**
)
input_table_none
,
", "
);
assert_se
(
streq
(
r
,
""
));
puts
(
r
);
free
(
r
);
}
static
void
test_default_term_for_tty
(
void
)
{
printf
(
"%s
\n
"
,
default_term_for_tty
(
"/dev/tty23"
));
printf
(
"%s
\n
"
,
default_term_for_tty
(
"/dev/ttyS23"
));
...
...
@@ -71,6 +115,7 @@ int main(int argc, char *argv[]) {
test_default_term_for_tty
();
test_foreach_word_quoted
();
test_specifier_printf
();
test_strv_join
();
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment