Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For tests, functions should indicate which version of Bash they work with #19

Open
housni opened this issue Aug 30, 2018 · 0 comments
Open

Comments

@housni
Copy link
Owner

housni commented Aug 30, 2018

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:

  1. Docker container, which runs the test, should have an env var indicating Bash version
  2. Parse file and match pattern: ^Sheldon.<camel cap dir name>.<camel cap basename>.+\(\)\s\{$
  3. Read lines above until @compatibility [0-9](\.[0-9]{2}[\+<>=]{2})$ is found
  4. If matched version is equal to or greater than Docker's Bash version, run the test. Else skip while notifying user of incompatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant