diff tests/farray-alist.t @ 651:57ee25cec0dd

farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists. The rules are as in Python: non-empty arrays/alists are truish, empty arrays/alists are falsy.
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 27 Sep 2024 22:45:45 +0200
parents 454ce7fa25c8
children 36d953791e0c
line wrap: on
line diff
--- a/tests/farray-alist.t	Fri Sep 27 21:23:19 2024 +0200
+++ b/tests/farray-alist.t	Fri Sep 27 22:45:45 2024 +0200
@@ -25,6 +25,8 @@
   $ falist_print_length LIST
   0 (no-eol)
 
+  $ falist_istrue LIST
+  [1]
   $ falist_debug LIST
   DEBUG: alist `LIST' has length 0
 
@@ -40,7 +42,10 @@
 =====
 
   $ falist_create LIST
+  $ falist_istrue LIST
+  [1]
   $ falist_set LIST K1 V1
+  $ falist_istrue LIST
   $ falist_set LIST K2 V2
   $ falist_debug LIST
   DEBUG: alist `LIST' has length 2
@@ -56,10 +61,15 @@
   $ falist_length _i LIST
   $ echo "$_i"
   0
+  $ falist_istrue LIST
+  [1]
   $ falist_print_length LIST
   0 (no-eol)
 
   $ falist_destroy LIST
+  $ falist_istrue LIST
+  ERROR: falist `LIST' not created properly: token empty
+  [1]
   $ check_no_alist_artifacts