Changeset 816 for trunk/UnitTestContrib/test/unit/AttrsTests.pm
- Timestamp:
- 11/19/08 19:11:33 (4 years ago)
- File:
-
- 1 edited
-
trunk/UnitTestContrib/test/unit/AttrsTests.pm (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/UnitTestContrib/test/unit/AttrsTests.pm
r14 r816 3 3 package AttrsTests; 4 4 5 use base qw( TWikiTestCase);6 7 use TWiki::Attrs;5 use base qw(FoswikiTestCase); 6 7 use Foswiki::Attrs; 8 8 9 9 sub new { … … 15 15 my $this = shift; 16 16 17 my $attrs = TWiki::Attrs->new(undef, 1);18 $this->assert($attrs->isEmpty()); 19 $attrs = TWiki::Attrs->new("", 1);20 $this->assert($attrs->isEmpty()); 21 $attrs = TWiki::Attrs->new(" \t \n\t", 1);17 my $attrs = Foswiki::Attrs->new(undef, 1); 18 $this->assert($attrs->isEmpty()); 19 $attrs = Foswiki::Attrs->new("", 1); 20 $this->assert($attrs->isEmpty()); 21 $attrs = Foswiki::Attrs->new(" \t \n\t", 1); 22 22 $this->assert($attrs->isEmpty()); 23 23 } … … 26 26 my $this = shift; 27 27 28 my $attrs = TWiki::Attrs->new("a", 1);28 my $attrs = Foswiki::Attrs->new("a", 1); 29 29 $this->assert(!$attrs->isEmpty()); 30 30 $this->assert_not_null($attrs->{"a"}); 31 31 $this->assert_str_equals("1", $attrs->{"a"}); 32 32 33 $attrs = TWiki::Attrs->new("a12g b987", 1);33 $attrs = Foswiki::Attrs->new("a12g b987", 1); 34 34 $this->assert_not_null($attrs->remove("a12g")); 35 35 $this->assert_null($attrs->{"a12g"}); … … 38 38 $this->assert($attrs->isEmpty(), "Fail ".$attrs->stringify()); 39 39 40 $attrs = TWiki::Attrs->new("Acid AnhydrousCopperSulphate='white' X", 1);40 $attrs = Foswiki::Attrs->new("Acid AnhydrousCopperSulphate='white' X", 1); 41 41 $this->assert_not_null($attrs->remove("Acid")); 42 42 $this->assert_not_null($attrs->remove("X")); … … 48 48 my $this = shift; 49 49 50 my $attrs = TWiki::Attrs->new("\"wibble\"", 1);50 my $attrs = Foswiki::Attrs->new("\"wibble\"", 1); 51 51 $this->assert(!$attrs->isEmpty()); 52 52 $this->assert_str_equals("wibble", $attrs->remove("_DEFAULT")); … … 54 54 $this->assert($attrs->isEmpty()); 55 55 56 $attrs = TWiki::Attrs->new("\"wibble\" \"fleegle\"", 1);56 $attrs = Foswiki::Attrs->new("\"wibble\" \"fleegle\"", 1); 57 57 $this->assert_str_equals("wibble", $attrs->remove("_DEFAULT")); 58 58 $this->assert($attrs->isEmpty()); … … 62 62 my $this = shift; 63 63 64 my $attrs = TWiki::Attrs->new("var1=val1 var2= val2, var3 = 3 var4 =val4", 1);64 my $attrs = Foswiki::Attrs->new("var1=val1 var2= val2, var3 = 3 var4 =val4", 1); 65 65 $this->assert_str_equals("val1", $attrs->remove("var1")); 66 66 $this->assert_str_equals("val2", $attrs->remove("var2")); … … 73 73 my $this = shift; 74 74 75 my $attrs = TWiki::Attrs->new("var1=\\\"val1 var2= \\\'val2, var3 = 3 var4 =val4", 1);75 my $attrs = Foswiki::Attrs->new("var1=\\\"val1 var2= \\\'val2, var3 = 3 var4 =val4", 1); 76 76 $this->assert_str_equals("\"val1", $attrs->remove("var1")); 77 77 $this->assert_str_equals("\'val2", $attrs->remove("var2")); … … 84 84 my $this = shift; 85 85 86 my $attrs = TWiki::Attrs->new("var1 =\"val 1\", var2= \"val 2\" \" default \" var3 = \" val 3 \"", 1);86 my $attrs = Foswiki::Attrs->new("var1 =\"val 1\", var2= \"val 2\" \" default \" var3 = \" val 3 \"", 1); 87 87 $this->assert_str_equals("val 1", $attrs->remove("var1")); 88 88 $this->assert_str_equals("val 2", $attrs->remove("var2")); … … 95 95 my $this = shift; 96 96 97 my $attrs = TWiki::Attrs->new("var1 ='val 1', var2= 'val 2' ' default ' var3 = ' val 3 '", 1);97 my $attrs = Foswiki::Attrs->new("var1 ='val 1', var2= 'val 2' ' default ' var3 = ' val 3 '", 1); 98 98 $this->assert_str_equals("val 1", $attrs->remove("var1")); 99 99 $this->assert_str_equals("val 2", $attrs->remove("var2")); … … 106 106 my $this = shift; 107 107 108 my $attrs = TWiki::Attrs->new("a ='\"', b=\"'\" \"'\"", 1);108 my $attrs = Foswiki::Attrs->new("a ='\"', b=\"'\" \"'\"", 1); 109 109 $this->assert_str_equals("\"", $attrs->remove("a")); 110 110 $this->assert_str_equals("'", $attrs->remove("b")); 111 111 $this->assert_str_equals("'", $attrs->remove("_DEFAULT")); 112 112 $this->assert($attrs->isEmpty()); 113 $attrs = TWiki::Attrs->new("'\"'", 1);113 $attrs = Foswiki::Attrs->new("'\"'", 1); 114 114 $this->assert_str_equals("\"", $attrs->remove("_DEFAULT")); 115 115 $this->assert($attrs->isEmpty()); … … 119 119 my $this = shift; 120 120 121 my $attrs = TWiki::Attrs->new("a ='\"', b=\"'\" \"'\"", 1);121 my $attrs = Foswiki::Attrs->new("a ='\"', b=\"'\" \"'\"", 1); 122 122 my $s = $attrs->stringify(); 123 $attrs = TWiki::Attrs->new($attrs->stringify(), 1);123 $attrs = Foswiki::Attrs->new($attrs->stringify(), 1); 124 124 $this->assert_str_equals("\"", $attrs->remove("a")); 125 125 $this->assert_str_equals("'", $attrs->remove("b")); … … 133 133 my $s = '"abc def="ghi" jkl" def="mno" pqr=" stu="vwx""'; 134 134 $this->assert_str_equals('abc def="ghi" jkl', 135 TWiki::Attrs::extractValue($s));135 Foswiki::Attrs::extractValue($s)); 136 136 } 137 137 … … 141 141 my $s = '"abc def="ghi" jkl" def="mno" pqr=" stu="vwx""'; 142 142 $this->assert_str_equals('ghi', 143 TWiki::Attrs::extractValue($s, "def"));143 Foswiki::Attrs::extractValue($s, "def")); 144 144 } 145 145 … … 149 149 my $s = '"abc def="ghi" jkl" def="mno" pqr=" stu="vwx""'; 150 150 $this->assert_str_equals('', 151 TWiki::Attrs::extractValue($s, "jkl"));151 Foswiki::Attrs::extractValue($s, "jkl")); 152 152 } 153 153 … … 157 157 my $s = '"abc def="ghi" jkl" def="mno" pqr=" stu="vwx""'; 158 158 $this->assert_str_equals(' stu=', 159 TWiki::Attrs::extractValue($s, 'pqr'));159 Foswiki::Attrs::extractValue($s, 'pqr')); 160 160 } 161 161 … … 165 165 my $s = '"abc def="ghi" jkl" def="mno" pqr=" stu="vwx""'; 166 166 $this->assert_str_equals('vwx', 167 TWiki::Attrs::extractValue($s, 'stu'));167 Foswiki::Attrs::extractValue($s, 'stu')); 168 168 } 169 169 … … 217 217 my( $this, $s ) = @_; 218 218 219 my $new = new TWiki::Attrs($s,0);219 my $new = new Foswiki::Attrs($s,0); 220 220 my %old = extractParameters($s); 221 221 … … 253 253 my $this = shift; 254 254 my $s = "\nBarf"; 255 my $new = new TWiki::Attrs($s,0);255 my $new = new Foswiki::Attrs($s,0); 256 256 $s = "Barf\n"; 257 $new = new TWiki::Attrs($s,0);257 $new = new Foswiki::Attrs($s,0); 258 258 $s = "\n"; 259 $new = new TWiki::Attrs($s,0);259 $new = new Foswiki::Attrs($s,0); 260 260 $s = "\"The\nCat\" format=\"Shat\nOn\nThe\nMat\""; 261 261 $this->check_string( $s ); … … 265 265 my $this = shift; 266 266 my $s = " Barf"; 267 my $new = new TWiki::Attrs($s,0);267 my $new = new Foswiki::Attrs($s,0); 268 268 $this->assert_str_equals($s, $new->{_RAW}); 269 269 }
Note: See TracChangeset
for help on using the changeset viewer.
