this library aims to provide some facilities to write shell unit tests.
from within your project directory, run:
git submodule add --name shell-testlib https://github.com/eviweb/shell-testlib lib/shell-testlib
source the boostrap file from ./lib/shell-testlib/bootstrap.sh, then use the loading utilities.
ie. from the root of your project it could be something like this:
#! /bin/bash
. "$(dirname $(readlink -f $BASH_SOURCE))/lib/shell-testlib/bootstrap.sh"
use "*" # this will load all the provided libraries
#### Do your stuff ####this package currently includes:
- command: utilities to deal with external commands
- envbuilder: utilities to manage your test environment (ie. create temp directories, change
$HOME, clean test directories...) - file: utilities to deal with files and directories
- load: loading facilities
the load library gives you the choice to:
loadFile "/path/to/my/file"
### OR ###
load "/path/to/my/file"by using some filtering patterns
load "/path/to/some/files/*-suffix.ext"please note that:
- path are relative from the
./lib/shell-testlib/srcdirectory - no need to specify the file extension.
use "file" # to load the file library
### OR ###
use "*" # to load all librariesby loading a file we mean source it.
this way the running shell environment is kept.
this project suits very well with the shunit2-support project, which should greatly help you to deal with creating unit tests for your shell projects.
this project is licensed under the terms of the MIT License