Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate tests/farray-object.t @ 726:23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
BUGS: No formal ownership management is done yet.
It is planned to implement resource management with reference counting.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 06 Oct 2024 16:19:45 +0200 |
| parents | |
| children | 858f4208d9cb |
| rev | line source |
|---|---|
|
726
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 Complex object tests of farray.sh |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
3 Shell is /bin/sh. |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
4 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
5 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
6 Setup |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
7 ===== |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
8 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
9 $ set -u |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
10 $ . "${TESTDIR}/testsetup.sh" |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
11 $ _p_datadir="${TESTDIR}/../share/local-bsdtools" |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
12 $ . "${_p_datadir}/farray.sh" |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
13 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
14 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
15 Array |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
16 ===== |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
17 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
18 $ farray_create ARRAY1 i1 i2 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 $ farray_create ITEM1 i11 i22 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
20 This also transfers ownership |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
21 $ farray_append ARRAY1 "$ITEM1" |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
22 $ ITEM1='' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
23 $ falist_create LIST2 k1 v1 k2 v2 k3 v3 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
24 This also transfers ownership |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
25 $ farray_append ARRAY1 "$LIST2" |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
26 $ LIST2='' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
27 $ farray_debug ARRAY1 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
28 DEBUG: array `ARRAY1' has length 4 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
29 DEBUG: its contents: |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
30 DEBUG: 1: `i1' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
31 DEBUG: 2: `i2' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
32 DEBUG: 3: --> |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
33 DEBUG: array with token `[a-f0-9]+' has length 2 (re) |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
34 DEBUG: its contents: |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
35 DEBUG: 1: `i11' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
36 DEBUG: 2: `i22' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
37 DEBUG: 4: --> |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
38 DEBUG: alist with token `[a-f0-9]+' has length 3 (re) |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
39 DEBUG: `k1' -> `v1' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
40 DEBUG: `k2' -> `v2' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
41 DEBUG: `k3' -> `v3' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
42 $ farray_destroy ARRAY1 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
43 $ check_no_array_artifacts |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
44 $ check_no_alist_artifacts |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
45 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
46 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
47 AList |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
48 ===== |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
49 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
50 $ falist_create LIST1 k1 v1 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
51 $ falist_create ITEM1 k11 v11 k22 v22 k33 v33 k44 v44 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
52 This also transfers ownership |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
53 $ falist_set LIST1 k2 "$ITEM1" |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
54 $ ITEM1='' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
55 $ farray_create ARRAY2 a1 a2 a3 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
56 This also transfers ownership |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
57 $ falist_set LIST1 k3 "$ARRAY2" |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
58 $ ARRAY2='' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
59 $ falist_debug LIST1 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
60 DEBUG: alist `LIST1' has length 3 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
61 DEBUG: `k1' -> `v1' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
62 DEBUG: `k2': --> |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
63 DEBUG: alist with token `[a-f0-9]+' has length 4 (re) |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
64 DEBUG: `k11' -> `v11' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
65 DEBUG: `k22' -> `v22' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
66 DEBUG: `k33' -> `v33' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
67 DEBUG: `k44' -> `v44' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
68 DEBUG: `k3': --> |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
69 DEBUG: array with token `[a-f0-9]+' has length 3 (re) |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
70 DEBUG: its contents: |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
71 DEBUG: 1: `a1' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
72 DEBUG: 2: `a2' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
73 DEBUG: 3: `a3' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
74 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
75 $ falist_destroy LIST1 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
76 $ check_no_array_artifacts |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
77 $ check_no_alist_artifacts |
