Skip to content

Commit

Permalink
Item9352: now the unit tests for 01x00
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/branches/Release01x00@8244 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
AndrewJones authored and AndrewJones committed Jul 19, 2010
1 parent 2a8f56f commit b5a4673
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions UnitTestContrib/test/unit/FuncTests.pm
Expand Up @@ -670,6 +670,41 @@ sub test_moveAttachment {

}

sub test_attachmentExists {
my $this = shift;

my $topic = "AttachmentExists";

open( FILE, ">", "$Foswiki::cfg{TempfileDir}/testfile.txt" );
print FILE "one two three";
close( FILE );

Foswiki::Func::saveTopicText( $this->{test_web}, $topic, 'foo' );
Foswiki::Func::saveAttachment(
$this->{test_web}, $topic, "testfile.txt",
{ file => "$Foswiki::cfg{TempfileDir}/testfile.txt",
comment => "a comment" } );

$this->assert(Foswiki::Func::attachmentExists( $this->{test_web}, $topic,
"testfile.txt"));
}

sub test_attachmentExistsInMetaOnly {
my $this = shift;

my $topic = "AttachmentExistsInMetaOnly";
my $text = <<'HERE';
foo
%META:FILEATTACHMENT{name="Sample.txt" attr="" comment="Just a sample" date="964294620" path="Sample.txt" size="30" user="ProjectContributor" version=""}%
HERE

Foswiki::Func::saveTopicText( $this->{test_web}, $topic, $text );

$this->assert(not Foswiki::Func::attachmentExists( $this->{test_web}, $topic,
"Sample.txt"));
}

sub test_workarea {
my $this = shift;

Expand Down

0 comments on commit b5a4673

Please sign in to comment.