Skip to content

dhamidi/shpec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

shpec provides rspec-like testing for POSIX sh scripts.

Example:

#!/bin/sh
describe 'my-script'
  it 'outputs hostname'
    # sugar for: expr "$(my-script)" = "$(hostname)"
    # but with diagnostic output in case of failure
    expect "$(my-script)" to = "$(hostname)"
  end

  it 'performs arithmetic'
    expect "$(my-script 1 + 1)" to = 2
  end
end

When run:

 $ shpec -f my-script-shpec.sh
my-script
  outputs hostname
  performs arithmetic
   Comparison failed (using =):
   Expected:
    2
   Got:
    1
FAIL my-script-shpec.sh
 $ echo $?
1

Installation

# Install in /usr/local
$ make test
$ sudo make install

The default installation location is /usr/local. If you want to install shpec somewhere else, set PREFIX.

# Install somewhere else
$ PREFIX=/tmp make install

Author

Dario Hamidi <dario.hamidi@gmail.com>, 2013, Github

License

All code is licensed under the GNU GPL. Documentation is licensed under the GNU FDL.

About

Rspec-like testing for POSIX sh scripts

Resources

License

Stars

3 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors