mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-02-15 20:52:40 +00:00
test: fix typos and incorrect hook usage in spec files
- Fix 'yot' → 'yet' typos in test/spec/03.example_spec.sh - Fix 'Sometime' → 'Sometimes' and cpunum.sh references in test/spec/22.sourcced_spec.sh - Fix Before → After in after hook section of test/spec/07.before_after_hook_spec.sh - Improve wording and capitalization throughout hook spec file All 61 tests still passing after corrections. Addresses PR #1 review comments from Copilot and CodeRabbit.
This commit is contained in:
@@ -16,11 +16,11 @@ Describe 'example example'
|
|||||||
The output should eq 'baz'
|
The output should eq 'baz'
|
||||||
End
|
End
|
||||||
|
|
||||||
Example 'this is "Not yot implemented" example block'
|
Example 'this is "Not yet implemented" example block'
|
||||||
:
|
:
|
||||||
End
|
End
|
||||||
|
|
||||||
Todo 'what to do' # same as "Not yot implemented" example but not block
|
Todo 'what to do' # same as "Not yet implemented" example but not block
|
||||||
|
|
||||||
It 'not allows define "example group" in "example"'
|
It 'not allows define "example group" in "example"'
|
||||||
# Describe 'example group'
|
# Describe 'example group'
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# shellcheck shell=sh
|
# shellcheck shell=sh
|
||||||
|
|
||||||
# shellspec has Before and After hook.
|
# ShellSpec has Before and After hooks.
|
||||||
# Those hooks are execute for each example (It/Example/Specify).
|
# Those hooks are executed for each example (It/Example/Specify).
|
||||||
# There is no hooks execute for each example group (Describe/Context).
|
# There are no hooks executed for each example group (Describe/Context).
|
||||||
# In other words, There is no BeforeAll / AfterAll hooks. It is design policy.
|
# In other words, there are no BeforeAll / AfterAll hooks by design.
|
||||||
|
|
||||||
Describe 'before / after hook example'
|
Describe 'before / after hook example'
|
||||||
Describe '1: before hook'
|
Describe '1: before hook'
|
||||||
@@ -15,7 +15,7 @@ Describe 'before / after hook example'
|
|||||||
echo "$value"
|
echo "$value"
|
||||||
}
|
}
|
||||||
|
|
||||||
It 'is called before execute example'
|
It 'is called before executing the example'
|
||||||
When call add_value 10
|
When call add_value 10
|
||||||
The output should eq 20
|
The output should eq 20
|
||||||
End
|
End
|
||||||
@@ -46,7 +46,7 @@ Describe 'before / after hook example'
|
|||||||
|
|
||||||
echo_value() { echo "$value"; }
|
echo_value() { echo "$value"; }
|
||||||
|
|
||||||
It 'can also specify code instead of function'
|
It 'can also specify code instead of a function'
|
||||||
When call echo_value
|
When call echo_value
|
||||||
The output should eq 10
|
The output should eq 10
|
||||||
End
|
End
|
||||||
@@ -57,7 +57,7 @@ Describe 'before / after hook example'
|
|||||||
Before 'setup'
|
Before 'setup'
|
||||||
echo_ok() { echo ok; }
|
echo_ok() { echo ok; }
|
||||||
|
|
||||||
It 'is fails because before hook fails'
|
It 'fails because the before hook fails'
|
||||||
When call echo_ok
|
When call echo_ok
|
||||||
The output should eq 'ok'
|
The output should eq 'ok'
|
||||||
End
|
End
|
||||||
@@ -67,9 +67,9 @@ Describe 'before / after hook example'
|
|||||||
|
|
||||||
Describe '5: after hook'
|
Describe '5: after hook'
|
||||||
cleanup() { :; } # clean up something
|
cleanup() { :; } # clean up something
|
||||||
Before 'cleanup'
|
After 'cleanup'
|
||||||
|
|
||||||
It 'is called after execute example'
|
It 'is called after executing the example'
|
||||||
When call echo ok
|
When call echo ok
|
||||||
The output should eq 'ok'
|
The output should eq 'ok'
|
||||||
End
|
End
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# shellcheck shell=sh
|
# shellcheck shell=sh
|
||||||
|
|
||||||
# Sometime, functions are defined in a single shell script.
|
# Sometimes, functions are defined in a single shell script.
|
||||||
# You will want to test it. but you do not want to run the script.
|
# You will want to test it. but you do not want to run the script.
|
||||||
# You want to test only the function, right?
|
# You want to test only the function, right?
|
||||||
Describe 'sourced return example'
|
Describe 'sourced return example'
|
||||||
Include ./count_lines.sh
|
Include ./count_lines.sh
|
||||||
|
|
||||||
Example 'test cpunum.sh with stubbed cat /cpu/info'
|
Example 'test count_lines with stubbed data'
|
||||||
Data
|
Data
|
||||||
#|1
|
#|1
|
||||||
#|2
|
#|2
|
||||||
@@ -19,7 +19,7 @@ Describe 'sourced return example'
|
|||||||
The stdout should eq 5
|
The stdout should eq 5
|
||||||
End
|
End
|
||||||
|
|
||||||
Example 'test cpunum.sh with stubbed cat /cpu/info'
|
Example 'test count_lines with stubbed data'
|
||||||
Data data
|
Data data
|
||||||
data() {
|
data() {
|
||||||
%putsn "line1"
|
%putsn "line1"
|
||||||
|
|||||||
Reference in New Issue
Block a user