File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -47,3 +47,27 @@ load './util/init.sh'
47
47
assert_line -p " ERROR_ARGUMENTS_INCORRECT_TYPE"
48
48
assert_line -p " Cannot index an array with a non-integer"
49
49
}
50
+
51
+ # misc
52
+ @test " Correctly indexes an object with a number string" {
53
+ declare -A OBJECT=()
54
+
55
+ bobject set-object --value ' OBJECT' ' .["2"]' -- keyy valuee a b
56
+ bobject set-array --value ' OBJECT' ' .["3"]' -- one two three
57
+ bobject set-string --value ' OBJECT' ' .["4"]' -- zeta
58
+
59
+ bobject get-object --value ' OBJECT' ' .["2"]'
60
+ local keys=(" ${! REPLY[@]} " )
61
+ assert [ " ${# REPLY[@]} " = 2 ]
62
+ assert [ " ${keys[0]} " = ' keyy' ]
63
+ assert [ " ${keys[1]} " = ' a' ]
64
+
65
+ bobject get-array --value ' OBJECT' ' .["3"]'
66
+ assert [ ${# REPLY[@]} -eq 3 ]
67
+
68
+ bobject get-string --value ' OBJECT' ' .["3"].[0]'
69
+ assert [ " $REPLY " = ' one' ]
70
+
71
+ bobject get-string --value ' OBJECT' ' .["4"]'
72
+ assert [ " $REPLY " = ' zeta' ]
73
+ }
You can’t perform that action at this time.
0 commit comments