sxmo-utils: Add sxmo_status_spec.sh
Original patch: https://lists.sr.ht/~mil/sxmo-devel/patches/29204 Signed-off-by: Anjandev Momi <anjan@momi.ca>
This commit is contained in:
parent
093722e430
commit
86e3071033
|
@ -2,12 +2,16 @@ image: alpine/edge
|
|||
packages:
|
||||
- shellcheck
|
||||
- editorconfig-checker
|
||||
- shellspec
|
||||
sources:
|
||||
- https://git.sr.ht/~mil/sxmo-utils
|
||||
tasks:
|
||||
- shellcheck: |
|
||||
cd sxmo-utils
|
||||
shellcheck -x scripts/*/*.sh
|
||||
- shellspec: |
|
||||
cd sxmo-utils
|
||||
shellspec
|
||||
- editorconfig-check: |
|
||||
cd sxmo-utils
|
||||
ec
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
--require spec_helper
|
||||
|
||||
## Default kcov (coverage) options
|
||||
# --kcov-options "--include-path=. --path-strip-level=1"
|
||||
# --kcov-options "--include-pattern=.sh"
|
||||
# --kcov-options "--exclude-pattern=/.shellspec,/spec/,/coverage/,/report/"
|
||||
|
||||
## Example: Include script "myprog" with no extension
|
||||
# --kcov-options "--include-pattern=.sh,myprog"
|
||||
|
||||
## Example: Only specified files/directories
|
||||
# --kcov-options "--include-pattern=myprog,/lib/"
|
|
@ -0,0 +1,69 @@
|
|||
export SXMO_STATUS_NAME=test
|
||||
|
||||
Describe 'sxmo_status.sh'
|
||||
Include scripts/core/sxmo_status.sh
|
||||
|
||||
It 'reset the bar'
|
||||
When call reset
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'show a blank line'
|
||||
When call show
|
||||
The output should equal ''
|
||||
End
|
||||
|
||||
It 'add a foo component'
|
||||
When call add 1-foo 'foo'
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'show the foo with the foo component'
|
||||
When call show
|
||||
The output should equal 'foo'
|
||||
End
|
||||
|
||||
It 'add a bar second component'
|
||||
When call add 2-bar 'bar'
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'show the bar with the foo and bar components'
|
||||
When call show
|
||||
The output should equal 'foo bar'
|
||||
End
|
||||
|
||||
Data
|
||||
#|toot
|
||||
End
|
||||
|
||||
It 'add a toot third component from stdin'
|
||||
When call add 3-toot
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'show the bar with the foo, bar and toot components'
|
||||
When call show
|
||||
The output should equal 'foo bar toot'
|
||||
End
|
||||
|
||||
It 'del the bar second component'
|
||||
When call del 2-bar
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'show the bar with the foo and toot components'
|
||||
When call show
|
||||
The output should equal 'foo toot'
|
||||
End
|
||||
|
||||
It 'reset the bar'
|
||||
When call reset
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'show a blank line'
|
||||
When call show
|
||||
The output should equal ''
|
||||
End
|
||||
End
|
|
@ -0,0 +1,24 @@
|
|||
# shellcheck shell=sh
|
||||
|
||||
# Defining variables and functions here will affect all specfiles.
|
||||
# Change shell options inside a function may cause different behavior,
|
||||
# so it is better to set them here.
|
||||
# set -eu
|
||||
|
||||
# This callback function will be invoked only once before loading specfiles.
|
||||
spec_helper_precheck() {
|
||||
# Available functions: info, warn, error, abort, setenv, unsetenv
|
||||
# Available variables: VERSION, SHELL_TYPE, SHELL_VERSION
|
||||
: minimum_version "0.28.1"
|
||||
}
|
||||
|
||||
# This callback function will be invoked after a specfile has been loaded.
|
||||
spec_helper_loaded() {
|
||||
:
|
||||
}
|
||||
|
||||
# This callback function will be invoked after core modules has been loaded.
|
||||
spec_helper_configure() {
|
||||
# Available functions: import, before_each, after_each, before_all, after_all
|
||||
: import 'support/custom_matcher'
|
||||
}
|
Loading…
Reference in New Issue