Skip to content

Commit

Permalink
kdb: add test for external command specification
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes99 committed Jun 17, 2023
1 parent 2d54037 commit 0f7b532
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/shell/shell_recorder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ if (ENABLE_KDB_TESTING)
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/tutorial_wrapper/markdown_shell_recorder.sh"
"${CMAKE_CURRENT_BINARY_DIR}/tutorial_wrapper/markdown_shell_recorder.sh" @ONLY)

add_shell_recorder_test (cli/cli_external_spec.esr)
add_shell_recorder_test (cli/cli_get.esr)
add_shell_recorder_test (cli/cli_set.esr)
add_shell_recorder_test (db_changes.esr)
Expand Down
37 changes: 37 additions & 0 deletions tests/shell/shell_recorder/cli/cli_external_spec.esr
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Mountpoint: user:/tests/cli/external

< kdb set spec:/sw/elektra/kdb/#0/current/trash ""
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash external 1
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash bin "/path/to/trash.sh"
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash command "trash"
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash description "Move a file to trash"
< kdb set spec:/sw/elektra/kdb/#0/current/trash/file ""
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file description "The file that should be moved to trash"
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file args/index 0
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file args indexed
< kdb set spec:/sw/elektra/kdb/#0/current/trash/force ""
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force description "Delete the file directly"
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force opt f
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force opt/long force
< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/force opt/arg none

STDERR: .*trash\s+Move a file to trash.*
< kdb --help

STDERR: .*Usage: kdb trash \[OPTION...\] <file>.*file\s+The file that should be moved to trash.*
< kdb trash --help

< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash/file description "The file that will be moved to trash"

STDERR: .*Usage: kdb trash \[OPTION...\] <file>.*file\s+The file that will be moved to trash.*
< kdb trash --help

< kdb meta-set spec:/sw/elektra/kdb/#0/current/trash command "delete"

STDERR: .*delete\s+Move a file to trash.*
< kdb --help

STDERR: .*Usage: kdb delete \[OPTION...\] <file>.*file\s+The file that will be moved to trash.*
< kdb delete --help

< kdb rm -rf spec:/sw/elektra/kdb/#0/current/trash

0 comments on commit 0f7b532

Please sign in to comment.