Skip to content

Commit

Permalink
Merge pull request #190 from mbland/null
Browse files Browse the repository at this point in the history
Add null command
  • Loading branch information
mbland authored Aug 28, 2017
2 parents 348344d + 691a7de commit 4e8f5f5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libexec/null
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /usr/bin/env bash
#
# Returns a successful exit value if the framework is properly installed
#
# If it fails, it should generate output indicating what's wrong with the
# framework installation and exit with an error value.
#
# Useful for tests that only need to verify that the framework is installed
# correctly, or for `_GO_STANDALONE` scripts that run a separate `./go` script
# to install the framework.
#
# For maximum performance, avoid spawning a process to set `COLUMNS` like so:
#
# COLUMNS=80 {{go}} {{cmd}}
23 changes: 23 additions & 0 deletions tests/null.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /usr/bin/env bats

load environment

setup() {
@go.create_test_go_script
}

teardown() {
@go.remove_test_go_rootdir
}

@test "$SUITE: a good installation emits nothing and exits successfully" {
COLUMNS=80 run "$TEST_GO_SCRIPT" null
assert_success ''
}

@test "$SUITE: a bad installation emits errors and exits unsuccessfully" {
rmdir "$TEST_GO_SCRIPTS_DIR"
COLUMNS=80 run "$TEST_GO_SCRIPT" null
assert_failure \
"ERROR: command script directory $TEST_GO_SCRIPTS_DIR does not exist"
}

0 comments on commit 4e8f5f5

Please sign in to comment.