From 96f37bc42e1214ec32b276284a4e2778cc1a6fb1 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Thu, 24 Mar 2016 16:42:36 +0200 Subject: [PATCH] Add more tests --- t/App-Statsbot.t | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/t/App-Statsbot.t b/t/App-Statsbot.t index cf8e1dd..9239008 100644 --- a/t/App-Statsbot.t +++ b/t/App-Statsbot.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 6; +use Test::More tests => 12; BEGIN { use_ok('App::Statsbot') }; my ($time, $reply); @@ -17,7 +17,7 @@ BEGIN { sub runtest { my ($uptime, $msg, $exp_re) = @_; $time = $uptime; - $reply = ''; + $reply = 'NOREPLY'; my @args; @args[App::Statsbot::ARG1, App::Statsbot::ARG2] = ('', $msg); App::Statsbot::on_public(@args); @@ -26,7 +26,14 @@ sub runtest { my $magicnr = 13980000; +runtest 0, 'hi!', qr/NOREPLY/; +runtest 0, '!help', qr/or !presence/; +runtest 0, ' !help', qr/or !presence/; +runtest 0, 'statsbot: help', qr/or !presence/; +runtest 0, 'statsbot: !help', qr/or !presence/; + runtest 0, '!presence mgv', qr/mgv was here 0 hours during the last 1 day/; +runtest 0, '!presence mgv potato', qr/cannot parse timespec: potato/; runtest $magicnr, '!presence mgv "1 year"', qr/here 3883 hours during/; runtest $magicnr, '!presence mgv "1 year" 1', qr/here 162 days during/; runtest $magicnr, '!presence mgv "1 year" 2', qr/here 161 days and 19 hours during/; -- 2.39.2