File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ bash_object.traverse-set() {
11
11
local filter=" $3 "
12
12
local final_value=" $4 "
13
13
14
- # TODO: test this
15
- if bash_object.ensure.variable_does_exist " $final_value " ; then : ; else
16
- return
14
+ # TODO: test, old versions of bash
15
+ if [[ ! -v 4 ]]; then
16
+ bash_object.util.die ' ERROR_INTERNAL_MISCELLANEOUS' " final_value is empty"
17
+ return
17
18
fi
18
19
19
20
# Start traversing at the root object
@@ -57,6 +58,11 @@ bash_object.traverse-set() {
57
58
# If we are at the last element in the query
58
59
elif (( i+ 1 == ${# REPLIES[@]} )) ; then
59
60
if [ " $final_value_type " = object ]; then
61
+ # TODO: test this
62
+ if bash_object.ensure.variable_does_exist " $final_value " ; then : ; else
63
+ return
64
+ fi
65
+
60
66
local oldIFS=" $IFS "
61
67
IFS=' _'
62
68
local filter_stack_string=" ${filter_stack[*]} "
@@ -90,6 +96,11 @@ bash_object.traverse-set() {
90
96
globel_object[" $key " ]=" ${object_to_copy_from["$key"]} "
91
97
done
92
98
elif [ " $final_value_type " = array ]; then
99
+ # TODO: test this
100
+ if bash_object.ensure.variable_does_exist " $final_value " ; then : ; else
101
+ return
102
+ fi
103
+
93
104
local oldIFS=" $IFS "
94
105
IFS=' _'
95
106
local filter_stack_string=" ${filter_stack[*]} "
Original file line number Diff line number Diff line change 3
3
load ' ./util/init.sh'
4
4
5
5
@test " Error if random variable already exists" {
6
+ declare -gA objj=()
7
+
6
8
bash_object.util.generate_vobject_name () {
7
9
REPLY=" some_other_var"
8
10
}
9
11
declare -g some_other_var=
10
12
11
- run bash_object.traverse-set object ' OBJECT' ' .obj' obj
13
+ run bash_object.traverse-set object ' OBJECT' ' .obj' objj
12
14
13
15
assert_failure
14
16
assert_output -p ' ERROR_INTERNAL_MISCELLANEOUS'
You can’t perform that action at this time.
0 commit comments