annotate tests/farray-object.t @ 768:53d05f470f4a

fpkg: Style
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 22 Oct 2024 11:48:39 +0200
parents 7ead30e3b2f9
children 03350d2a2af6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
732
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
19 $ fobject_type ARRAY1
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
20 array (no-eol)
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
21 $ farray_type ARRAY1
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
22 array (no-eol)
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
23 $ falist_type ARRAY1
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
24 array (no-eol)
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
25 $ 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
26 $ farray_append ARRAY1 "$ITEM1"
730
8f1583faf9ea farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents: 728
diff changeset
27 $ farray_release ITEM1
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
28 $ 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
29 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
30 $ farray_append ARRAY1 "$LIST2"
730
8f1583faf9ea farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents: 728
diff changeset
31 $ falist_release LIST2
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
32 $ 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
33 DEBUG: array `ARRAY1' has length 4
733
772e4999562b farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents: 732
diff changeset
34 DEBUG: the items:
726
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: `i1'
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: `i2'
733
772e4999562b farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents: 732
diff changeset
37 DEBUG: 3: >>>
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
38 DEBUG: array with token `[a-f0-9]+' has length 2 (re)
733
772e4999562b farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents: 732
diff changeset
39 DEBUG: the items:
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
40 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
41 DEBUG: 2: `i22'
733
772e4999562b farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents: 732
diff changeset
42 DEBUG: 4: >>>
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
43 DEBUG: alist with token `[a-f0-9]+' has length 3 (re)
733
772e4999562b farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents: 732
diff changeset
44 DEBUG: the items:
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
45 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
46 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
47 DEBUG: `k3' -> `v3'
730
8f1583faf9ea farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents: 728
diff changeset
48 $ farray_release ARRAY1
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
49 $ 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
50 $ 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
51
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
52
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
53 AList
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
54 =====
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
55
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
56 $ falist_create LIST1 k1 v1
732
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
57 $ fobject_type LIST1
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
58 alist (no-eol)
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
59 $ falist_type LIST1
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
60 alist (no-eol)
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
61 $ farray_type LIST1
d92e7203a14d farray.sh: an official function fobject_type() instead of an internal one
Franz Glasner <fzglas.hg@dom66.de>
parents: 730
diff changeset
62 alist (no-eol)
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
63 $ 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
64 $ falist_set LIST1 k2 "$ITEM1"
730
8f1583faf9ea farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents: 728
diff changeset
65 $ falist_release ITEM1
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
66 $ 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
67 $ falist_set LIST1 k3 "$ARRAY2"
730
8f1583faf9ea farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents: 728
diff changeset
68 $ farray_release ARRAY2
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
69 $ 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
70 DEBUG: alist `LIST1' has length 3
733
772e4999562b farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents: 732
diff changeset
71 DEBUG: the items:
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
72 DEBUG: `k1' -> `v1'
733
772e4999562b farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents: 732
diff changeset
73 DEBUG: `k2' -> >>>
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
74 DEBUG: alist with token `[a-f0-9]+' has length 4 (re)
733
772e4999562b farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents: 732
diff changeset
75 DEBUG: the items:
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
76 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
77 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
78 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
79 DEBUG: `k44' -> `v44'
733
772e4999562b farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents: 732
diff changeset
80 DEBUG: `k3' -> >>>
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
81 DEBUG: array with token `[a-f0-9]+' has length 3 (re)
733
772e4999562b farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents: 732
diff changeset
82 DEBUG: the items:
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
83 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
84 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
85 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
86
730
8f1583faf9ea farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents: 728
diff changeset
87 $ falist_release LIST1
726
23f6d2993fa2 farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
88 $ 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
89 $ check_no_alist_artifacts
758
7ead30e3b2f9 farray.sh: Check for typos in local variable names or missing "local" declarations for variables
Franz Glasner <fzglas.hg@dom66.de>
parents: 733
diff changeset
90
7ead30e3b2f9 farray.sh: Check for typos in local variable names or missing "local" declarations for variables
Franz Glasner <fzglas.hg@dom66.de>
parents: 733
diff changeset
91
7ead30e3b2f9 farray.sh: Check for typos in local variable names or missing "local" declarations for variables
Franz Glasner <fzglas.hg@dom66.de>
parents: 733
diff changeset
92 No Locals
7ead30e3b2f9 farray.sh: Check for typos in local variable names or missing "local" declarations for variables
Franz Glasner <fzglas.hg@dom66.de>
parents: 733
diff changeset
93 =========
7ead30e3b2f9 farray.sh: Check for typos in local variable names or missing "local" declarations for variables
Franz Glasner <fzglas.hg@dom66.de>
parents: 733
diff changeset
94
7ead30e3b2f9 farray.sh: Check for typos in local variable names or missing "local" declarations for variables
Franz Glasner <fzglas.hg@dom66.de>
parents: 733
diff changeset
95 $ check_no_local_artifacts