Open ntnn opened 7 years ago
@ztombol You've written three libraries for bats so far, what do you think of a load mechanism like this?
Additionally I've read quite some issues and comments about loading helper files, but none seem to have fruited into anything other than the current load()
, which only sources in the same dir or absolute paths.
Additionally I'd like to know how heavy posix compliance weighs in. Since many features of bats are based on non-posix functionality (e.g. set +-E
/set +-T
) it doesn't make sense to use the slower [
builtin vs. the [[
keyword.
If POSIX-compliance is a long term goal I'll gladly push that to the branch.
The existing functionality of
load()
is preserved:Additionally an environment variable BATS_LIB_PATH can be defined to be source helper files from.
If BATS_LIB_PATH is empty the following locations are used:
Example usage:
/usr/lib/bats
The bats-support here is different than the load.bash found in the repository.
Currently a loading file is required, which sources the files in the directory, unless the library is a single file. To work around this I'll add a mechanism which sources all files in a directory, if the directory exists but no loading file is found.
Also, the last line of the error message shows the wrong location for
error.bash
.