abra zsh config 2.0
This commit is contained in:
10
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/equality_test.sh
vendored
Executable file
10
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/equality_test.sh
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
#! /bin/sh
|
||||
# file: examples/equality_test.sh
|
||||
|
||||
testEquality()
|
||||
{
|
||||
assertEquals 1 1
|
||||
}
|
||||
|
||||
# load shunit2
|
||||
. ../src/shunit2
|
16
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/lineno_test.sh
vendored
Executable file
16
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/lineno_test.sh
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
#! /bin/sh
|
||||
# file: examples/lineno_test.sh
|
||||
|
||||
testLineNo()
|
||||
{
|
||||
# this assert will have line numbers included (e.g. "ASSERT:[123] ...") if
|
||||
# they are supported.
|
||||
echo "_ASSERT_EQUALS_ macro value: ${_ASSERT_EQUALS_}"
|
||||
${_ASSERT_EQUALS_} 'not equal' 1 2
|
||||
|
||||
# this assert will not have line numbers included (e.g. "ASSERT: ...")
|
||||
assertEquals 'not equal' 1 2
|
||||
}
|
||||
|
||||
# load shunit2
|
||||
. ../src/shunit2
|
17
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/math.inc
vendored
Normal file
17
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/math.inc
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# available as examples/math.inc
|
||||
|
||||
add_generic()
|
||||
{
|
||||
num_a=$1
|
||||
num_b=$2
|
||||
|
||||
expr $1 + $2
|
||||
}
|
||||
|
||||
add_bash()
|
||||
{
|
||||
num_a=$1
|
||||
num_b=$2
|
||||
|
||||
echo $(($1 + $2))
|
||||
}
|
27
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/math_test.sh
vendored
Executable file
27
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/math_test.sh
vendored
Executable file
@@ -0,0 +1,27 @@
|
||||
#! /bin/sh
|
||||
# available as examples/math_test.sh
|
||||
|
||||
testAdding()
|
||||
{
|
||||
result=`add_generic 1 2`
|
||||
assertEquals \
|
||||
"the result of '${result}' was wrong" \
|
||||
3 "${result}"
|
||||
|
||||
# disable non-generic tests
|
||||
[ -z "${BASH_VERSION:-}" ] && startSkipping
|
||||
|
||||
result=`add_bash 1 2`
|
||||
assertEquals \
|
||||
"the result of '${result}' was wrong" \
|
||||
3 "${result}"
|
||||
}
|
||||
|
||||
oneTimeSetUp()
|
||||
{
|
||||
# load include to test
|
||||
. ./math.inc
|
||||
}
|
||||
|
||||
# load and run shUnit2
|
||||
. ../src/shunit2
|
89
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/mkdir_test.sh
vendored
Executable file
89
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/mkdir_test.sh
vendored
Executable file
@@ -0,0 +1,89 @@
|
||||
#!/bin/sh
|
||||
# vim:et:ft=sh:sts=2:sw=2
|
||||
#
|
||||
# Copyright 2008 Kate Ward. All Rights Reserved.
|
||||
# Released under the LGPL (GNU Lesser General Public License)
|
||||
#
|
||||
# Author: kate.ward@forestent.com (Kate Ward)
|
||||
#
|
||||
# Example unit test for the mkdir command.
|
||||
#
|
||||
# There are times when an existing shell script needs to be tested. In this
|
||||
# example, we will test several aspects of the the mkdir command, but the
|
||||
# techniques could be used for any existing shell script.
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite tests
|
||||
#
|
||||
|
||||
testMissingDirectoryCreation()
|
||||
{
|
||||
${mkdirCmd} "${testDir}" >${stdoutF} 2>${stderrF}
|
||||
rtrn=$?
|
||||
th_assertTrueWithNoOutput ${rtrn} "${stdoutF}" "${stderrF}"
|
||||
|
||||
assertTrue 'directory missing' "[ -d '${testDir}' ]"
|
||||
}
|
||||
|
||||
testExistingDirectoryCreationFails()
|
||||
{
|
||||
# create a directory to test against
|
||||
${mkdirCmd} "${testDir}"
|
||||
|
||||
# test for expected failure while trying to create directory that exists
|
||||
${mkdirCmd} "${testDir}" >${stdoutF} 2>${stderrF}
|
||||
rtrn=$?
|
||||
assertFalse 'expecting return code of 1 (false)' ${rtrn}
|
||||
assertNull 'unexpected output to stdout' "`cat ${stdoutF}`"
|
||||
assertNotNull 'expected error message to stderr' "`cat ${stderrF}`"
|
||||
|
||||
assertTrue 'directory missing' "[ -d '${testDir}' ]"
|
||||
}
|
||||
|
||||
testRecursiveDirectoryCreation()
|
||||
{
|
||||
testDir2="${testDir}/test2"
|
||||
|
||||
${mkdirCmd} -p "${testDir2}" >${stdoutF} 2>${stderrF}
|
||||
rtrn=$?
|
||||
th_assertTrueWithNoOutput ${rtrn} "${stdoutF}" "${stderrF}"
|
||||
|
||||
assertTrue 'first directory missing' "[ -d '${testDir}' ]"
|
||||
assertTrue 'second directory missing' "[ -d '${testDir2}' ]"
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# suite functions
|
||||
#
|
||||
|
||||
th_assertTrueWithNoOutput()
|
||||
{
|
||||
th_return_=$1
|
||||
th_stdout_=$2
|
||||
th_stderr_=$3
|
||||
|
||||
assertFalse 'unexpected output to STDOUT' "[ -s '${th_stdout_}' ]"
|
||||
assertFalse 'unexpected output to STDERR' "[ -s '${th_stderr_}' ]"
|
||||
|
||||
unset th_return_ th_stdout_ th_stderr_
|
||||
}
|
||||
|
||||
oneTimeSetUp()
|
||||
{
|
||||
outputDir="${SHUNIT_TMPDIR}/output"
|
||||
mkdir "${outputDir}"
|
||||
stdoutF="${outputDir}/stdout"
|
||||
stderrF="${outputDir}/stderr"
|
||||
|
||||
mkdirCmd='mkdir' # save command name in variable to make future changes easy
|
||||
testDir="${SHUNIT_TMPDIR}/some_test_dir"
|
||||
}
|
||||
|
||||
tearDown()
|
||||
{
|
||||
rm -fr "${testDir}"
|
||||
}
|
||||
|
||||
# load and run shUnit2
|
||||
[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
|
||||
. ../src/shunit2
|
17
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/party_test.sh
vendored
Executable file
17
.zprezto/modules/prompt/external/powerlevel9k/shunit2/source/2.1/examples/party_test.sh
vendored
Executable file
@@ -0,0 +1,17 @@
|
||||
#! /bin/sh
|
||||
# file: examples/party_test.sh
|
||||
|
||||
testEquality()
|
||||
{
|
||||
assertEquals 1 1
|
||||
}
|
||||
|
||||
testPartyLikeItIs1999()
|
||||
{
|
||||
year=`date '+%Y'`
|
||||
assertEquals "It's not 1999 :-(" \
|
||||
'1999' "${year}"
|
||||
}
|
||||
|
||||
# load shunit2
|
||||
. ../src/shunit2
|
Reference in New Issue
Block a user