add basic tests and travis config

This commit is contained in:
Kunal Dabir 2017-08-28 21:37:44 +05:30
parent f3329d3d08
commit c4695a0bdd
2 changed files with 28 additions and 0 deletions

19
.hastest.bats Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bats
@test "works with single command check" {
result=$(bash has node)
[[ $result == *"✔ node"* ]]
}
@test "safely tells about tools not configured" {
result=$(bash has something-missing)
[[ $result == *"✘ something-missing not understood"* ]]
}
@test "env lets override safety check" {
result=$(HAS_ALLOW_UNSAFE=y bash has something-missing)
[[ $result == *"✘ something-missing"* ]]
}

9
.travis.yml Normal file
View File

@ -0,0 +1,9 @@
language: bash
before_install:
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update -qq
- sudo apt-get install -qq bats
install:
- sudo apt-get install -qq bc
script:
- bats .hastest.bats