Skip to content

Commit ce0663f

Browse files
committed
Back to normal, tests again #5
1 parent 3e13827 commit ce0663f

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

lib/Pod/To/Cached.pm6

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ method update-cache( --> Bool ) {
149149

150150
method compile( $source-name, $key, $path, $status is copy ) {
151151
note "Caching $source-name" if $!verbose;
152-
my ($handle , $error, $added);
152+
my ($handle, $error, $added);
153153
try {
154154
CATCH {
155155
default {
@@ -261,14 +261,12 @@ method freeze( --> Bool ) {
261261
self.save-index;
262262
}
263263

264-
method rm-cache() {
264+
sub rm-cache( $path ) is export {
265265
if $*SPEC ~~ IO::Spec::Win32 {
266-
my $win-path = "$*CWD/$!path".trans( ["/"] => ["\\"] );
267-
shell "rm $win-path\\.lock";
266+
my $win-path = "$*CWD/$path".trans( ["/"] => ["\\"] );
268267
shell "rmdir /S /Q $win-path" ;
269-
shell "rmdir $win-path";
270268
} else {
271-
shell "rm -rf $!path";
269+
shell "rm -rf $path";
272270
}
273271
}
274272

t/020-source.t

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ is-deeply $cache.hash-files, ( 'a-pod-file' => 'Current', 'a-second-pod-file'=>'
228228
$cache .= new( :source( DOC ), :path( REP ));
229229
#--MARKER-- Test 36
230230
is-deeply $cache.hash-files(<Valid Old>), %( 'a-pod-file' => 'Valid', 'pod-file-to-deprecate' => 'Old'), 'hash-files with seq of statuses correct';
231-
# remove rep with old source
232-
$cache.rm-cache;
231+
233232
#restore valid source file for later tests.
234233
(DOC ~ '/a-pod-file.pod6').IO.spurt(q:to/POD-CONTENT/);
235234
=begin pod

t/030-sub-directories.t

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,5 @@ nok 'sub-dir-1' ~~ any( $cache.hash-files.keys ), 'sub-directories filtered from
3636
't'.IO.&indir( {$cache .= new(:source( 'tmp/doc' ) ) } );
3737
#--MARKER-- Test 4
3838
ok 't/.pod-cache'.IO ~~ :d, 'default repository created';
39-
rmtree 't/.pod-cache';
4039

4140
done-testing;

t/040-pod-extraction.t

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ plan 11;
1111

1212
my Pod::To::Cached $cache;
1313
my $rv;
14-
diag 'test pod extraction';
15-
$cache .= new( :path( REP ));
14+
diag 'Test pod extraction';
15+
rm-cache( REP );
16+
$cache .= new( :source( DOC ), :path( REP ), :!verbose);
17+
$cache.update-cache;
1618
#--MARKER-- Test 1
1719
ok $cache.pod('a-pod-file')[0] ~~ Pod::Block::Named, 'pod is returned from cache';
1820

@@ -34,16 +36,24 @@ is %h<a-second-pod-file>, 'Valid', 'The old version is still in cache, no update
3436
lives-ok { $rv = $cache.pod('a-second-pod-file') }, 'Old Pod is provided';
3537

3638
#--MARKER-- Test 4
37-
like $rv[0].contents[1].contents[0], /'Some more text but now it is changed'/, 'previous text in source';
39+
like $rv[0].contents[1].contents[0],
40+
/'Some more text but now it is changed'/,
41+
'previous text in source';
3842

3943
diag 'testing freeze';
4044
#--MARKER-- Test 5
41-
throws-like { $cache.freeze }, Exception, :message(/'Cannot freeze because some files not Current'/), 'Cant freeze when a file not Current';
45+
throws-like { $cache.freeze }, Exception,
46+
:message(/'Cannot freeze because some files not Current'/),
47+
'Cannot freeze when a file not Current';
48+
4249
#--MARKER-- Test 6
4350
ok $cache.update-cache, 'updates without problem';
4451

4552
#--MARKER-- Test 7
46-
like $cache.pod('a-second-pod-file')[0].contents[1].contents[0], /'Some more text but now it is changed'/, 'new version after update';
53+
like $cache.pod('a-second-pod-file')[0].contents[1].contents[0],
54+
/'Some more text but now it is changed'/,
55+
'new version after update';
56+
4757
#--MARKER-- Test 8
4858
lives-ok { $cache.freeze }, 'All updated so now can freeze';
4959

0 commit comments

Comments
 (0)