Skip to content

Commit

Permalink
Item11983: more details to try to show where the extra \n comes from
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@15391 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Sep 19, 2012
1 parent 4bd3d85 commit 4fc6763
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
7 changes: 7 additions & 0 deletions UnitTestContrib/test/unit/SaveScriptTests.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,10 @@ sub test_1897 {
$meta->text("Smelly\ncat");
$meta->save();
$meta->finish();
my $rawFirst =
Foswiki::Func::readTopicText( $this->{test_web}, 'MergeSave' );
($meta) = Foswiki::Func::readTopic( $this->{test_web}, 'MergeSave' );
my $text = $meta->text();
my $info = $meta->getRevisionInfo();
Expand All @@ -1182,6 +1186,9 @@ sub test_1897 {
);
$this->createNewFoswikiSession( $this->{test_user_login}, $query );
$this->captureWithKey( save => $UI_FN, $this->{session} );
my $rawSecond =
Foswiki::Func::readTopicText( $this->{test_web}, 'MergeSave' );
$this->assert_equals( $rawFirst, $rawSecond );
# make sure it's still rev 1 as expected
($meta) = Foswiki::Func::readTopic( $this->{test_web}, 'MergeSave' );
Expand Down
51 changes: 51 additions & 0 deletions UnitTestContrib/test/unit/SerialiseTests.pm
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,55 @@ sub test_SimpleMetaTopic {
return;
}

# Create a simple topic containing meta-data
sub test_SimpleTopic {
my $this = shift;

my $meta =
Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'TestTopic' );

$meta->text("Onceler\njumped");

my $text = $meta->getEmbeddedStoreForm();

my $metaFromSerialised =
Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'TestTopic' );
$metaFromSerialised->setEmbeddedStoreForm($text);

my $textAgain = $metaFromSerialised->getEmbeddedStoreForm();

$this->assert_equals( $text, $textAgain );

return;
}

# Create a simple topic containing meta-data
sub test_SimpleTopicSave {
my $this = shift;

my $meta =
Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'TestTopic' );

$meta->text("Onceler\njumped");

my $text = $meta->getEmbeddedStoreForm();

$meta->save();
$meta->finish();

my $rawFirst =
Foswiki::Func::readTopicText( $this->{test_web}, 'TestTopic' );

#remove the TOPICINFO
$rawFirst =~ s/^%META:TOPICINFO{.*?}%\n//m;

$this->assert_equals( $text, $rawFirst );

my ( $newmeta, $t ) =
Foswiki::Func::readTopic( $this->{test_web}, 'TestTopic' );
$this->assert_equals( $text, $newmeta->text() );

return;
}

1;

0 comments on commit 4fc6763

Please sign in to comment.