Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

Commit

Permalink
Adding tests;
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroliu committed Aug 26, 2016
1 parent e1b118e commit cde4049
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
16 changes: 16 additions & 0 deletions precommit
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
#
# Run this usually from a pre-commit hook...
#
. "$(dirname "$(readlink -f "$0")")/libcommon/utils/init.sh"

[ ! -f plugin.yml ] && fatal "No plugin.yml"
[ -f README.md ] && $gd3tool gen -w src

if [ -d resource/messages ] ; then
$mcgen gen resources/messages src $([ -d libcommon/src ] && echo libcommon/src)
$mcgen enc resources/messages
fi

$mkver src
phplint src || fatal "Failed lint"
22 changes: 22 additions & 0 deletions t/main/cfg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
#
download_url="https://github.com/Muirfield/ManyWorlds/archive/master.zip"


pre() {
wget -O $MPDIR/plugins/test.zip $download_url
}

post() {
rm -f $MPDIR/plugins/*.zip
}

case "$1" in
pre)
pre "$@"
;;
post)
post "$@"
;;
esac

8 changes: 8 additions & 0 deletions t/main/try.pms
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Check if MW loaded. We assume MW is in the attached zip...
#
@ $cmdmap = $server->getCommandMap()
@ $oldcmd = $cmdmap->getCommand("mw")
@ if (!$oldcmd) return

mw help
25 changes: 25 additions & 0 deletions test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
#
. "$(dirname "$(readlink -f "$0")")/libcommon/utils/init.sh"
. $utlib/pm.sh
. $utlib/unitest.sh

trap 'exit $retcode' EXIT

[ ! -f plugin.yml ] && fatal "No plugin.yml"
[ -f README.md ] && $gd3tool gen -w src

$mkver src
phplint src || fatal "Failed lint"

install_pocketmine
testgroup="$(default_tests t "$@")"
[ -z "$testgroup" ] && exit

pm_plugins
$mkplugin -o $MPDIR/plugins libcommon/
$mkplugin -o $MPDIR/plugins .

runtests $testgroup

show_results

0 comments on commit cde4049

Please sign in to comment.