Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison tests/farray-alist.t @ 651:57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
The rules are as in Python: non-empty arrays/alists are truish, empty
arrays/alists are falsy.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 27 Sep 2024 22:45:45 +0200 |
| parents | 454ce7fa25c8 |
| children | 36d953791e0c |
comparison
equal
deleted
inserted
replaced
| 650:5a367d44b480 | 651:57ee25cec0dd |
|---|---|
| 23 0 | 23 0 |
| 24 $ test "${_i}" -eq 0 | 24 $ test "${_i}" -eq 0 |
| 25 $ falist_print_length LIST | 25 $ falist_print_length LIST |
| 26 0 (no-eol) | 26 0 (no-eol) |
| 27 | 27 |
| 28 $ falist_istrue LIST | |
| 29 [1] | |
| 28 $ falist_debug LIST | 30 $ falist_debug LIST |
| 29 DEBUG: alist `LIST' has length 0 | 31 DEBUG: alist `LIST' has length 0 |
| 30 | 32 |
| 31 $ falist_destroy LIST | 33 $ falist_destroy LIST |
| 32 $ ( falist_destroy LIST ) | 34 $ ( falist_destroy LIST ) |
| 38 | 40 |
| 39 Clear | 41 Clear |
| 40 ===== | 42 ===== |
| 41 | 43 |
| 42 $ falist_create LIST | 44 $ falist_create LIST |
| 45 $ falist_istrue LIST | |
| 46 [1] | |
| 43 $ falist_set LIST K1 V1 | 47 $ falist_set LIST K1 V1 |
| 48 $ falist_istrue LIST | |
| 44 $ falist_set LIST K2 V2 | 49 $ falist_set LIST K2 V2 |
| 45 $ falist_debug LIST | 50 $ falist_debug LIST |
| 46 DEBUG: alist `LIST' has length 2 | 51 DEBUG: alist `LIST' has length 2 |
| 47 DEBUG: `K1' -> `V1' | 52 DEBUG: `K1' -> `V1' |
| 48 DEBUG: `K2' -> `V2' | 53 DEBUG: `K2' -> `V2' |
| 54 | 59 |
| 55 $ falist_clear LIST | 60 $ falist_clear LIST |
| 56 $ falist_length _i LIST | 61 $ falist_length _i LIST |
| 57 $ echo "$_i" | 62 $ echo "$_i" |
| 58 0 | 63 0 |
| 64 $ falist_istrue LIST | |
| 65 [1] | |
| 59 $ falist_print_length LIST | 66 $ falist_print_length LIST |
| 60 0 (no-eol) | 67 0 (no-eol) |
| 61 | 68 |
| 62 $ falist_destroy LIST | 69 $ falist_destroy LIST |
| 70 $ falist_istrue LIST | |
| 71 ERROR: falist `LIST' not created properly: token empty | |
| 72 [1] | |
| 63 $ check_no_alist_artifacts | 73 $ check_no_alist_artifacts |
| 64 | 74 |
| 65 | 75 |
| 66 Get / Set / Contains | 76 Get / Set / Contains |
| 67 ==================== | 77 ==================== |
