Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate tests/farray-alist.t @ 716:36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 04 Oct 2024 15:45:51 +0200 |
| parents | 57ee25cec0dd |
| children | f4725ad5cd21 |
| rev | line source |
|---|---|
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 Basic tests of farray.sh's falist_XXX functions |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
3 Shell is /bin/sh. |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
4 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
5 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
6 Setup |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
7 ===== |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
8 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
9 $ set -u |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
10 $ . "${TESTDIR}/testsetup.sh" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
11 $ _p_datadir="${TESTDIR}/../share/local-bsdtools" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
12 $ . "${_p_datadir}/farray.sh" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
13 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
14 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
15 Basic Creation and Destruction |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
16 ============================== |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
17 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
18 Create an empty alist |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
20 $ falist_create LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
21 $ falist_length _i LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
22 $ echo "$_i" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
23 0 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
24 $ test "${_i}" -eq 0 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
25 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
26 0 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
27 |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
28 $ falist_istrue LIST |
|
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
29 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
30 $ falist_debug LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
31 DEBUG: alist `LIST' has length 0 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
32 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
33 $ falist_destroy LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
34 $ ( falist_destroy LIST ) |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
35 ERROR: object `LIST' not created properly: token empty |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
36 [1] |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
37 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
38 $ check_no_alist_artifacts |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
39 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
40 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
41 Clear |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
42 ===== |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
43 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
44 $ falist_create LIST |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
45 $ falist_istrue LIST |
|
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
46 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
47 $ falist_set LIST K1 V1 |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
48 $ falist_istrue LIST |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
49 $ falist_set LIST K2 V2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
50 $ falist_debug LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
51 DEBUG: alist `LIST' has length 2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
52 DEBUG: `K1' -> `V1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
53 DEBUG: `K2' -> `V2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
54 $ falist_length _i LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
55 $ echo "$_i" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
56 2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
57 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
58 2 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
59 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
60 $ falist_clear LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
61 $ falist_length _i LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
62 $ echo "$_i" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
63 0 |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
64 $ falist_istrue LIST |
|
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
65 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
66 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
67 0 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
68 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
69 $ falist_destroy LIST |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
70 $ falist_istrue LIST |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
71 ERROR: object `LIST' not created properly: token empty |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
72 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
73 $ check_no_alist_artifacts |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
74 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
75 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
76 Get / Set / Contains |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
77 ==================== |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
78 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
79 $ falist_create LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
80 $ falist_set LIST K1 V1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
81 $ falist_set LIST K2 V2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
82 $ falist_debug LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
83 DEBUG: alist `LIST' has length 2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
84 DEBUG: `K1' -> `V1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
85 DEBUG: `K2' -> `V2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
86 $ falist_length _i LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
87 $ echo "$_i" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
88 2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
89 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
90 2 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
91 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
92 $ falist_set LIST K2 "V2 2" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
93 $ falist_set LIST K3 $'" 111222333" \\\'444555 ' # ' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
94 $ falist_debug LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
95 DEBUG: alist `LIST' has length 3 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
96 DEBUG: `K1' -> `V1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
97 DEBUG: `K2' -> `V2 2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
98 DEBUG: `K3' -> `" 111222333" \'444555 ' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
99 $ falist_length _i LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
100 $ echo "$_i" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
101 3 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
102 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
103 3 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
104 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
105 $ falist_contains LIST K1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
106 $ falist_contains LIST K |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
107 [1] |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
108 $ falist_get _var LIST K2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
109 $ echo "$_var" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
110 V2 2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
111 $ falist_tryget _var LIST K1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
112 $ echo "$_var" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
113 V1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
114 $ falist_tryget _i LIST K |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
115 [1] |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
116 $ _var="$(falist_print_length NON_EXISTING_LIST)" |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
117 ERROR: object `NON_EXISTING_LIST' not created properly: token empty |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
118 $ echo "${_var}" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
119 -1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
120 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
121 $ falist_destroy LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
122 $ check_no_alist_artifacts |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
123 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
124 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
125 Iteration |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
126 ========= |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
127 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
128 ITERATE (manual indexing) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
129 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
130 $ falist_create LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
131 $ falist_set LIST K1 V1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
132 $ falist_set LIST K2 "V2 2" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
133 $ falist_set LIST K3 $'" 111222333" \\\'444555 ' # ' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
134 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
135 Iteration by indexing key and values separately |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
136 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
137 $ _i=1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
138 > while falist_tryget_key_at_index _k LIST ${_i}; do |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
139 > # cannot fail under "normal" circumstances |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
140 > falist_tryget_value_at_index _v LIST ${_i} |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
141 > printf " KEY: \`%s', VAL: \`%s'\\n" "${_k}" "${_v}" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
142 > _i=$((_i + 1)) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
143 > done |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
144 KEY: `K1', VAL: `V1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
145 KEY: `K2', VAL: `V2 2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
146 KEY: `K3', VAL: `" 111222333" \'444555 ' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
147 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
148 ITERATE (manual indexing over items) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
149 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
150 $ _i=1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
151 > while falist_tryget_item_at_index _k _v LIST ${_i}; do |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
152 > printf " KEY: \`%s', VAL: \`%s'\\n" "${_k}" "${_v}" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
153 > _i=$((_i + 1)) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
154 > done |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
155 KEY: `K1', VAL: `V1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
156 KEY: `K2', VAL: `V2 2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
157 KEY: `K3', VAL: `" 111222333" \'444555 ' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
158 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
159 ITERATE (for each) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
160 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
161 $ falist_for_each LIST $'printf "EACH: %s key \\`%s\\\', value \\`%s\\\' at idx %d\\n"' # ` |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
162 EACH: LIST key `K1', value `V1' at idx 1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
163 EACH: LIST key `K2', value `V2 2' at idx 2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
164 EACH: LIST key `K3', value `" 111222333" \'444555 ' at idx 3 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
165 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
166 $ falist_clear LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
167 $ falist_destroy LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
168 $ falist_destroy LIST |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
169 ERROR: object `LIST' not created properly: token empty |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
170 [1] |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
171 |
|
606
0ad7b2120e74
farray.sh: tests: add forgotten check for left artifacts (memory leaks)
Franz Glasner <fzglas.hg@dom66.de>
parents:
605
diff
changeset
|
172 $ check_no_alist_artifacts |
|
0ad7b2120e74
farray.sh: tests: add forgotten check for left artifacts (memory leaks)
Franz Glasner <fzglas.hg@dom66.de>
parents:
605
diff
changeset
|
173 |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
174 |
|
607
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
175 Valid and Invalid Indices |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
176 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
177 $ falist_create LIST |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
178 $ falist_set LIST 'KEY 1' 'VAL 1' |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
179 $ falist_set LIST 'KEY 2' 'VAL 2' |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
180 $ falist_set LIST 'KEY 3' 'VAL 3' |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
181 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
182 $ (falist_tryget_item_at_index _k _v LIST "") |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
183 ERROR: missing index |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
184 [70] |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
185 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
186 $ (falist_tryget_item_at_index _k _v LIST) |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
187 ERROR: missing index |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
188 [70] |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
189 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
190 $ falist_tryget_item_at_index _k _v LIST 4 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
191 [1] |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
192 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
193 $ falist_tryget_item_at_index _k _v LIST 0 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
194 $ printf '%s:%s' "$_k" "$_v" |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
195 KEY 3:VAL 3 (no-eol) |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
196 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
197 $ falist_tryget_item_at_index _k _v LIST -2 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
198 $ printf '%s:%s' "$_k" "$_v" |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
199 KEY 1:VAL 1 (no-eol) |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
200 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
201 $ falist_tryget_item_at_index _k _v LIST -3 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
202 [1] |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
203 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
204 $ falist_destroy LIST |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
205 $ check_no_alist_artifacts |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
206 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
207 |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
208 Deletion of keys |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
209 ================ |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
210 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
211 $ falist_create LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
212 $ falist_set LIST 'key 1' 'value 1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
213 $ falist_set LIST 'key 2' 'value 2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
214 $ falist_set LIST 'key 3' 'value 3' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
215 $ falist_set LIST 'key 4' 'value 4' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
216 $ falist_set LIST 'key 5' 'value 5' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
217 $ falist_trydel LIST 'key 1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
218 $ falist_trydel LIST 'key 5' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
219 $ falist_trydel LIST 'key 3' |
|
605
96366e2075fe
farray.sh: enhance unittests for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
604
diff
changeset
|
220 $ falist_debug LIST |
|
96366e2075fe
farray.sh: enhance unittests for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
604
diff
changeset
|
221 DEBUG: alist `LIST' has length 2 |
|
96366e2075fe
farray.sh: enhance unittests for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
604
diff
changeset
|
222 DEBUG: `key 2' -> `value 2' |
|
96366e2075fe
farray.sh: enhance unittests for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
604
diff
changeset
|
223 DEBUG: `key 4' -> `value 4' |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
224 $ falist_trydel LIST "non-existing key" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
225 [1] |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
226 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
227 2 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
228 $ falist_get _var LIST 'key 2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
229 $ printf '%s' "$_var" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
230 value 2 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
231 $ falist_get _var LIST 'key 4' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
232 $ printf '%s' "$_var" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
233 value 4 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
234 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
235 $ falist_destroy LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
236 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
237 $ check_no_alist_artifacts |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
238 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
239 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
240 Compare |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
241 ======= |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
242 |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
243 $ falist_create LIST1 K1 V1 K2 V2 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
244 $ falist_debug LIST1 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
245 DEBUG: alist `LIST1' has length 2 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
246 DEBUG: `K1' -> `V1' |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
247 DEBUG: `K2' -> `V2' |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
248 |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
249 $ falist_create LIST2 K2 V2 K1 V1 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
250 $ falist_debug LIST2 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
251 DEBUG: alist `LIST2' has length 2 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
252 DEBUG: `K2' -> `V2' |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
253 DEBUG: `K1' -> `V1' |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
254 |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
255 $ falist_create LIST3 K1 V1 K2 V2 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
256 $ falist_debug LIST3 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
257 DEBUG: alist `LIST3' has length 2 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
258 DEBUG: `K1' -> `V1' |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
259 DEBUG: `K2' -> `V2' |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
260 |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
261 $ falist_create LIST4 K1 V1 K2 V2-4 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
262 $ falist_debug LIST4 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
263 DEBUG: alist `LIST4' has length 2 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
264 DEBUG: `K1' -> `V1' |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
265 DEBUG: `K2' -> `V2-4' |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
266 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
267 $ falist_are_equal LIST1 LIST2 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
268 $ falist_are_equal LIST1 LIST4 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
269 [1] |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
270 $ falist_are_equal_with_order LIST1 LIST2 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
271 [1] |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
272 $ falist_are_equal_with_order LIST1 LIST3 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
273 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
274 $ falist_clear LIST2 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
275 $ falist_are_equal LIST1 LIST2 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
276 [1] |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
277 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
278 $ falist_clear LIST3 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
279 $ falist_are_equal_with_order LIST2 LIST3 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
280 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
281 $ falist_destroy LIST1 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
282 $ falist_destroy LIST2 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
283 $ falist_destroy LIST3 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
284 $ falist_destroy LIST4 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
285 |
|
614
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
286 $ check_no_alist_artifacts |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
287 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
288 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
289 Updating |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
290 ======== |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
291 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
292 $ falist_create ARR "Key 1" "Value 1" "Key 2" 'Value 2 '\''' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
293 $ falist_create UPDATE1 "Key 1" "Value 1" "Key 2" 'Value 2 '\''' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
294 $ falist_create UPDATE2 "Key 2" 'Value 2 (Updated) '\''' "Key 3" "Value 3" |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
295 $ falist_create EMPTY |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
296 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
297 $ falist_are_equal_with_order ARR UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
298 $ falist_are_equal_with_order ARR UPDATE2 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
299 [1] |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
300 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
301 $ falist_update ARR UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
302 $ falist_are_equal_with_order ARR UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
303 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
304 $ falist_update ARR UPDATE2 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
305 $ falist_debug ARR |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
306 DEBUG: alist `ARR' has length 3 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
307 DEBUG: `Key 1' -> `Value 1' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
308 DEBUG: `Key 2' -> `Value 2 (Updated) '' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
309 DEBUG: `Key 3' -> `Value 3' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
310 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
311 Updating an into an empty alist is just a copy |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
312 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
313 $ falist_update EMPTY UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
314 $ falist_debug EMPTY |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
315 DEBUG: alist `EMPTY' has length 2 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
316 DEBUG: `Key 1' -> `Value 1' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
317 DEBUG: `Key 2' -> `Value 2 '' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
318 $ falist_debug UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
319 DEBUG: alist `UPDATE1' has length 2 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
320 DEBUG: `Key 1' -> `Value 1' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
321 DEBUG: `Key 2' -> `Value 2 '' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
322 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
323 $ falist_destroy ARR |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
324 $ falist_destroy UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
325 $ falist_destroy UPDATE2 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
326 $ falist_destroy EMPTY |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
327 |
|
615
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
328 $ check_no_alist_artifacts |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
329 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
330 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
331 Items / Keys / Values |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
332 ===================== |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
333 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
334 $ farray_create KEYS |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
335 $ farray_create VALUES |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
336 $ farray_create ITEMS |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
337 $ falist_create LIST "Key 1" "Value 1" "Key 2" 'Value 2 '\''' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
338 $ falist_items ITEMS LIST |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
339 $ farray_debug ITEMS |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
340 DEBUG: array `ITEMS' has length 4 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
341 DEBUG: its contents: |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
342 DEBUG: 1: `Key 1' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
343 DEBUG: 2: `Value 1' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
344 DEBUG: 3: `Key 2' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
345 DEBUG: 4: `Value 2 '' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
346 $ falist_keys KEYS LIST |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
347 $ farray_debug KEYS |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
348 DEBUG: array `KEYS' has length 2 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
349 DEBUG: its contents: |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
350 DEBUG: 1: `Key 1' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
351 DEBUG: 2: `Key 2' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
352 $ falist_values VALUES LIST |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
353 $ farray_debug VALUES |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
354 DEBUG: array `VALUES' has length 2 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
355 DEBUG: its contents: |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
356 DEBUG: 1: `Value 1' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
357 DEBUG: 2: `Value 2 '' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
358 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
359 $ falist_destroy LIST |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
360 $ farray_destroy KEYS |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
361 $ farray_destroy VALUES |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
362 $ farray_destroy ITEMS |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
363 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
364 $ check_no_alist_artifacts |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
365 |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
366 |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
367 Cross Type Checks |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
368 ================= |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
369 |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
370 $ falist_create LIST |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
371 $ (farray_append LIST value) |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
372 ERROR: object `LIST' is not an array |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
373 [70] |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
374 $ falist_destroy LIST |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
375 $ check_no_alist_artifacts |
