comparison 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
comparison
equal deleted inserted replaced
717:f4725ad5cd21 718:2502e077d5e9
88 2 88 2
89 $ falist_print_length LIST 89 $ falist_print_length LIST
90 2 (no-eol) 90 2 (no-eol)
91 91
92 $ falist_set LIST K2 "V2 2" 92 $ falist_set LIST K2 "V2 2"
93 $ falist_set_unique LIST K2 "V2 duplicate"
94 [1]
93 $ falist_set LIST K3 $'" 111222333" \\\'444555 ' # ' 95 $ falist_set LIST K3 $'" 111222333" \\\'444555 ' # '
94 $ falist_debug LIST 96 $ falist_debug LIST
95 DEBUG: alist `LIST' has length 3 97 DEBUG: alist `LIST' has length 3
96 DEBUG: `K1' -> `V1' 98 DEBUG: `K1' -> `V1'
97 DEBUG: `K2' -> `V2 2' 99 DEBUG: `K2' -> `V2 2'
115 [1] 117 [1]
116 $ _var="$(falist_print_length NON_EXISTING_LIST)" 118 $ _var="$(falist_print_length NON_EXISTING_LIST)"
117 ERROR: object `NON_EXISTING_LIST' not created properly: token empty 119 ERROR: object `NON_EXISTING_LIST' not created properly: token empty
118 $ echo "${_var}" 120 $ echo "${_var}"
119 -1 121 -1
120 122 $ falist_set_unique LIST K4 "V4"
123 $ falist_debug LIST
124 DEBUG: alist `LIST' has length 4
125 DEBUG: `K1' -> `V1'
126 DEBUG: `K2' -> `V2 2'
127 DEBUG: `K3' -> `" 111222333" \'444555 '
128 DEBUG: `K4' -> `V4'
121 $ falist_destroy LIST 129 $ falist_destroy LIST
122 $ check_no_alist_artifacts 130 $ check_no_alist_artifacts
123 131
124 132
125 Iteration 133 Iteration