diff tests/farray-alist.t @ 745:a5918c859fe9

farray.sh: Implement falist_find() -- a variant of falist_contains() that also returns the found index proper
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 08 Oct 2024 17:55:23 +0200
parents 6fcf7da87981
children 7e2279d6db0f
line wrap: on
line diff
--- a/tests/farray-alist.t	Tue Oct 08 16:11:52 2024 +0200
+++ b/tests/farray-alist.t	Tue Oct 08 17:55:23 2024 +0200
@@ -74,8 +74,8 @@
   $ check_no_alist_artifacts
 
 
-Get / Set / Contains
-====================
+Get / Set / Contains / Find Index
+=================================
 
   $ falist_create LIST
   $ falist_set LIST K1 V1
@@ -108,8 +108,12 @@
   3 (no-eol)
 
   $ falist_contains LIST K1
+  $ falist_find idx LIST K1
+  $ test "$idx" -eq 1
   $ falist_contains LIST K
   [1]
+  $ falist_find idx LIST K
+  [1]
   $ falist_get _var LIST K2
   $ echo "$_var"
   V2 2