Skip to content

Commit

Permalink
update testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
dev2718 authored and lawli3t committed Sep 15, 2021
1 parent 8a3fce9 commit b38a04c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion doc/tutorials/cascading.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ As we used a cascading key for our override link (`/tests/overrides/test`) we ca

```sh
kdb set /tests/overrides/test "hello user"
# STDOUT-REGEX: .+(Create a new key.+|Set string to) "hello user"
#> Set string to "hello user"
#> Using name system:/tests/overrides/test
kdb get /tests/tutorial/cascading/#0/current/test
#> hello user
```
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/blacklist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The package is called `libelektra5-extra`.
## Examples

```sh
sudo kdb mount blacklist.ecf user:/tests/blacklist blacklist
sudo kdb mount blacklist.ecf /tests/blacklist blacklist

# valid initial value + setup valid blacklist list
kdb set user:/tests/blacklist ""
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/conditionals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ kdb set user:/tests/conditionals/fkey 3.0
kdb set user:/tests/conditionals/hkey hello

# will succeed
kdb meta-set spec:/tests/conditionals/key check/condition "(../hkey == 'hello') ? (../fkey == '3.0')"
kdb meta-set user:/tests/conditionals/key check/condition "(../hkey == 'hello') ? (../fkey == '3.0')"

# will fail
kdb meta-set spec:/tests/conditionals/key check/condition "(../hkey == 'hello') ? (../fkey == '5.0')"
kdb meta-set user:/tests/conditionals/key check/condition "(../hkey == 'hello') ? (../fkey == '5.0')"
# RET:5
# ERROR:C03200
```
Expand All @@ -92,7 +92,7 @@ Assignment example:

```sh
kdb set user:/tests/conditionals/hkey Hello
kdb meta-set spec:/tests/conditionals/hkey assign/condition "(./ == 'Hello') ? ('World')"
kdb meta-set user:/tests/conditionals/hkey assign/condition "(./ == 'Hello') ? ('World')"
# alternative syntax: "(../hkey == 'Hello') ? ('World')

kdb get user:/tests/conditionals/hkey
Expand Down Expand Up @@ -124,15 +124,15 @@ echo "check/condition=(./ == 'val1') ? (../sub/key == 'true')" >> `kdb file syst
echo "key=false" > `kdb file system:/tests/conditionals/sub`

# should fail and yield an error
kdb export /tests/conditionals ni
kdb export system:/tests/conditionals ni
# ERROR:C03200
# Sorry, module conditionals issued the error C03200:
# Validation failed: Validation of Key key1: (./ == 'val1') ? (../sub/key == 'true') failed. ((../sub/key == 'true') failed)

kdb set /tests/conditionals/sub/key true
kdb set system:/tests/conditionals/sub/key true

# should succeed
kdb export /tests/conditionals ni
kdb export system:/tests/conditionals ni

# cleanup
kdb rm -r /tests/conditionals
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/line/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ kdb ls user:/tests/line
# STDOUT-REGEX: line.+line/#0.+line/#1.+line/#2

kdb set user:/tests/line/#1 huhu
# STDOUT-REGEX: .+Set string to "huhu"
# STDOUT-REGEX: Set string to "huhu"

kdb export user:/tests/line line
#> something
Expand Down Expand Up @@ -124,6 +124,6 @@ awk '{print NR-1 "-" $0}' < `kdb file user:/tests/line`
#> 8-setting4 -1

# cleanup
kdb rm -r /tests/line
kdb rm -r user:/tests/line
sudo kdb umount /tests/line
```
6 changes: 3 additions & 3 deletions src/plugins/range/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ kdb set user:/tests/range/value 11
kdb set user:/tests/range/value "\-1"
# RET:5

# we can also allow only individual values:
kdb meta-set spec:/tests/range/value check/range "1,2,4,8"
# we can also allow only individual values: (using the --force flag, as the current value of 5 would not be allowed under the new policy)
kdb meta-set -f spec:/tests/range/value check/range "1,2,4,8"

kdb set user:/tests/range/value 7
# RET:5

kdb set user:/tests/range/value 2
# RET:0

kdb rm -r /tests/range
kdb rm -r user:/tests/range
sudo kdb umount /tests/range
```

Expand Down

0 comments on commit b38a04c

Please sign in to comment.