For tests, functions should indicate which version of Bash they work with
Opened this issue · 0 comments
housni commented
During testing, we need test against various versions of Bash (#18).
Some of Sheldons functions will work on older versions of Bash.
For the tests, we should be able to specify which function can be tested against a particular Bash version so that we can even test on older versions of Bash to show users what functions can be used in which version of Bash.
I'm thinking of something along the lines of a comment at the top of a function like:
.
.
.
## @returns Strings in $2 with the glue string, $1.
## @compatibility 3.2+
################################################################################
Sheldon.Util.String.join() {
local trim
.
.
.
When running tests:
- Docker container, which runs the test, should have an env var indicating Bash version
- Parse file and match pattern:
^Sheldon.<camel cap dir name>.<camel cap basename>.+\(\)\s\{$
- Read lines above until
@compatibility [0-9](\.[0-9]{2}[\+<>=]{2})$
is found - If matched version is equal to or greater than Docker's Bash version, run the test. Else skip while notifying user of incompatibility.