Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 745:a5918c859fe9 | 746:7e2279d6db0f |
|---|---|
| 119 V2 2 | 119 V2 2 |
| 120 $ falist_tryget _var LIST K1 | 120 $ falist_tryget _var LIST K1 |
| 121 $ echo "$_var" | 121 $ echo "$_var" |
| 122 V1 | 122 V1 |
| 123 $ falist_tryget _i LIST K | 123 $ falist_tryget _i LIST K |
| 124 [1] | |
| 125 | |
| 126 $ falist_get _var LIST K2 _idx | |
| 127 $ echo "$_var" | |
| 128 V2 2 | |
| 129 $ echo "$_idx" | |
| 130 2 | |
| 131 $ falist_tryget _var LIST K1 _idx | |
| 132 $ echo "$_var" | |
| 133 V1 | |
| 134 $ echo "$_idx" | |
| 135 1 | |
| 136 $ falist_tryget _i LIST K _idx | |
| 124 [1] | 137 [1] |
| 125 $ _var="$(falist_print_length NON_EXISTING_LIST)" | 138 $ _var="$(falist_print_length NON_EXISTING_LIST)" |
| 126 ERROR: object `NON_EXISTING_LIST' not created properly: token empty | 139 ERROR: object `NON_EXISTING_LIST' not created properly: token empty |
| 127 $ echo "${_var}" | 140 $ echo "${_var}" |
| 128 -1 | 141 -1 |
