diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-11-14 21:31:03 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-11-14 21:31:03 +0100 |
commit | 9117a6b79dc32731f84968553dfffb3336e27aac (patch) | |
tree | cbcde3e57543760c191b05164b133cb0bfde0680 | |
parent | f7b419897a97e1ebf96064227a04a1100d21f903 (diff) | |
download | vala-9117a6b79dc32731f84968553dfffb3336e27aac.tar.gz |
tests: Add string.printf() test to increase coverage
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/basic-types/strings.vala | 6 | ||||
-rw-r--r-- | tests/posix/string-printf.vala | 4 |
3 files changed, 11 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 48aa3a55c..2b3061793 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1129,6 +1129,7 @@ LINUX_TESTS += \ linux/file-commandpipe.vala \ posix/arrays.vala \ posix/empty-length-0.vala \ + posix/string-printf.vala \ posix/struct_only.vala \ posix/delegate_only.vala \ posix/enum_only.vala \ diff --git a/tests/basic-types/strings.vala b/tests/basic-types/strings.vala index 219dde7c8..e1aa55ff1 100644 --- a/tests/basic-types/strings.vala +++ b/tests/basic-types/strings.vala @@ -62,6 +62,11 @@ void test_string_joinv () { assert (s == ""); } +void test_string_printf () { + string s = "%i %s %u %.4f".printf (42, "foo", 4711U, 3.1415); + assert (s == "42 foo 4711 3.1415"); +} + void test_string_replace () { string s = "hellomyworld"; @@ -132,6 +137,7 @@ void test_string_substring () { void main () { test_string (); test_string_joinv (); + test_string_printf (); test_string_replace (); test_string_slice (); test_string_splice (); diff --git a/tests/posix/string-printf.vala b/tests/posix/string-printf.vala new file mode 100644 index 000000000..a8c62c384 --- /dev/null +++ b/tests/posix/string-printf.vala @@ -0,0 +1,4 @@ +void main () { + string s = "%i %s %u %.4f".printf (42, "foo", 4711U, 3.1415); + assert (s == "42 foo 4711 3.1415"); +} |