tests: add shellspec spec file

This commit is contained in:
Khaïs COLIN 2025-02-06 15:13:34 +01:00
parent 6aabe49df1
commit e022ca0ce7
No known key found for this signature in database
4 changed files with 59 additions and 1 deletions

13
spec/minishell_spec.sh Normal file
View file

@ -0,0 +1,13 @@
It "echos output"
Data
#|hello
#|there
End
When call ./minishell
The output line 1 should eq "hello"
The output line 2 should eq "hello"
The output line 3 should eq "there"
The output line 4 should eq "there"
The output line 5 should be undefined
End

24
spec/spec_helper.sh Normal file
View file

@ -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'
}