Skip to content
Permalink
Browse files

Item9970: Trying to add some unit tests to catch formfield 0 problems…

… in future

This one actually does not catch the problem with 9970 but it is still a nice test to have


git-svn-id: http://svn.foswiki.org/branches/Release01x01@9892 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
KennethLavrsen KennethLavrsen
KennethLavrsen authored and KennethLavrsen committed Nov 7, 2010
1 parent 73d07f6 commit b094959f00d1d14d31dc4ba7b86aad6ea62e6cc1
Showing with 27 additions and 0 deletions.
  1. +27 −0 UnitTestContrib/test/unit/MetaTests.pm
@@ -98,6 +98,33 @@ sub test_multiple {
$this->assert_str_equals( $vals2->{"value"}, "3" );
}

# Field with value 0 and value '' This does not cover Item8738
sub test_zero_empty {
my $this = shift;
my $meta = Foswiki::Meta->new( $this->{session}, $web, $topic );

my $args_zero = {
name => "a",
value => "0"
};

my $args_empty = {
name => "b",
value => ""
};

$meta->putKeyed( "FIELD", $args_zero );
$meta->putKeyed( "FIELD", $args_empty );

my $vals1 = $meta->get( "FIELD", "a" );
$this->assert_str_equals( $vals1->{"name"}, "a" );
$this->assert_str_equals( $vals1->{"value"}, "0" );

my $vals2 = $meta->get( "FIELD", "b" );
$this->assert_str_equals( $vals2->{"name"}, "b" );
$this->assert_str_equals( $vals2->{"value"}, "" );
}

sub test_removeSingle {
my $this = shift;
my $meta = Foswiki::Meta->new( $this->{session}, $web, $topic );

0 comments on commit b094959

Please sign in to comment.
You can’t perform that action at this time.