This repository has been archived by the owner on Jul 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add the beginnings of a testsuite. Modify existing code slightly to…
… make this possible. * Only rakudolog (and by extension, githubparser) are tested, and coverage is pretty low even for those. But this is a starting point. * Add a Makefile (this shouldn't conflict with botnix when sharing the checkout directory) to allow "make test" and "make testcover".
- Loading branch information
Showing
5 changed files
with
145 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
test: | ||
prove t | ||
|
||
testcover: | ||
@rm -rf cover_db | ||
@HARNESS_PERL_SWITCHES="-MDevel::Cover=+ignore,t/" prove t | ||
@cover -summary -report html -outputdir cover_db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!perl | ||
use strict; | ||
use warnings; | ||
|
||
use Test::More; | ||
use Cwd; | ||
use lib getcwd(); | ||
use t::util; | ||
load_plugin("rakudolog"); | ||
|
||
my $tests; | ||
BEGIN { $tests = 0; }; | ||
|
||
plan tests => $tests; | ||
|
||
my $xml_header = << '__XML__'; | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom"> | ||
<id>tag:github.com,2008:/feeds/rakudo/commits/rakudo/master</id> | ||
<link type="text/html" rel="alternate" href="http://github.com/rakudo/rakudo/commits/master/"/> | ||
<link type="application/atom+xml" rel="self" href="http://github.com/feeds/rakudo/commits/rakudo/master"/> | ||
<title>Recent Commits to rakudo:master</title> | ||
__XML__ | ||
|
||
my $xml_footer = << '__XML__'; | ||
<entry> | ||
<id>tag:github.com,2008:Grit::Commit/c7d2d7784f80b2c9f05b68d4aa5a6e21a2f2a257</id> | ||
<link type="text/html" rel="alternate" href="http://github.com/rakudo/rakudo/commit/c7d2d7784f80b2c9f05b68d4aa5a6e21a2f2a257"/> | ||
<title>Merge branch 'master' of git@github.com:rakudo/rakudo</title> | ||
<updated>2009-05-01T09:32:55-07:00</updated> | ||
<content type="html"><pre> | ||
Merge branch 'master' of git@github.com:rakudo/rakudo</pre></content> | ||
<author> | ||
<name>pmichaud</name> | ||
</author> | ||
</entry> | ||
</feed> | ||
__XML__ | ||
|
||
# initial sync | ||
my $xml = $xml_header . '<updated>2009-05-01T09:32:55-07:00</updated>' . $xml_footer; | ||
my $feed = XML::Atom::Feed->new(\$xml); | ||
my $rl = modules::local::rakudolog->get_self(); | ||
ok(!exists($$rl{lastrev}), "no lastrev by default"); | ||
call_func('process_feed', $feed); | ||
my $output = [output()]; | ||
is(scalar @$output, 0, "nothing output the first time around"); | ||
is($$rl{lastrev}, "2009-05-01T09:32:55-07:00", "lastrev was set"); | ||
BEGIN { $tests += 3 }; | ||
|
||
# update | ||
$xml_footer = << '__XML__' . $xml_footer; | ||
<entry> | ||
<id>tag:github.com,2008:Grit::Commit/7f5af50c19baf360dacc5779b9c013fb14db34d3</id> | ||
<link type="text/html" rel="alternate" href="http://github.com/rakudo/rakudo/commit/7f5af50c19baf360dacc5779b9c013fb14db34d3"/> | ||
<title>Big refactor of Rakudo's enums, making them more compliant with S12, and building them with much less generated code. Track an enum related grammar change from STD.pm too. Also gets rid of various bits of cruft that only hung around because of the previous enums implementation needing them. Bool is no longer sort-of-enum-ish (before we had some curious interactions there). Also an infinite loop in infix:<but> is fixed.</title> | ||
<updated>2009-05-01T09:58:40-07:00</updated> | ||
<content type="html"><pre>m src/builtins/enums.pir | ||
m src/builtins/guts.pir | ||
m src/builtins/op.pir | ||
m src/classes/Abstraction.pir | ||
m src/classes/Bool.pir | ||
m src/parser/actions.pm | ||
m src/parser/grammar.pg | ||
Big refactor of Rakudo's enums, making them more compliant with S12, and building them with much less generated code. Track an enum related grammar change from STD.pm too. Also gets rid of various bits of cruft that only hung around because of the previous enums implementation needing them. Bool is no longer sort-of-enum-ish (before we had some curious interactions there). Also an infinite loop in infix:&lt;but&gt; is fixed.</pre></content> | ||
<author> | ||
<name>jnthn</name> | ||
</author> | ||
</entry> | ||
__XML__ | ||
$xml = $xml_header . '<updated>2009-05-01T09:58:40-07:00</updated>' . $xml_footer; | ||
$feed = XML::Atom::Feed->new(\$xml); | ||
call_func('process_feed', $feed); | ||
$output = [output()]; | ||
is(scalar @$output, 6, "6 lines of output"); | ||
is($$output[0]{net} , 'magnet' , "line to magnet/#parrot"); | ||
is($$output[0]{chan}, '#parrot' , "line to magnet/#parrot"); | ||
is($$output[1]{net} , 'freenode', "line to freenode/#perl6"); | ||
is($$output[1]{chan}, '#perl6' , "line to freenode/#perl6"); | ||
is($$rl{lastrev}, "2009-05-01T09:58:40-07:00", "lastrev was updated"); | ||
BEGIN { $tests += 6 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package t::util; | ||
use strict; | ||
use warnings; | ||
use Perl6::Export::Attrs; | ||
|
||
my $module; | ||
my $inst; | ||
sub load_plugin :Export(:DEFAULT) { | ||
$module = shift; | ||
do "modules/local/$module.pm"; | ||
$module = "modules::local::$module"; | ||
$inst = $module; | ||
call_func('init'); | ||
} | ||
|
||
sub call_func :Export(:DEFAULT) { | ||
my $func = shift; | ||
return $inst->$func(@_); | ||
} | ||
|
||
my @output; | ||
|
||
sub output :Export(:DEFAULT) { | ||
my $line = shift; | ||
return @output unless defined $line; | ||
return undef unless exists $output[$line]; | ||
return $output[$line]; | ||
} | ||
|
||
sub reset_output :Export(:DEFAULT) { | ||
@output = (); | ||
} | ||
|
||
|
||
package main; | ||
|
||
# stubs | ||
sub create_timer { my ($timername, $self, $functionname, $timeout) = @_; } | ||
sub lprint { my $line = shift; } | ||
|
||
# gather output for test | ||
sub send_privmsg { | ||
my ($net, $chan, $text) = @_; | ||
push(@output, { net => $net, chan => $chan, text => $text }); | ||
} | ||
|
||
1; |