commit: 12eedb30ca60f0a7ae781b845d7bc22cc1b3267f
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Jun 5 03:01:43 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 7 11:12:53 2023 +0000
URL:
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=12eedb30
test-functions: Add a test for the _is_visible() function
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
test-functions | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/test-functions b/test-functions
index 72b5cae..b80587b 100755
--- a/test-functions
+++ b/test-functions
@@ -240,6 +240,26 @@ test_is_int() {
iterate_tests 2 "$@"
}
+test_is_visible() {
+ set -- \
+ 1 '' \
+ 1 ' ' \
+ 1 "$(printf '\t')" \
+ 1 "$(printf '\a')" \
+ 0 . \
+ 0 ' . ' \
+ 0 "$(printf '\t.\t')" \
+ 0 "$(printf '\a.\a')"
+
+ callback() {
+ shift
+ test_description="_is_visible $(print_args "$@")"
+ _is_visible "$@"
+ }
+
+ iterate_tests 2 "$@"
+}
+
test_yesno() {
set -- \
0 yes \
@@ -344,6 +364,7 @@ test_get_bootparam || rc=1
test_esyslog || rc=1
test_is_identifier || rc=1
test_is_int || rc=1
+test_is_visible || rc=1
test_yesno || rc=1
cleanup_tmpdir
exit "${rc}"