Skip to content

Commit

Permalink
Testing #16
Browse files Browse the repository at this point in the history
Text does not update
  • Loading branch information
JJ committed Feb 27, 2020
1 parent 3e8a744 commit c155d4e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
8 changes: 8 additions & 0 deletions pod-cached.iml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="JSON::Fast:ver&lt;0.9.18+&gt;" type="perl6">
<CLASSES />
<SOURCES>
<root url="raku://1165951813:JSON::Fast:ver&lt;0.9.18+&gt;!/" />
</SOURCES>
</library>
</orderEntry>
</component>
</module>
31 changes: 21 additions & 10 deletions t/040-pod-extraction.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,44 @@ Some text
=end pod
POD-CONTENT

$cache .= new( :source( DOC ), :path( REP ), :!verbose);
$cache.update-cache;

#--MARKER-- Test 1
ok $cache.pod('a-pod-file')[0] ~~ Pod::Block::Named, 'pod is returned from cache';


(DOC ~ '/a-second-pod-file.pod6').IO.spurt(q:to/POD-CONTENT/);
=begin pod
=TITLE More and more
Some extra changed text but now it is changed
=end pod
POD-CONTENT
POD-CONTENT

$cache .= new( :source( DOC ), :path( REP ), :!verbose);
$cache.update-cache;

#--MARKER-- Test 1
ok $cache.pod('a-pod-file')[0] ~~ Pod::Block::Named, 'pod is returned from cache';

$cache .=new(:path( REP ));
my %h = $cache.hash-files;
#--MARKER-- Test 2
is %h<a-second-pod-file>, 'Valid', 'The old version is still in cache, no update-cache';
is %h<a-second-pod-file>, 'Current', 'The old version is still in cache, no
update-cache';
#--MARKER-- Test 3
lives-ok { $rv = $cache.pod('a-second-pod-file') }, 'Old Pod is provided';

#--MARKER-- Test 4
like $rv[0].contents[1].contents[0],
/'Some more text but now it is changed'/,
/'Some extra changed'/,
'previous text in source';

(DOC ~ '/a-second-pod-file.pod6').IO.spurt(q:to/POD-CONTENT/);
=begin pod
=TITLE More and more
Some more text but now it is changed
=end pod
POD-CONTENT
$cache .=new(:source( DOC ), :path( REP ));

diag 'testing freeze';
#--MARKER-- Test 5
throws-like { $cache.freeze }, Exception,
Expand All @@ -64,6 +74,7 @@ throws-like { $cache.freeze }, Exception,
ok $cache.update-cache, 'updates without problem';

#--MARKER-- Test 7
say $cache.pod('a-second-pod-file')[0];
like $cache.pod('a-second-pod-file')[0].contents[1].contents[0],
/'Some more text but now it is changed'/,
'new version after update';
Expand Down

0 comments on commit c155d4e

Please sign in to comment.