Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eviweb/shell-testlib
facilities that should help in writing shell unit tests
https://github.com/eviweb/shell-testlib
Last synced: about 1 month ago
JSON representation
facilities that should help in writing shell unit tests
- Host: GitHub
- URL: https://github.com/eviweb/shell-testlib
- Owner: eviweb
- License: mit
- Created: 2015-09-25T08:12:47.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-01T20:34:31.000Z (about 9 years ago)
- Last Synced: 2023-03-25T11:44:18.593Z (over 1 year ago)
- Language: Shell
- Size: 141 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Shell Testlib
=============
this library aims to provide some facilities to write shell unit tests.##### Health status
[![Travis CI - Build Status](https://travis-ci.org/eviweb/shell-testlib.svg)](https://travis-ci.org/eviweb/shell-testlib)
[![Github - Last tag](https://img.shields.io/github/tag/eviweb/shell-testlib.svg)](https://github.com/eviweb/shell-testlib/tags)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:_
```bash
#! /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
```bash
loadFile "/path/to/my/file"
### OR ###
load "/path/to/my/file"
```
#### load many files
by using some filtering patterns
```bash
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.
```bash
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](https://github.com/eviweb/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](/LICENSE)