Skip to content

Commit

Permalink
Item13897: Getting rid of ->finish() calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
vrurg committed Mar 7, 2016
1 parent 250991f commit dae8e37
Show file tree
Hide file tree
Showing 39 changed files with 351 additions and 466 deletions.
19 changes: 5 additions & 14 deletions UnitTestContrib/test/unit/ExtensionInstallerTests.pm
Expand Up @@ -73,16 +73,16 @@ around set_up => sub {
$this->createNewFoswikiSession( $this->user );
$this->test_web('Testsystemweb1234');
my $webObject = $this->populateNewWeb( $this->test_web );
$webObject->finish();
undef $webObject;
$this->trash_web('Testtrashweb1234');
$webObject = $this->populateNewWeb( $this->trash_web );
$webObject->finish();
undef $webObject;
$this->sandbox_web('Testsandboxweb1234');
$webObject = $this->populateNewWeb( $this->sandbox_web );
$webObject->finish();
undef $webObject;
$this->sandbox_subweb('Testsandboxweb1234/Subweb');
$webObject = $this->populateNewWeb( $this->sandbox_subweb );
$webObject->finish();
undef $webObject;
$this->tempdir( $Foswiki::cfg{TempfileDir} . '/test_ConfigureTests' );
rmtree( $this->tempdir )
if ( -e $this->tempdir ); # Cleanup any old tests
Expand Down Expand Up @@ -966,7 +966,7 @@ sub test_Package_makeBackup {
notes => $this->toolsdir . "/shbtest2"
);

$pkg->finish();
undef $pkg;

return;
}
Expand Down Expand Up @@ -1225,7 +1225,6 @@ DONE
$this->assert_matches(
qr/Foswiki::Plugins::TriggerSyntaxError.*-- syntax error/ms, $missing );

$pkg->finish();
undef $pkg;

}
Expand Down Expand Up @@ -1267,7 +1266,6 @@ DONE
$this->sniff();
$this->assert( $pkg->uninstall($reporter) );
$this->sniff();
$pkg->finish();
undef $pkg;

#
Expand Down Expand Up @@ -1353,7 +1351,6 @@ DONE
'#! /usr/bin/perl'
);

$pkg->finish();
undef $pkg;

# Clean out and restart the reporter
Expand Down Expand Up @@ -1541,7 +1538,6 @@ qr/^Foswiki::Contrib::OptionalDependency version >=14754 required(.*)[- ]+perl m
notes => $this->toolsdir . "/shbtest2",
);

$pkg2->finish();
undef $pkg2;

eval { rmtree($tempdir) };
Expand Down Expand Up @@ -1579,7 +1575,6 @@ DONE

$this->assert( $pkg->uninstall($reporter) );
$this->sniff();
$pkg->finish();
undef $pkg;

#
Expand Down Expand Up @@ -1667,7 +1662,6 @@ qr/Foswiki::Plugins::RequiredTriggeredModule version >=0.1 required[- ]+perl mod
warnings => "htmldoc is type 'c', and cannot be automatically checked."
);

$pkg->finish();
undef $pkg;

eval { rmtree($tempdir) };
Expand Down Expand Up @@ -1912,7 +1906,6 @@ sub test_Package_loadInstaller {

$this->assert_str_equals( '1', $plugins{EmptyPlugin},
'Failed to discover plugin in manifest' );
$pkg->finish();
undef $pkg;

return;
Expand Down Expand Up @@ -2012,7 +2005,6 @@ DONE
$this->sniff( errors => 'Failed to unpack archive(.*)MyPlugin.tgz' );

unlink $tempdir . "/MyPlugin.tgz";
$pkg->finish();
undef $pkg;

return;
Expand Down Expand Up @@ -2072,7 +2064,6 @@ DONE
$this->assert( !$pkg->install($reporter) );
$this->sniff( errors => '(format error|unzip failed|Unpack failed)' );
unlink $tempdir . "/MyPlugin.zip";
$pkg->finish();
undef $pkg;

return;
Expand Down
3 changes: 1 addition & 2 deletions UnitTestContrib/test/unit/Fn_FORMAT.pm
Expand Up @@ -231,7 +231,6 @@ HERE
}
);
$topicObject->save();
$topicObject->finish();
}

sub test_same_topic_listed_twice {
Expand Down Expand Up @@ -357,7 +356,7 @@ sub test_formatOfLinks {
Apache is the [[http://www.apache.org/httpd/][well known web server]].
HERE
$topicObject->save();
$topicObject->finish();
undef $topicObject;

my $result =
$this->test_topicObject->expandMacros(
Expand Down
7 changes: 3 additions & 4 deletions UnitTestContrib/test/unit/Fn_FORMFIELD.pm
Expand Up @@ -37,7 +37,7 @@ sub _createTopic {
| Summary | textarea | 100 |
FORM
$formTopicObject->save();
$formTopicObject->finish();
undef $formTopicObject;

$topicObject->put( 'FORM', { name => 'TestForm' } );
$topicObject->putKeyed( 'FIELD',
Expand Down Expand Up @@ -170,7 +170,7 @@ sub test_FORMFIELD_topic {
$result = $topicObject->expandMacros(
'%FORMFIELD{"Marjorie" topic="' . $this->test_topic . '"}%' );
$this->assert_str_equals( '99', $result );
$topicObject->finish;
undef $topicObject;
($topicObject) = Foswiki::Func::readTopic( $Foswiki::cfg{SystemWebName},
$Foswiki::cfg{HomeTopicName} );
$result = $topicObject->expandMacros(
Expand All @@ -182,7 +182,6 @@ sub test_FORMFIELD_topic {
. $this->test_topic
. '"}%' );
$this->assert_str_equals( '99', $result );
$topicObject->finish;
}
# web="..."
Expand All @@ -192,7 +191,7 @@ sub test_FORMFIELD_web {
# create other web
$this->other_web( $this->test_web . "other" );
my $webObject = $this->populateNewWeb( $this->other_web );
$webObject->finish();
undef $webObject;
my ($topicObject) =
Foswiki::Func::readTopic( $this->other_web, $this->test_topic );
$this->_createTopic( $this->other_web, $topicObject );
Expand Down
21 changes: 10 additions & 11 deletions UnitTestContrib/test/unit/Fn_GROUPINFO.pm
Expand Up @@ -28,49 +28,48 @@ around set_up => sub {
Foswiki::Func::readTopic( $this->users_web, "GropeGroup" );
$topicObject->text(" * Set GROUP = ScumBag,WikiGuest\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;
($topicObject) = Foswiki::Func::readTopic( $this->users_web, "PopGroup" );
$topicObject->text(" * Set GROUP = WikiGuest\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;
($topicObject) =
Foswiki::Func::readTopic( $this->users_web, "NobodyGroup" );
$topicObject->text(" * Set GROUP = \n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;
($topicObject) =
Foswiki::Func::readTopic( $this->users_web, "NestingGroup" );
$topicObject->text(" * Set GROUP = GropeGroup\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;
($topicObject) =
Foswiki::Func::readTopic( $this->users_web, "OnlyAdminCanChangeGroup" );
$topicObject->text(
" * Set GROUP = WikiGuest\n * Set TOPICCHANGE = AdminGroup\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;
($topicObject) =
Foswiki::Func::readTopic( $this->users_web, "GroupWithHiddenGroup" );
$topicObject->text(" * Set GROUP = HiddenGroup,WikiGuest\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;
($topicObject) =
Foswiki::Func::readTopic( $this->users_web, "HiddenGroup" );
$topicObject->text(
" * Set GROUP = ScumBag\n * Set ALLOWTOPICVIEW = AdminUser\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;
($topicObject) =
Foswiki::Func::readTopic( $this->users_web, "HiddenUserGroup" );
$topicObject->text(" * Set GROUP = ScumBag,HidemeGood\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;
($topicObject) = Foswiki::Func::readTopic( $this->users_web, "HidemeGood" );
my $topText = $topicObject->text();
$topText .= " * Set ALLOWTOPICVIEW = AdminUser\n";
$topText = $topicObject->text($topText);
$topicObject->save();
$topicObject->finish();
};

sub test_basic {
Expand Down Expand Up @@ -226,7 +225,7 @@ sub test_expandHiddenUserAsAdmin {
my $this = shift;

$this->createNewFoswikiSession( $Foswiki::cfg{AdminUserLogin} );
$this->test_topicObject->finish if $this->test_topicObject;
$this->clear_test_topicObject;
$this->test_topicObject(
Foswiki::Func::readTopic( $this->test_web, $this->test_topic ) );
$this->test_topicObject->text("BLEEGLE\n");
Expand All @@ -240,7 +239,7 @@ sub test_expandHiddenUserAsAdmin {
$this->assert_matches( qr/$users_web.HidemeGood/, $ui );
my @u = split( /,/, $ui );
$this->assert_equals( 2, scalar(@u) );
$this->test_topicObject->finish;
$this->clear_test_topicObject;

return;
}
Expand Down
11 changes: 5 additions & 6 deletions UnitTestContrib/test/unit/Fn_GROUPS.pm
Expand Up @@ -23,37 +23,36 @@ around set_up => sub {
Foswiki::Func::readTopic( $this->users_web, "GropeGroup" );
$topicObject->text(" * Set GROUP = ScumBag,WikiGuest\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;

($topicObject) =
Foswiki::Func::readTopic( $this->users_web, "NestingGroup" );
$topicObject->text(" * Set GROUP = GropeGroup\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;
($topicObject) =
Foswiki::Func::readTopic( $this->users_web, "GroupWithHiddenGroup" );
$topicObject->text(" * Set GROUP = HiddenGroup,WikiGuest\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;
($topicObject) =
Foswiki::Func::readTopic( $this->users_web, "HiddenGroup" );
$topicObject->text(
" * Set GROUP = ScumBag\n * Set ALLOWTOPICVIEW = AdminUser\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;

($topicObject) =
Foswiki::Func::readTopic( $this->users_web, "HiddenUserGroup" );
$topicObject->text(" * Set GROUP = ScumBag,HidemeGood\n");
$topicObject->save();
$topicObject->finish();
undef $topicObject;

($topicObject) = Foswiki::Func::readTopic( $this->users_web, "HidemeGood" );
my $topText = $topicObject->text();
$topText .= " * Set ALLOWTOPICVIEW = AdminUser\n";
$topText = $topicObject->text($topText);
$topicObject->save();
$topicObject->finish();

};

Expand Down
17 changes: 8 additions & 9 deletions UnitTestContrib/test/unit/Fn_IF.pm
Expand Up @@ -1316,14 +1316,13 @@ sub set_up {
. Foswiki::Func::getWikiName( $this->session->user )
. "\n" );
$topicObject->save();
$topicObject->finish();
undef $topicObject;

# Create WebHome topic to trap existance errors related to
# normalizeWebTopicName
($topicObject) = Foswiki::Func::readTopic( $this->test_web, "WebHome" );
$topicObject->text("Gormless gimboid\n");
$topicObject->save();
$topicObject->finish();

return;
}
Expand Down Expand Up @@ -1374,7 +1373,7 @@ two %IF{ "$ NAME='%NAME%'" then="1" else="0" }%
three %IF{ "$ NAME=$ 'NAME{}'" then="1" else="0" }%
SMELL
$topicObject->save();
$topicObject->finish();
undef $topicObject;
my $text = <<'PONG';
%INCLUDE{"DeadHerring" NAME="Red" warn="on"}%
PONG
Expand Down Expand Up @@ -1419,7 +1418,7 @@ one %IF{ "BleaghForm.Wibble='Woo'" then="1" else="0" }%
%META:FIELD{name="Wibble" title="Wobble" value="Woo"}%
SMELL
$topicObject->save();
$topicObject->finish();
undef $topicObject;
my $text = <<'PONG';
%INCLUDE{"DeadHerring" NAME="Red" warn="on"}%
PONG
Expand All @@ -1438,7 +1437,7 @@ sub test_ALLOWS_and_EXISTS {
* Set ALLOWTOPICCHANGE = $wn
PONG
$meta->save();
$meta->finish();
undef $meta;

my @tests;
push(
Expand Down Expand Up @@ -1587,7 +1586,7 @@ PONG
$this->assert_str_equals( $test->{expect}, $result,
"$text: '$result'" );
}
$meta->finish();
undef $meta;

return;
}
Expand All @@ -1601,7 +1600,7 @@ PONG
Foswiki::Func::readTopic( $this->test_web, $this->test_topic );
$topicObject->text($text);
$topicObject->save();
$topicObject->finish();
undef $topicObject;
my $result = $this->test_topicObject->expandMacros($text);
$this->assert_str_equals( " * Set LOOP = pong\n", $result );

Expand All @@ -1618,7 +1617,7 @@ sub test_TOPICINFO {
oneapeny twoapenny we all fall down
PONG
$meta->save();
$meta->finish();
undef $meta;

($meta) = Foswiki::Func::readTopic( $this->test_web, $topicName );
$meta->getRevisionInfo();
Expand Down Expand Up @@ -1689,7 +1688,7 @@ PONG
$this->assert_str_equals( $test->{expect}, $result,
"$text: '$result'" );
}
$meta->finish();
undef $meta;

return;
}
Expand Down
1 change: 0 additions & 1 deletion UnitTestContrib/test/unit/Fn_INCLUDE.pm
Expand Up @@ -26,7 +26,6 @@ around set_up => sub {
$orig->( $this, @_ );
$this->other_web( $this->test_web . "other" );
my $webObject = $this->populateNewWeb( $this->other_web );
$webObject->finish();
};

around tear_down => sub {
Expand Down

0 comments on commit dae8e37

Please sign in to comment.