Changeset 6375
- Timestamp:
- 02/16/10 20:14:58 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UnitTestContrib/test/unit/ExpandMacrosTests.pm
r6315 r6375 153 153 HERE 154 154 {_RAW=>$dontCare, cheese=>'blue', say=>'bye!' }); 155 $this->assert_str_equals("1$macroWasHere Not part of the macro \nNor this either\n", $result);155 $this->assert_str_equals("1$macroWasHere Not part of the macroNor this either\n", $result); 156 156 } 157 157 … … 166 166 . " Nor this either\n", 167 167 {_RAW=>$dontCare, cheese=>'blue', say=>' bye! ' }); 168 $this->assert_str_equals("1$macroWasHere Not part of the macro \nNor this either\n", $result);168 $this->assert_str_equals("1$macroWasHere Not part of the macro Nor this either\n", $result); 169 169 } 170 170 … … 175 175 before macro %MACRO{value=<<_10}% after macro 176 176 _10%_ 177 _10 178 _10 more 179 less _10 177 180 _10 181 178 182 after end marker 179 183 HERE 180 {_RAW=>$dontCare, value=> '_10%_'});184 {_RAW=>$dontCare, value=>"_10%_\n _10\n_10 more\nless _10" }); 181 185 $this->assert_str_equals("before macro 1$macroWasHere after macro\nafter end marker\n", $result); 182 186 } … … 190 194 ping 191 195 HERE 192 ba z196 bar 193 197 END 194 198 {_RAW=>$dontCare, _DEFAULT=>"ping" }); 195 $this->assert_str_equals("wurble1${macroWasHere}blegh $expandedWikiName foo \nbaz\n", $result);199 $this->assert_str_equals("wurble1${macroWasHere}blegh $expandedWikiName foobar\n", $result); 196 200 } 197 201 … … 217 221 HERE 218 222 END 219 $this->assert_str_equals("One Hump,Two Eyes,Three Teeth \n", $result);223 $this->assert_str_equals("One Hump,Two Eyes,Three Teeth", $result); 220 224 } 221 225 … … 230 234 ENCODE 231 235 END 232 $this->assert_str_equals("%25topic,%25topic,%25topic \n", $result);236 $this->assert_str_equals("%25topic,%25topic,%25topic", $result); 233 237 } 234 238 … … 249 253 {_RAW=>$dontCare, _DEFAULT=>'orange', which=>'three'} 250 254 ); 255 $this->assert_str_equals("1$macroWasHere\\,2$macroWasHere\\,3$macroWasHere\\", $result); 256 } 257 258 sub test_nestedHereDocOrderOfEvaluationOuterFirstWithNewline { 259 my $this = shift; 260 261 # Tests the case where inner macros are expanded after outer macro 262 my $result = $this->_testExpand(<<'END', 263 %FOREACH{"one,two,three" format=<<HERE separator=","}% 264 %MACRO{<<PURPLE which="$topic"}%\ 265 orange 266 PURPLE 267 268 269 HERE 270 271 END 272 {_RAW=>$dontCare, _DEFAULT=>'orange', which=>'one'}, 273 {_RAW=>$dontCare, _DEFAULT=>'orange', which=>'two'}, 274 {_RAW=>$dontCare, _DEFAULT=>'orange', which=>'three'} 275 ); 251 276 $this->assert_str_equals("1$macroWasHere\\\n,2$macroWasHere\\\n,3$macroWasHere\\\n\n", $result); 252 277 } … … 263 288 HERE 264 289 END 265 $this->assert_str_equals("1$macroWasHere,1$macroWasHere,1$macroWasHere \n", $result);290 $this->assert_str_equals("1$macroWasHere,1$macroWasHere,1$macroWasHere", $result); 266 291 } 267 292 … … 281 306 282 307 $result = $this->_expand("%BAR{ foo=<<HERE }%twibble\nignored\nHERE\nspoon"); 283 $this->assert_str_equals("bartwibble \nspoon", $result);308 $this->assert_str_equals("bartwibblespoon", $result); 284 309 285 310 } … … 291 316 my $result = $this->_expand('%MACRO{"bar"}%'); 292 317 $this->assert_str_equals('foo', $result); 318 319 } 320 321 sub test_newlines { 322 my $this = shift; 323 my $result = $this->_testExpand('a%MACRO%b', 324 {_RAW=>$dontCare} 325 ); 326 $this->assert_str_equals("a1${macroWasHere}b", $result); 327 328 $result = $this->_testExpand("a%MACRO%b\n", 329 {_RAW=>$dontCare} 330 ); 331 $this->assert_str_equals("a1${macroWasHere}b\n", $result); 332 333 $result = $this->_testExpand("a%MACRO{<<HERE}%b\nHERE", 334 {_RAW=>$dontCare, _DEFAULT=>""} 335 ); 336 $this->assert_str_equals("a1${macroWasHere}b", $result); 337 338 $result = $this->_testExpand("a%MACRO{<<HERE}%b\nHERE\n", 339 {_RAW=>$dontCare, _DEFAULT=>""} 340 ); 341 $this->assert_str_equals("a1${macroWasHere}b", $result); 342 343 $result = $this->_testExpand("a%MACRO{<<HERE}%b\nHERE\n\n", 344 {_RAW=>$dontCare, _DEFAULT=>""} 345 ); 346 $this->assert_str_equals("a1${macroWasHere}b\n", $result); 347 348 $result = $this->_testExpand("a%MACRO{<<HERE}%b\n\nHERE", 349 {_RAW=>$dontCare, _DEFAULT=>""} 350 ); 351 $this->assert_str_equals("a1${macroWasHere}b", $result); 352 353 $result = $this->_testExpand("a%MACRO{<<HERE}%b\n\nHERE\n", 354 {_RAW=>$dontCare, _DEFAULT=>""} 355 ); 356 $this->assert_str_equals("a1${macroWasHere}b", $result); 357 358 $result = $this->_testExpand("a%MACRO{<<HERE}%b\n\nHERE\n\n", 359 {_RAW=>$dontCare, _DEFAULT=>""} 360 ); 361 $this->assert_str_equals("a1${macroWasHere}b\n", $result); 362 363 $result = $this->_testExpand("a%MACRO{<<HERE}%b\n\n\nHERE", 364 {_RAW=>$dontCare, _DEFAULT=>"\n"} 365 ); 366 $this->assert_str_equals("a1${macroWasHere}b", $result); 367 368 $result = $this->_testExpand("a%MACRO{<<HERE}%b\n\n\nHERE\n", 369 {_RAW=>$dontCare, _DEFAULT=>"\n"} 370 ); 371 $this->assert_str_equals("a1${macroWasHere}b", $result); 372 373 $result = $this->_testExpand("a%MACRO{<<HERE}%b\n\n\nHERE\n\n", 374 {_RAW=>$dontCare, _DEFAULT=>"\n"} 375 ); 376 $this->assert_str_equals("a1${macroWasHere}b\n", $result); 293 377 294 378 }
Note: See TracChangeset
for help on using the changeset viewer.
