From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4969415806E for ; Wed, 7 Jun 2023 11:13:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8B3FCE0885; Wed, 7 Jun 2023 11:13:40 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 742DBE0885 for ; Wed, 7 Jun 2023 11:13:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A04FB335D80 for ; Wed, 7 Jun 2023 11:13:39 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A2234A8C for ; Wed, 7 Jun 2023 11:13:36 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1686136373.17aa01321a250b99fa487e8be430d71a459e75e6.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: test-functions X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 17aa01321a250b99fa487e8be430d71a459e75e6 X-VCS-Branch: master Date: Wed, 7 Jun 2023 11:13:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f1c9e340-a1e6-4854-a62c-358688b2ce69 X-Archives-Hash: c43a2d299ef17eb04ddba61046861952 commit: 17aa01321a250b99fa487e8be430d71a459e75e6 Author: Kerin Millar plushkava net> AuthorDate: Mon Jun 5 02:42:26 2023 +0000 Commit: Sam James gentoo org> CommitDate: Wed Jun 7 11:12:53 2023 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=17aa0132 test-functions: Add a test for the is_identifier() function Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> test-functions | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) 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