Skip to content

Commit

Permalink
Item11526: ok, so its all my fault - I keep thinking that Func::rende…
Browse files Browse the repository at this point in the history
…rText will actually do so. there's a bunch of rendering that has to happen first - expandCommonVariables is sufficient for my basic purposes

git-svn-id: http://svn.foswiki.org/branches/Release01x01@14174 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Mar 1, 2012
1 parent 193d573 commit 49c33e7
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions UnitTestContrib/test/unit/PluginHandlerTests.pm
Expand Up @@ -696,7 +696,7 @@ sub renderWikiWordHandler {
}
HERE
$this->checkCalls( 0, 'renderWikiWordHandler' );
my $html = Foswiki::Func::renderText( <<'HERE', 'Sandbox', 'TestThisCarefully' );
my $tmlText = <<'HERE';
This is AWikiWord and some NoSuchWeb.NoTopic that we CANNOT
* Set ALLOWTOPICCHANGE=guest
%ATTACHURL%/Foswiki-1.1.4.tar.gz
Expand All @@ -721,12 +721,14 @@ HERE
[[some test link]] [[text][link text]]
HERE
{
my $html = Foswiki::Func::renderText( $tmlText, 'Sandbox', 'TestThisCarefully' );
$this->checkCalls( 10, 'renderWikiWordHandler' );
#$Foswiki::Plugins::$this->{plugin_name}::called->{$name}
my $hashRef = eval "\$Foswiki::Plugins::$this->{plugin_name}::called->{renderWikiWordHandlerLinks}";
use Data::Dumper;
print STDERR "------ $html\n";
print STDERR "------ ".Dumper($hashRef)."\n";
#TODO: this is not correct, its just what we have
#this is what we have - and it shows that you need to call expandMacros before calling renderText
$this->assert_deep_equals({
'ATTACHURL/releases/other/file-3/0/4/tar___gz' => '%ATTACHURL%/releases/other/file-3.0.4.tar.gz___undef',
'SYSTEMWEB___WikiWords' => '%SYSTEMWEB%.WikiWords___undef',
Expand All @@ -739,6 +741,30 @@ print STDERR "------ ".Dumper($hashRef)."\n";
'Sandbox___SomeTestLink' => 'some test link___undef',
'Sandbox___CANNOT' => 'CANNOT___undef'
}, $hashRef);
}
#lets do it again, this time with expandMacros first
eval "delete \$Foswiki::Plugins::$this->{plugin_name}::called->{renderWikiWordHandler}";
eval "delete \$Foswiki::Plugins::$this->{plugin_name}::called->{renderWikiWordHandlerLinks}";
my $expandedText = Foswiki::Func::expandCommonVariables($tmlText, 'Sandbox', 'TestThisCarefully' );
$this->checkCalls( 0, 'renderWikiWordHandler' );
my $html = Foswiki::Func::renderText( $expandedText, 'Sandbox', 'TestThisCarefully' );
$this->checkCalls( 12, 'renderWikiWordHandler' );
my $hashRef = eval "\$Foswiki::Plugins::$this->{plugin_name}::called->{renderWikiWordHandlerLinks}";
use Data::Dumper;
print STDERR "------ $html\n";
print STDERR "------ ".Dumper($hashRef)."\n";
#this is what we have - and it shows that you need to call expandMacros before calling renderText
$this->assert_deep_equals({
'TemporaryPluginHandlersUsersWeb___TemporaryPluginHandlersSystemWebTopic' => 'TemporaryPluginHandlersSystemWebTopic___undef',
'Sandbox___Text' => 'link text___1',
'TemporaryPluginHandlersSystemWeb___WebHome' => 'TemporaryPluginHandlersSystemWeb___undef',
'NoSuchWeb___NoTopic' => 'NoTopic___undef',
'Sandbox___ALLOWTOPICCHANGE' => 'ALLOWTOPICCHANGE___undef',
'Sandbox___AWikiWord' => 'AWikiWord___undef',
'Sandbox___SomeTestLink' => 'some test link___undef',
'Sandbox___CANNOT' => 'CANNOT___undef',
'TemporaryPluginHandlersSystemWeb___WikiWords' => 'WikiWords___undef'
}, $hashRef);

return;
}
Expand Down

0 comments on commit 49c33e7

Please sign in to comment.