Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Shell Perl Makefile
branch: master

git subrepo pull ext/test-tap-bash/

subrepo:    "ext/test-tap-bash"
upstream:
  origin:   "git@github.com:ingydotnet/test-tap-bash.git"
  branch:   "master"
  commit:   "8c660ae"
git-subrepo:
  version:  "0.2.0"
  origin:   "git@github.com:ingydotnet/git-subrepo"
  commit:   "909b638"
latest commit 5a16e75da4
@ingydotnet authored
Failed to load latest commit information.
doc 0.0.2
ext git subrepo pull ext/test-tap-bash/
lib/test 0.0.2
man/man3 0.0.2
test no need to export
.travis.yml subrepo clone: git@github.com:ingydotnet/test-tap-bash.git (master) -…
Changes 0.0.2
License 0.0.2
Makefile 0.0.2
Meta 0.0.2
ReadMe.pod 0.0.2

ReadMe.pod

Name

Test::More - TAP Testing for Bash

test-more-bash

Synopsis

Write a test file like this. Maybe call it test/test.t:

    #!/usr/bin/env bash

    TEST_MORE_PATH="/path/to/test-more-bash"
    BASHLIB="`
        find $TEST_MORE_PATH -type d |
        grep -E '/(bin|lib)$' |
        xargs -n1 printf "%s:"`"
    PATH="$BASHLIB$PATH"

    source bash+ :std

    use Test::More

    plan tests 8

    some-command
    ok $? 'some-command is ok'

    # or:
    ok "`some-command`" 'some-command is ok'

    pass 'This will always pass'

    fail 'This will always fail'

    is `echo foo` 'foo' 'foo is foo'

    isnt foo bar "foo isn't bar"

    like food foo 'food is like foo'

    unlike team I "There's no 'I' in 'team'"

    diag "A message for stderr"

    note "A message for stdout"

Run the test with prove like this:

    prove test/test.t

Prove knows it's Bash from the first line (the hashbang), and it just works.

Description

Test::More is the tried and true testing library for Perl. It uses TAP (the Test Anything Protocol). This is the same thing for Bash. For the most part it should work exactly the same.

Methods

This is the basic usage:

  • plan tests $count
  • ok $status_code "$label"
  • pass "$label"
  • fail "$label"
  • is "$got" "$want" "label"
  • isnt "$got" "$unwanted" "$label"
  • like "$got" "$regex" "$label"
  • unlike "$got" "$regex" "$label"
  • diag "$message"
  • note "$message"
  • done_testing $count
  • plan skip_all "$reason"
  • BAIL_OUT "$reason"

More detailed info coming soon.

Author

Ingy döt Net <ingy@bpan.org>

Copyright & License

Copyright 2013-2015. Ingy döt Net.

The MIT License (MIT)

Something went wrong with that request. Please try again.