-- mode: markdown; mode: visual-line; fill-column: 80 --
These tests are based on Bats: "Bash Automated Testing System". Coupled with Travis-CI, it offers a nice continuous integration framework -- see Travis CI for Complete Beginners
I made a setup_bats.sh
script for that (also for easier integration with travis) which roughly performs the following actions:
-
On Mac OS: use Homebrew to install the
bats
package -
On Linux system, a manual installation is performed under
/tmp/local/bin
(to ensure a full compliance with Travis virtualized boxes), which consists in:$> git clone https://github.com/sstephenson/bats.git /tmp/bats $> mkdir -p /tmp/local $> bash /tmp/bats/install.sh /tmp/local $> export PATH=$PATH:/tmp/local/bin
Note that their is normally a way to rely on Debian packages yet I never managed to make it work. For the records, the procedure would have been:
$> apt-get install software-properties-common python-software-properties # to get 'add-apt-repository'
$> add-apt-repository ppa:duggan/bats --yes
$> apt-get update -qq
$> apt-get install -qq bats
However the package repository does not work any more
W: Failed to fetch http://ppa.launchpad.net/duggan/bats/ubuntu/dists/wheezy/main/binary-amd64/Packages 404 Not Found
Take a look at the repository .travis.yml
tests/
├── *.bats # The bats files, each defining a set of unit tests
├── README.md # This file
└── setup_bats.sh # run/source this file to install Bats on your system
Simply run
$> bats . # from the tests directory
OR, from the root repository
$> make tests # from the root directory of the dotfiles repository
You might find the below links interestings: