summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2023-06-05 03:42:26 +0100
committerSam James <sam@gentoo.org>2023-06-07 12:12:53 +0100
commit17aa01321a250b99fa487e8be430d71a459e75e6 (patch)
tree57dce2dc90bd23b42411eb4cd717865d0eb000a9
parentAdd and integrate the _update_winsize() function (diff)
downloadgentoo-functions-17aa01321a250b99fa487e8be430d71a459e75e6.tar.gz
gentoo-functions-17aa01321a250b99fa487e8be430d71a459e75e6.tar.bz2
gentoo-functions-17aa01321a250b99fa487e8be430d71a459e75e6.zip
test-functions: Add a test for the is_identifier() function
Signed-off-by: Kerin Millar <kfm@plushkava.net> Signed-off-by: Sam James <sam@gentoo.org>
-rwxr-xr-xtest-functions56
1 files changed, 56 insertions, 0 deletions
diff --git a/test-functions b/test-functions
index 2c1fa67..892a255 100755
--- a/test-functions
+++ b/test-functions
@@ -160,6 +160,61 @@ test_esyslog() {
iterate_tests 5 "$@"
}
+test_is_identifier() {
+ set -- \
+ 1 '' \
+ 1 _ \
+ 1 0 \
+ 1 0a \
+ 1 0Z \
+ 1 9 \
+ 1 9a \
+ 1 9Z \
+ 1 /a \
+ 1 /Z \
+ 1 .a \
+ 1 .Z \
+ 1 [a \
+ 1 [Z \
+ 1 '`a' \
+ 1 '`Z' \
+ 1 {a \
+ 1 {Z \
+ 1 '|a' \
+ 1 '|Z' \
+ 1 a/ \
+ 1 Z/ \
+ 1 a. \
+ 1 Z. \
+ 1 a[ \
+ 1 Z[ \
+ 1 'a`' \
+ 1 'Z`' \
+ 1 a{ \
+ 1 Z{ \
+ 1 'a|' \
+ 1 'Z|' \
+ 0 a \
+ 0 Z \
+ 0 __ \
+ 0 _a \
+ 0 _Z \
+ 0 a_ \
+ 0 Z_ \
+ 0 a_a \
+ 0 a_Z \
+ 0 Z_a \
+ 0 Z_Z
+
+ callback() {
+ shift
+ test_description="is_identifier $(print_args "$@")"
+ is_identifier "$@"
+ }
+
+ iterate_tests 2 "$@"
+}
+
test_is_int() {
set -- \
1 N/A \
@@ -287,6 +342,7 @@ rc=0
test_is_older_than || rc=1
test_get_bootparam || rc=1
test_esyslog || rc=1
+test_is_identifier || rc=1
test_is_int || rc=1
test_yesno || rc=1
cleanup_tmpdir