Permalink
Browse files

Merge pull request #32 from stmuk/master

Partial Test Fixage for 6.c
  • Loading branch information...
2 parents 139a445 + b939834 commit 9e44a7357b2637a4f36a62cd9655ad8d919c031e @softmoth softmoth committed Jan 14, 2016
@@ -1,4 +1,4 @@
-class Dispatcher::Rule;
+unit class Dispatcher::Rule;
has @.pattern;
has @.args;
View
@@ -6,6 +6,7 @@ class November { ... }
use November::Session;
use November::Cache;
use Digest::SHA;
+use MONKEY-SEE-NO-EVAL;
class November does November::Session does November::Cache {
@@ -192,7 +193,7 @@ class November does November::Session does November::Cache {
method read_users {
return {} unless $.config.userfile_path.IO ~~ :e;
- return eval( slurp( $.config.userfile_path ) );
+ return EVAL( slurp( $.config.userfile_path ) );
}
method not_found($page?) {
View
@@ -149,7 +149,7 @@ class November::CGI {
when { $^c +& 0xC0 == 0xC0 } { $bytes = 2; $mask = 0x1F }
}
my @shift = (^$bytes).reverse.map({6 * $_});
- my @mask = $mask, 0x3F xx $bytes-1;
+ my @mask = $mask, Slip(0x3F xx $bytes-1);
$r ~= chr( [+] @chars.splice(0,$bytes) »+&« @mask »+<« @shift );
}
return $r;
@@ -1,4 +1,4 @@
-role November::Cache;
+unit role November::Cache;
use November::Config;
@@ -1,4 +1,4 @@
-role November::Session;
+unit role November::Session;
method sessionfile-path {
return $.config.server_root ~ 'data/sessions';
@@ -17,6 +17,7 @@ method remove_session($id) {
}
method read_sessions {
+ use MONKEY-SEE-NO-EVAL;
return {} unless self.sessionfile-path.IO ~~ :e;
my $string = slurp( self.sessionfile-path );
my $stuff = EVAL( $string );
@@ -1,4 +1,4 @@
-class November::Storage;
+unit class November::Storage;
method wiki_page_exists($page) { ... }
@@ -2,6 +2,7 @@ use v6;
use November::Storage;
use November::Utils;
+use MONKEY-SEE-NO-EVAL;
class November::Storage::File is November::Storage {
@@ -1,6 +1,7 @@
use v6;
use November::Config;
+use MONKEY-SEE-NO-EVAL;
class November::Tags {
has $.page_tags_path is rw;
View
@@ -1,4 +1,4 @@
-class November::URI;
+unit class November::URI;
# This class used to be called just 'URI', but there was a collision with
# the eponymous class in the 'uri' project. Arguably, that class has more
@@ -1,4 +1,4 @@
-module November::Utils;
+unit module November::Utils;
sub r_remove( $str is rw ) is export {
$str .= subst( /\\r/, '', :g );
@@ -165,7 +165,7 @@ class Text::Markup::Wiki::MediaWiki {
}
}
- take join '', map { "</$_>" }, reverse @style_stack;
+ take join '', map { "</$_>" if $_}, reverse @style_stack;
}
return sprintf '<%s>%s</%s>', $partype, $result, $partype;
@@ -1,4 +1,4 @@
-class Text::Markup::Wiki::Minimal;
+unit class Text::Markup::Wiki::Minimal;
method format($text, :$link_maker, :$extlink_maker) {
my @pars = grep { $_ ne "" },
@@ -27,5 +27,5 @@ for (@counts_to_test) {
$out{$_} = $tf->($tags{$_}, $min, $max);
}
- is_deeply( \%out , \%expected, 'Normalize: ' . Dumper(\%tags) );
+ is-deeply( \%out , \%expected, 'Normalize: ' . Dumper(\%tags) );
}
View
@@ -26,5 +26,5 @@ for (@to_parse) {
my ($in, $result) = @$_;
my $comment = 'Parse tags: ' . $in;
$comment =~ s/\n/\\n/;
- is_deeply( $tf->($in), $result, $comment );
+ is-deeply( $tf->($in), $result, $comment );
}
View
@@ -14,29 +14,29 @@ my @queries = (
'test=',
{ :test('') } ,
'test=1',
- { :test<1> },
+ { :test('1') },
'test=2&params=2',
- { :test<2>, :params<2> },
+ { :test('2'), :params('2') },
'test=3&params=3&words=first+second',
- { :test<3>, :params<3>, :words('first second') },
+ { :test('3'), :params('3') :words('first second') },
'test=4&params=3&words=first+%41+second',
- { :test<4>, :params<3>, :words('first A second') },
+ { :test('4'), :params('3') :words('first A second') },
'test=5&params=3&words=first%0Asecond',
- { :test<5>, :params<3>, :words("first\nsecond") },
+ { :test('5'), :params('3') :words("first\nsecond") },
'test=foo&test=bar',
{ test => [<foo bar>] },
'test=2;params=2',
- { :test<2>, :params<2> },
+ { :test('2'), :params('2') },
'test=3;params=3;words=first+second',
- { :test<3>, :params<3>, :words('first second') },
+ { :test('3'), :params('3'), :words('first second') },
'test=4;params=3&words=first+%41+second',
- { :test<4>, :params<3>, :words('first A second') },
+ { :test('4'), :params('3'), :words('first A second') },
);
for @queries -> $in, $expected {
my $c = November::CGI.new();
$c.parse_params($in);
- is_deeply($c.params, $expected, 'Parse param: ' ~ $in);
+ is-deeply($c.params, $expected, 'Parse param: ' ~ $in);
}
my @keywords = (
@@ -48,7 +48,7 @@ my @keywords = (
for @keywords -> $in, $expected {
$cgi.parse_params($in);
- is_deeply($cgi.keywords, $expected , 'Parse param (keywords): ' ~ $in);
+ is-deeply($cgi.keywords, $expected , 'Parse param (keywords): ' ~ $in);
}
$cgi = November::CGI.new();
@@ -63,29 +63,29 @@ my @add_params = (
# Do not consistency :( but we don`t have adverbial syntax to set pairs
# with undefined value
# see http://www.nntp.perl.org/group/perl.perl6.language/2008/09/msg29610.html
- # Skip now, because is_deeply do not work properly with Mu :(
+ # Skip now, because is-deeply do not work properly with Mu :(
#key2 => Mu , { :key1<val val2>, key2 => ["val", Mu], :key3<4>, :key4<4.1> },
);
for @add_params -> $in, $expected {
my $key = $in.key;
my $val = $in.value;
$cgi.add_param($key, $val);
- is_deeply( $cgi.params, $expected, "Add kv: :{$key}<" ~ ($val or '') ~ ">" );
+ is-deeply( $cgi.params, $expected, "Add kv: :{$key}<" ~ ($val or '') ~ ">" );
}
is( $cgi.param('key3'), '4', 'Test param' );
my @cookies = (
'foo=bar',
- { :foo<bar> },
+ { :foo('bar') },
'foo=bar; bar=12.20',
- { :foo<bar>, :bar<12.20> },
+ { :foo('bar') :bar('12.20') },
);
for @cookies -> $in, $expected {
$cgi.eat_cookie($in);
- is_deeply($cgi.cookie, $expected, 'Parse cookies: ' ~ $in);
+ is-deeply($cgi.cookie, $expected, 'Parse cookies: ' ~ $in);
}
# vim:ft=perl6
View
@@ -5,7 +5,7 @@ use CGI;
my $cgi = CGI.new();
$cgi.init();
-print _is_deeply( $cgi.params, eval( %*ENV<TEST_RESULT> ) )
+print _is-deeply( $cgi.params, eval( %*ENV<TEST_RESULT> ) )
?? "ok "
!! "not ok \n" ~ "got: " ~ $cgi.param.perl ~
"\nexpected: " ~ %*ENV<TEST_RESULT> ~ "\n";
@@ -11,7 +11,7 @@ ok(1,'We use Dispatcher::Rule and we are still alive');
my $d = Dispatcher.new;
-dies_ok( { $d.add: Dispatcher::Rule.new },
+dies-ok( { $d.add: Dispatcher::Rule.new },
'.add adds only complete Rule objects' );
$d.add: Dispatcher::Rule.new( :pattern(['']), code => { "Krevedko" } );
@@ -29,7 +29,7 @@ for @markups X @skins -> $m, $s {
my $uri = November::URI.new( uri => 'http://testserver' ~ $page );
my $cgi = Test::CGI.new( uri => $uri );
$cgi.parse_params( $page );
- lives_ok( { $w.handle_request( $cgi ) }, "$m, $s, $description" );
+ lives-ok( { $w.handle_request( $cgi ) }, "$m, $s, $description" );
}
}
View
@@ -24,7 +24,7 @@ for @counts_to_test -> @in, @expected {
# So, second map work with wrong min and max
my @out = map { $t.norm($_, $min, $max) }, @in.values;
- is_deeply( @out, @expected, 'Normalize: ' ~ @in.perl );
+ is-deeply( @out, @expected, 'Normalize: ' ~ @in.perl );
}
# vim:ft=perl6
@@ -25,10 +25,10 @@ is( ($t.norm_counts).perl, '{}', 'With empty tags_count norm_counts produce empt
my $in = { foo => 5, bar => 5, baz => 2, her => 1 };
$t.write_tags_count($in);
-is_deeply( $t.norm_counts, {"foo" => 10, "bar" => 10, "baz" => 4, "her" => 0}, 'Normalize all from: ' ~ $in.perl );
+is-deeply( $t.norm_counts, {"foo" => 10, "bar" => 10, "baz" => 4, "her" => 0}, 'Normalize all from: ' ~ $in.perl );
my @tags = <foo baz>;
-is_deeply( $t.norm_counts(@tags), {"foo" => 10, "baz" => 4}, 'Normalize foo and baz from: ' ~ $in.perl );
+is-deeply( $t.norm_counts(@tags), {"foo" => 10, "baz" => 4}, 'Normalize foo and baz from: ' ~ $in.perl );
$t.clear;
View
@@ -33,7 +33,7 @@ my @to_parse = (
my $t = November::Tags.new;
for @to_parse -> $in, $expected {
- is_deeply( [$t.tags_parse($in)], $expected, 'Parse tags: ' ~ $in.perl);
+ is-deeply( [$t.tags_parse($in)], $expected, 'Parse tags: ' ~ $in.perl);
}
# vim:ft=perl6
View
@@ -29,38 +29,38 @@ $t.clear;
$t.update_tags('Test_Page', 'Foo, Bar');
-is_deeply(
+is-deeply(
$t.read_tags_count,
{"foo" => 1, "bar" => 1},
'Simple tag counting'
);
-is_deeply(
+is-deeply(
$t.read_tags_index,
{"foo" => ["Test_Page"], "bar" => ["Test_Page"]},
'Simple tag indexing'
);
$t.update_tags('Test_Page', 'Bar, Her');
-is_deeply(
+is-deeply(
$t.read_tags_count,
{"bar" => 1, "her" => 1},
'Tag count after addition and removal'
);
-is_deeply(
+is-deeply(
$t.read_tags_index,
{"foo" => [], "bar" => ["Test_Page"], "her" => ["Test_Page"]},
'Tag index after add and remove'
);
$t.update_tags('Another_Page', 'Bar, Her');
-is_deeply(
+is-deeply(
$t.read_tags_count,
{"bar" => 2, "her" => 2},
'Tag count after adding another page'
);
-is_deeply(
+is-deeply(
$t.read_tags_index,
{
"foo" => [],
@@ -72,11 +72,11 @@ is_deeply(
$t.update_tags('Test_Page', 'Bar, Her');
-is_deeply(
+is-deeply(
$t.read_tags_count,
{"bar" => 2, "her" => 2},
'Tag count after saving a page without changes');
-is_deeply(
+is-deeply(
$t.read_tags_index,
{
"foo" => [],

0 comments on commit 9e44a73

Please sign in to comment.