Skip to content

Commit 2fb470a

Browse files
committed
docs: Fix code in readme
The code still breaks in other ways due to unimplemented features
1 parent 4182afe commit 2fb470a

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,32 @@ In the coming days, I will release never seen before parsers written in Bash cal
2222
# }
2323

2424
declare -A root_object=()
25-
declare -A zulu_object([yankee]=)
25+
declare -A zulu_object=([yankee]=)
2626
declare -A yankee_object=([xray]=)
27-
declare -A xray_object([whiskey]=victor [foxtrot]=)
27+
declare -A xray_object=([whiskey]=victor [foxtrot]=)
2828
declare -a foxtrot_array=(omicron pi rho sigma)
2929

3030
bobject set-object root_object '.zulu' zulu_object
3131
bobject set-object root_object '.zulu.yankee' yankee_object
3232
bobject set-object root_object '.zulu.yankee.xray' xray_object
3333
bobject set-array root_object '.zulu.yankee.xray.foxtrot' foxtrot_array
3434

35-
bobject get-string '.zulu.yankee.xray.whiskey'
35+
bobject get-object root_object '.zulu.yankee.xray'
36+
assert [ "${REPLY[whiskey]}" = victor ]
37+
38+
bobject get-string root_object '.zulu.yankee.xray.whiskey'
3639
assert [ "$REPLY" = victor ]
3740

38-
bobject get-array '.zulu.yankee.xray.victor'
41+
bobject get-array root_object '.zulu.yankee.xray.victor'
3942
assert [ ${#REPLY} -eq 4 ]
4043

41-
bobject get-string '.["zulu"].["yankee"].["xray"].["victor"].[2]'
44+
bobject get-string root_object '.["zulu"].["yankee"].["xray"].["victor"].[2]'
4245
assert [ "$REPLY" = rho ]
4346
```
4447

4548
## Installation
4649

47-
STATUS: IN DEVELOPMENT! (right now, there are _many_ known bugs)
50+
STATUS: IN DEVELOPMENT!
4851

4952
```sh
5053
# With bpm (highly recommended)

tests/e2e.bats

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,28 @@ load './util/init.sh'
7171

7272
assert [ "$REPLY" = 'MEOW' ]
7373
}
74+
75+
@test "readme code works" {
76+
declare -A root_object=()
77+
declare -A zulu_object=([yankee]=)
78+
declare -A yankee_object=([xray]=)
79+
declare -A xray_object=([whiskey]=victor [foxtrot]=)
80+
declare -a foxtrot_array=(omicron pi rho sigma)
81+
82+
bobject set-object root_object '.zulu' zulu_object
83+
bobject set-object root_object '.zulu.yankee' yankee_object
84+
bobject set-object root_object '.zulu.yankee.xray' xray_object
85+
bobject set-array root_object '.zulu.yankee.xray.foxtrot' foxtrot_array
86+
87+
bobject get-object root_object '.zulu.yankee.xray'
88+
assert [ "${REPLY[whiskey]}" = victor ]
89+
90+
bobject get-string root_object '.zulu.yankee.xray.whiskey'
91+
assert [ "$REPLY" = victor ]
92+
93+
bobject get-array root_object '.zulu.yankee.xray.victor'
94+
assert [ ${#REPLY} -eq 4 ]
95+
96+
bobject get-string root_object '.["zulu"].["yankee"].["xray"].["victor"].[2]'
97+
assert [ "$REPLY" = rho ]
98+
}

0 commit comments

Comments
 (0)