diff tests/farray-alist.t @ 746:7e2279d6db0f

farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 08 Oct 2024 18:11:24 +0200
parents a5918c859fe9
children 4101e755b3e7
line wrap: on
line diff
--- a/tests/farray-alist.t	Tue Oct 08 17:55:23 2024 +0200
+++ b/tests/farray-alist.t	Tue Oct 08 18:11:24 2024 +0200
@@ -122,6 +122,19 @@
   V1
   $ falist_tryget _i LIST K
   [1]
+
+  $ falist_get _var LIST K2 _idx
+  $ echo "$_var"
+  V2 2
+  $ echo "$_idx"
+  2
+  $ falist_tryget _var LIST K1 _idx
+  $ echo "$_var"
+  V1
+  $ echo "$_idx"
+  1
+  $ falist_tryget _i LIST K _idx
+  [1]
   $ _var="$(falist_print_length NON_EXISTING_LIST)"
   ERROR: object `NON_EXISTING_LIST' not created properly: token empty
   $ echo "${_var}"