Merge pull request #442 from ipoval/test_some_functions_in_base_plugin
start with tests for base.plugin.bashpull/446/head
commit
25ec6ee6f3
|
|
@ -25,7 +25,6 @@ function myip ()
|
|||
echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}"
|
||||
}
|
||||
|
||||
|
||||
function pickfrom ()
|
||||
{
|
||||
about 'picks random line from file'
|
||||
|
|
@ -92,7 +91,6 @@ function lsgrep ()
|
|||
ls | grep "$*"
|
||||
}
|
||||
|
||||
|
||||
function pman ()
|
||||
{
|
||||
about 'view man documentation in Preview'
|
||||
|
|
@ -102,7 +100,6 @@ function pman ()
|
|||
man -t "${1}" | open -f -a $PREVIEW
|
||||
}
|
||||
|
||||
|
||||
function pcurl ()
|
||||
{
|
||||
about 'download file and Preview it'
|
||||
|
|
@ -184,7 +181,6 @@ function command_exists ()
|
|||
|
||||
mkiso ()
|
||||
{
|
||||
|
||||
about 'creates iso from current dir in the parent dir (unless defined)'
|
||||
param '1: ISO name'
|
||||
param '2: dest/path'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
load ../test_helper
|
||||
load ../../lib/composure
|
||||
load ../../plugins/available/base.plugin
|
||||
|
||||
@test 'plugins base: ips()' {
|
||||
if [[ $CI ]]; then
|
||||
skip 'ifconfig probably requires sudo on TravisCI'
|
||||
fi
|
||||
|
||||
declare -r localhost='127.0.0.1'
|
||||
run ips
|
||||
assert_success
|
||||
assert_line $localhost
|
||||
}
|
||||
|
||||
@test 'plugins base: myip()' {
|
||||
if [[ ! $CI ]]; then
|
||||
skip 'myip is slow - run only on CI'
|
||||
fi
|
||||
|
||||
run myip
|
||||
assert_success
|
||||
declare -r mask_ip=$(echo $output | tr -s '[0-9]' '?')
|
||||
[[ $mask_ip == 'Your public IP is: ?.?.?.?' ]]
|
||||
}
|
||||
|
||||
@test 'plugins base: pickfrom()' {
|
||||
mkdir -p $BASH_IT_ROOT
|
||||
stub_file="${BASH_IT_ROOT}/stub_file"
|
||||
printf "l1\nl2\nl3" > $stub_file
|
||||
run pickfrom $stub_file
|
||||
assert_success
|
||||
[[ $output == l? ]]
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
unset BASH_IT
|
||||
unset BASH_IT_THEME
|
||||
unset GIT_HOSTING
|
||||
unset NGINX_PATH
|
||||
|
|
@ -6,7 +5,13 @@ unset IRC_CLIENT
|
|||
unset TODO
|
||||
unset SCM_CHECK
|
||||
|
||||
BASH_IT_TEST_DIR="${BATS_TMPDIR}/bash_it"
|
||||
BASH_IT_TEST_DIR="${BATS_TMPDIR}/.bash_it"
|
||||
|
||||
# guard against executing this block twice due to bats internals
|
||||
if [ "$BASH_IT_ROOT" != "${BASH_IT_TEST_DIR}/root" ]; then
|
||||
export BASH_IT_ROOT="${BASH_IT_TEST_DIR}/root"
|
||||
export BASH_IT=$BASH_IT_TEST_DIR
|
||||
fi
|
||||
|
||||
teardown() {
|
||||
rm -rf "$BASH_IT_TEST_DIR"
|
||||
|
|
|
|||
Loading…
Reference in New Issue