diff tests/farray-alist.t @ 718:2502e077d5e9

farray.sh: Implement "falist_set_unique()" that does not overwrite existing key-value pairs
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 04 Oct 2024 18:20:15 +0200
parents f4725ad5cd21
children b2757e72b517
line wrap: on
line diff
--- a/tests/farray-alist.t	Fri Oct 04 17:18:14 2024 +0200
+++ b/tests/farray-alist.t	Fri Oct 04 18:20:15 2024 +0200
@@ -90,6 +90,8 @@
   2 (no-eol)
 
   $ falist_set LIST K2 "V2 2"
+  $ falist_set_unique LIST K2 "V2 duplicate"
+  [1]
   $ falist_set LIST K3 $'" 111222333" \\\'444555 '    # '
   $ falist_debug LIST
   DEBUG: alist `LIST' has length 3
@@ -117,7 +119,13 @@
   ERROR: object `NON_EXISTING_LIST' not created properly: token empty
   $ echo "${_var}"
   -1
-
+  $ falist_set_unique LIST K4 "V4"
+  $ falist_debug LIST
+  DEBUG: alist `LIST' has length 4
+  DEBUG:     `K1' -> `V1'
+  DEBUG:     `K2' -> `V2 2'
+  DEBUG:     `K3' -> `" 111222333" \'444555 '
+  DEBUG:     `K4' -> `V4'
   $ falist_destroy LIST
   $ check_no_alist_artifacts