]> git.corax.cc Git - toolbox/commitdiff
toolbox: Allow inclusion of test modules when running in shellspec
authorMatthias Kruk <m@m10k.eu>
Tue, 14 Feb 2023 03:08:17 +0000 (12:08 +0900)
committerMatthias Kruk <m@m10k.eu>
Tue, 14 Feb 2023 03:08:17 +0000 (12:08 +0900)
Toolbox fails to set the module search paths correctly when running
in shellspec, rendering test cases unable to include modules from
test/include.

This commit modifies toolbox to prepend test/include to the module
search path array when executed in shellspec.

toolbox.sh

index f8549e248538ece03df57aa24cb423346405c974..f035042ef319e1039dd30bbfe8bc4d8b8fdf05f2 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # toolbox.sh - Framework for modular bash scripts
-# Copyright (C) 2021-2022 Matthias Kruk
+# Copyright (C) 2021-2023 Matthias Kruk
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -38,6 +38,7 @@ __toolbox_init() {
        declare -gxr TOOLBOX_PATH="$toolboxroot"
        declare -gxr TOOLBOX_HOME="$HOME/.toolbox"
        declare -axgr __TOOLBOX_MODULEPATH=(
+               ${SHELLSPEC_PROJECT_ROOT:+"$SHELLSPEC_PROJECT_ROOT/test/include"}
                "$scriptroot/include"
                "$TOOLBOX_HOME/include"
                "$toolboxroot/include"