Skip to content

eviweb/shell-testlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shell Testlib

this library aims to provide some facilities to write shell unit tests.

Health status

Travis CI - Build Status Github - Last tag

Installation

from within your project directory, run:
git submodule add --name shell-testlib https://github.com/eviweb/shell-testlib lib/shell-testlib

Usage

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 ####

Libraries

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

Loading considerations

the load library gives you the choice to:

load one unique file

loadFile "/path/to/my/file"
### OR ###
load "/path/to/my/file"

load many files

by using some filtering patterns

load "/path/to/some/files/*-suffix.ext"

use a provided library

please note that:

  • path are relative from the ./lib/shell-testlib/src directory
  • no need to specify the file extension.
use "file" # to load the file library
### OR ###
use "*" # to load all libraries

by loading a file we mean source it.
this way the running shell environment is kept.

A shell development stack

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.

License

this project is licensed under the terms of the MIT License

About

facilities that should help in writing shell unit tests

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages