Changeset 13835
- Timestamp:
- 01/27/12 04:43:16 (4 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Release01x01/UnitTestContrib/test/unit/Fn_SEARCH.pm
r13729 r13835 1 1 # tests for the correct expansion of SEARCH 2 2 # SMELL: this test is pathetic, becase SEARCH has dozens of untested modes 3 3 # 4 # In order to keep this test down to a manageable run time, the fixture 5 # groups are only applied to those tests where we are testing the correct 6 # parsing of the search expression and its correct application in searching. 7 # Where we are primarily testing formatting and pagination, we keep the 8 # test out of the fixture groups on the assumption that all search and 9 # query algorithms output is formatted by the same code. 10 # 11 # NOTE: When developing, or after modifying search or query algorithms, 12 # you are highly recommended to run this suite with the "test" functions 13 # converted to "verify" - just in case! 14 # 4 15 package Fn_SEARCH; 5 16 … … 7 18 use warnings; 8 19 9 use FoswikiFnTestCase ;20 use FoswikiFnTestCase(); 10 21 our @ISA = qw( FoswikiFnTestCase ); 11 22 12 use Foswiki ;23 use Foswiki(); 13 24 use Error qw( :try ); 14 25 use Assert; 15 use Foswiki::Search;16 use Foswiki::Search ::InfoCache;17 use Foswiki:: Render;26 use English qw( -no_match_vars ); 27 use Foswiki::Search(); 28 use Foswiki::Search::InfoCache(); 18 29 19 30 use File::Spec qw(case_tolerant) … … 21 32 22 33 sub new { 23 my $self = shift()->SUPER::new( 'SEARCH', @_ ); 34 my ( $class, @args ) = @_; 35 my $self = $class->SUPER::new( 'SEARCH', @args ); 36 24 37 return $self; 25 38 } … … 34 47 35 48 sub set_up { 36 my $this = shift; 37 38 $this->SUPER::set_up(); 39 40 my $topicObject = 41 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'OkTopic', 42 "BLEEGLE blah/matchme.blah" ); 43 $topicObject->save(); 44 $topicObject = 45 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'OkATopic', 46 "BLEEGLE dontmatchme.blah" ); 47 $topicObject->save(); 48 $topicObject = 49 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'OkBTopic', 50 "BLEEGLE dont.matchmeblah" ); 51 $topicObject->save(); 49 my ($this) = shift; 50 $this->SUPER::set_up(@_); 51 52 my $timestamp = time(); 53 54 my ($topicObject) = 55 Foswiki::Func::readTopic( $this->{test_web}, 'OkTopic' ); 56 $topicObject->text("BLEEGLE blah/matchme.blah"); 57 $topicObject->save( forcedate => $timestamp + 120 ); 58 $topicObject->finish(); 59 ($topicObject) = Foswiki::Func::readTopic( $this->{test_web}, 'OkATopic' ); 60 $topicObject->text("BLEEGLE dontmatchme.blah"); 61 $topicObject->save( forcedate => $timestamp + 240 ); 62 $topicObject->finish(); 63 ($topicObject) = Foswiki::Func::readTopic( $this->{test_web}, 'OkBTopic' ); 64 $topicObject->text("BLEEGLE dont.matchmeblah"); 65 $topicObject->save( forcedate => $timestamp + 480 ); 66 $topicObject->finish(); 67 68 ($topicObject) = 69 Foswiki::Func::readTopic( $this->{test_web}, 'InvisibleTopic' ); 70 $topicObject->text("BLEEGLE dont.matchmeblah"); 71 $topicObject->putKeyed( 'PREFERENCE', 72 { name => 'ALLOWTOPICVIEW', value => 'OnlySuperman' } ); 73 $topicObject->save( forcedate => $timestamp + 480 ); 74 $topicObject->finish(); 75 76 return; 52 77 } 53 78 … … 60 85 next unless $alg =~ /^(.*)\.pm$/; 61 86 $alg = $1; 62 if ( $^O eq 'MSWin32' ) { 63 64 #skip forking search for now, its extremely broken on windows 65 next if ( $alg eq 'Forking' ); 66 } 87 88 # skip forking search for now, its extremely broken 89 # on windows 90 next if ( $^O eq 'MSWin32' && $alg eq 'Forking' ); 67 91 $salgs{$alg} = 1; 68 92 } … … 82 106 my $fn = $alg . 'Search'; 83 107 push( @groups, $fn ); 84 next if ( defined( &$fn) );85 eval <<SUB;108 next if ( defined( &{$fn} ) ); 109 if ( not eval <<"SUB" or $EVAL_ERROR ) { 86 110 sub $fn { 87 require Foswiki::Store::SearchAlgorithms::$alg; 88 \$Foswiki::cfg{Store}{SearchAlgorithm} = 'Foswiki::Store::SearchAlgorithms::$alg'; } 111 require Foswiki::Store::SearchAlgorithms::$alg; 112 \$Foswiki::cfg{Store}{SearchAlgorithm} = 'Foswiki::Store::SearchAlgorithms::$alg'; 113 } 114 1; 89 115 SUB 90 die $@ if $@; 116 die $EVAL_ERROR; 117 } 91 118 } 92 119 foreach my $alg ( keys %qalgs ) { … … 94 121 push( @groups, $fn ); 95 122 next if ( defined(&$fn) ); 96 eval <<SUB;123 if ( not eval <<"SUB" or $EVAL_ERROR ) { 97 124 sub $fn { 98 require Foswiki::Store::QueryAlgorithms::$alg; 99 \$Foswiki::cfg{Store}{QueryAlgorithm} = 'Foswiki::Store::QueryAlgorithms::$alg'; } 125 require Foswiki::Store::QueryAlgorithms::$alg; 126 \$Foswiki::cfg{Store}{QueryAlgorithm} = 'Foswiki::Store::QueryAlgorithms::$alg'; 127 } 128 1; 100 129 SUB 101 die $@ if $@; 130 die $EVAL_ERROR; 131 } 102 132 } 103 133 104 return \@groups;134 return ( \@groups ); 105 135 } 106 136 107 137 sub loadExtraConfig { 138 my ( $this, $context, @args ) = @_; # the Test::Unit::TestCase object 139 140 $this->SUPER::loadExtraConfig( $context, @args ); 141 142 #turn on the MongoDBPlugin so that the saved data goes into mongoDB 143 #This is temoprary until Crawford and I cna find a way to push dependencies into unit tests 144 if ( ( $Foswiki::cfg{Store}{SearchAlgorithm} =~ /MongoDB/ ) 145 or ( $Foswiki::cfg{Store}{QueryAlgorithm} =~ /MongoDB/ ) 146 or ( $context =~ /MongoDB/ ) ) 147 { 148 $Foswiki::cfg{Plugins}{MongoDBPlugin}{Module} = 149 'Foswiki::Plugins::MongoDBPlugin'; 150 $Foswiki::cfg{Plugins}{MongoDBPlugin}{Enabled} = 1; 151 $Foswiki::cfg{Plugins}{MongoDBPlugin}{EnableOnSaveUpdates} = 1; 152 153 #push(@{$Foswiki::cfg{Store}{Listeners}}, 'Foswiki::Plugins::MongoDBPlugin::Listener'); 154 $Foswiki::cfg{Store}{Listeners} 155 {'Foswiki::Plugins::MongoDBPlugin::Listener'} = 1; 156 require Foswiki::Plugins::MongoDBPlugin; 157 Foswiki::Plugins::MongoDBPlugin::getMongoDB() 158 ->remove( $this->{test_web}, 'current', 159 { '_web' => $this->{test_web} } ); 160 } 161 162 return; 163 } 164 165 sub tear_down { 108 166 my $this = shift; # the Test::Unit::TestCase object 109 $this->SUPER::loadExtraConfig(); 167 168 $this->SUPER::tear_down(@_); 169 170 #need to clear the web every test? 171 if ( ( $Foswiki::cfg{Store}{SearchAlgorithm} =~ /MongoDB/ ) 172 or ( $Foswiki::cfg{Store}{QueryAlgorithm} =~ /MongoDB/ ) ) 173 { 174 require Foswiki::Plugins::MongoDBPlugin; 175 Foswiki::Plugins::MongoDBPlugin::getMongoDB() 176 ->remove( $this->{test_web}, 'current', 177 { '_web' => $this->{test_web} } ); 178 } 179 180 return; 110 181 } 111 182 … … 121 192 $this->assert_matches( qr/OkBTopic/, $result ); 122 193 $this->assert_matches( qr/OkATopic/, $result ); 194 195 return; 123 196 } 124 197 … … 131 204 132 205 $this->assert_str_equals( '', $result ); 206 207 return; 133 208 } 134 209 … … 145 220 $this->assert_does_not_match( qr/OkBTopic/, $result ); 146 221 $this->assert_does_not_match( qr/OkATopic/, $result ); 222 223 return; 147 224 } 148 225 … … 160 237 $this->assert_matches( qr/OkBTopic/, $result ); 161 238 $this->assert_matches( qr/OkATopic/, $result ); 239 240 return; 162 241 } 163 242 … … 173 252 $this->assert_matches( qr/OkBTopic/, $result ); 174 253 $this->assert_matches( qr/OkATopic/, $result ); 254 255 return; 175 256 } 176 257 … … 188 269 $this->assert_matches( qr/OkBTopic/, $result ); 189 270 $this->assert_matches( qr/OkATopic/, $result ); 271 272 return; 190 273 } 191 274 … … 203 286 $this->assert_matches( qr/OkBTopic/, $result ); 204 287 $this->assert_matches( qr/OkATopic/, $result ); 288 289 return; 205 290 } 206 291 … … 220 305 # 'blah' is in OkATopic, but not as a word 221 306 $this->assert_does_not_match( qr/OkBTopic/, $result, $result ); 307 308 return; 222 309 } 223 310 … … 225 312 my $this = shift; 226 313 227 my $topicObject=228 Foswiki:: Meta->new( $this->{session}, $this->{test_web}, 'VirtualBeer',229 "There are alot of Virtual Beers to go around");314 my ($topicObject) = 315 Foswiki::Func::readTopic( $this->{test_web}, 'VirtualBeer' ); 316 $topicObject->text("There are alot of Virtual Beers to go around"); 230 317 $topicObject->save(); 231 $topicObject =232 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'RealBeer',233 "There are alot of Virtual Beer to go around");318 $topicObject->finish(); 319 ($topicObject) = Foswiki::Func::readTopic( $this->{test_web}, 'RealBeer' ); 320 $topicObject->text("There are alot of Virtual Beer to go around"); 234 321 $topicObject->save(); 235 $topicObject = 236 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'FamouslyBeered', 237 "Virtually speaking there could be alot of famous Beers" ); 322 $topicObject->finish(); 323 ($topicObject) = 324 Foswiki::Func::readTopic( $this->{test_web}, 'FamouslyBeered' ); 325 $topicObject->text( 326 "Virtually speaking there could be alot of famous Beers"); 238 327 $topicObject->save(); 239 $topicObject = 240 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'VirtualLife', 241 "In a all life, I would expect to find fine Beer" ); 328 $topicObject->finish(); 329 ($topicObject) = 330 Foswiki::Func::readTopic( $this->{test_web}, 'VirtualLife' ); 331 $topicObject->text("In a all life, I would expect to find fine Beer"); 242 332 $topicObject->save(); 333 $topicObject->finish(); 243 334 244 335 my $result = … … 247 338 ); 248 339 249 my $expected = << EXPECT;340 my $expected = <<'EXPECT'; 250 341 RealBeer 251 342 VirtualBeer … … 253 344 EXPECT 254 345 $this->assert_str_equals( $expected, $result . "\n" ); 346 347 return; 255 348 } 256 349 … … 258 351 my $this = shift; 259 352 260 my $topicObject=261 Foswiki:: Meta->new( $this->{session}, $this->{test_web}, 'VirtualBeer',262 "There are alot of Virtual Beers to go around");353 my ($topicObject) = 354 Foswiki::Func::readTopic( $this->{test_web}, 'VirtualBeer' ); 355 $topicObject->text("There are alot of Virtual Beers to go around"); 263 356 $topicObject->save(); 264 $topicObject =265 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'RealBeer',266 "There are alot of Virtual Beer to go around");357 $topicObject->finish(); 358 ($topicObject) = Foswiki::Func::readTopic( $this->{test_web}, 'RealBeer' ); 359 $topicObject->text("There are alot of Virtual Beer to go around"); 267 360 $topicObject->save(); 268 $topicObject = 269 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'FamouslyBeered', 270 "Virtually speaking there could be alot of famous Beers" ); 361 $topicObject->finish(); 362 ($topicObject) = 363 Foswiki::Func::readTopic( $this->{test_web}, 'FamouslyBeered' ); 364 $topicObject->text( 365 "Virtually speaking there could be alot of famous Beers"); 271 366 $topicObject->save(); 272 $topicObject = 273 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'VirtualLife', 274 "In a all life, I would expect to find fine Beer" ); 367 $topicObject->finish(); 368 ($topicObject) = 369 Foswiki::Func::readTopic( $this->{test_web}, 'VirtualLife' ); 370 $topicObject->text("In a all life, I would expect to find fine Beer"); 275 371 $topicObject->save(); 372 $topicObject->finish(); 276 373 277 374 my $result = … … 280 377 ); 281 378 282 my $expected = << EXPECT;379 my $expected = <<'EXPECT'; 283 380 FamouslyBeered 284 381 RealBeer … … 287 384 EXPECT 288 385 $this->assert_str_equals( $expected, $result . "\n" ); 386 387 return; 289 388 } 290 389 … … 292 391 my $this = shift; 293 392 294 my $topicObject=295 Foswiki:: Meta->new( $this->{session}, $this->{test_web}, 'VirtualBeer',296 "There are alot of Virtual Beers to go around");393 my ($topicObject) = 394 Foswiki::Func::readTopic( $this->{test_web}, 'VirtualBeer' ); 395 $topicObject->text("There are alot of Virtual Beers to go around"); 297 396 $topicObject->save(); 298 $topicObject =299 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'RealBeer',300 "There are alot of Virtual Beer to go around");397 $topicObject->finish(); 398 ($topicObject) = Foswiki::Func::readTopic( $this->{test_web}, 'RealBeer' ); 399 $topicObject->text("There are alot of Virtual Beer to go around"); 301 400 $topicObject->save(); 302 $topicObject = 303 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'FamouslyBeered', 304 "Virtually speaking there could be alot of famous Beers" ); 401 $topicObject->finish(); 402 ($topicObject) = 403 Foswiki::Func::readTopic( $this->{test_web}, 'FamouslyBeered' ); 404 $topicObject->text( 405 "Virtually speaking there could be alot of famous Beers"); 305 406 $topicObject->save(); 306 $topicObject = 307 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'VirtualLife', 308 "In a all life, I would expect to find fine Beer" ); 407 $topicObject->finish(); 408 ($topicObject) = 409 Foswiki::Func::readTopic( $this->{test_web}, 'VirtualLife' ); 410 $topicObject->text("In a all life, I would expect to find fine Beer"); 309 411 $topicObject->save(); 412 $topicObject->finish(); 310 413 311 414 my $result = … … 314 417 ); 315 418 316 my $expected = << EXPECT;419 my $expected = <<'EXPECT'; 317 420 RealBeer 318 421 VirtualBeer 319 422 EXPECT 320 423 $this->assert_str_equals( $expected, $result . "\n" ); 321 } 424 425 return; 426 } 427 428 sub _expect_with_deps { 429 my ( $this, $default, %expectations ) = @_; 430 my @deps = sort( keys %expectations ); 431 my $expected; 432 my $checking = 1; 433 434 while ( $checking && scalar(@deps) ) { 435 my $dep = shift(@deps); 436 437 if ( $this->check_dependency($dep) ) { 438 $expected = $expectations{$dep}; 439 $checking = 0; 440 } 441 } 442 if ($checking) { 443 $expected = $default; 444 } 445 446 return $expected; 447 } 448 449 # Verify that the default result orering is independent of the web= and 450 # topic= parameters 451 sub verify_default_alpha_order_query { 452 my $this = shift; 453 my $result = $this->{test_topicObject}->expandMacros( 454 '%SEARCH{ 455 "1" 456 type="query" 457 web="System,Main,Sandbox" 458 topic="WebSearch,WebHome,WebPreferences" 459 nonoise="on" 460 format="$web.$topic" 461 }%' 462 ); 463 my $expected = $this->_expect_with_deps( 464 <<'FOSWIKI12', 465 Main.WebHome 466 Main.WebPreferences 467 Main.WebSearch 468 Sandbox.WebHome 469 Sandbox.WebPreferences 470 Sandbox.WebSearch 471 System.WebHome 472 System.WebPreferences 473 System.WebSearch 474 FOSWIKI12 475 'Foswiki,<,1.2' => <<'FOSWIKI11'); 476 System.WebHome 477 System.WebPreferences 478 System.WebSearch 479 Main.WebHome 480 Main.WebPreferences 481 Main.WebSearch 482 Sandbox.WebHome 483 Sandbox.WebPreferences 484 Sandbox.WebSearch 485 FOSWIKI11 486 $expected =~ s/\n$//s; 487 $this->assert_str_equals( $expected, $result ); 488 489 return; 490 } 491 492 sub verify_default_alpha_order_search { 493 my $this = shift; 494 my $result = $this->{test_topicObject}->expandMacros( 495 '%SEARCH{ 496 "." 497 type="regex" 498 web="System,Main,Sandbox" 499 topic="WebSearch,WebHome,WebPreferences" 500 nonoise="on" 501 format="$web.$topic" 502 }%' 503 ); 504 my $expected = $this->_expect_with_deps( 505 <<'FOSWIKI12', 506 Main.WebHome 507 Main.WebPreferences 508 Main.WebSearch 509 Sandbox.WebHome 510 Sandbox.WebPreferences 511 Sandbox.WebSearch 512 System.WebHome 513 System.WebPreferences 514 System.WebSearch 515 FOSWIKI12 516 'Foswiki,<,1.2' => <<'FOSWIKI11'); 517 System.WebHome 518 System.WebPreferences 519 System.WebSearch 520 Main.WebHome 521 Main.WebPreferences 522 Main.WebSearch 523 Sandbox.WebHome 524 Sandbox.WebPreferences 525 Sandbox.WebSearch 526 FOSWIKI11 527 $expected =~ s/\n$//s; 528 $this->assert_str_equals( $expected, $result ); 529 530 return; 531 } 532 322 533 ##################### 323 534 sub _septic { … … 333 544 $expected =~ s/\n$//s; 334 545 $this->assert_str_equals( $expected, $result ); 546 547 return; 335 548 } 336 549 337 550 ##################### 338 551 339 sub verify_no_header_no_footer_no_separator_with_results {340 my $this = shift; 341 $this->_septic( 0, 0, undef, 1, << EXPECT);552 sub test_no_header_no_footer_no_separator_with_results { 553 my $this = shift; 554 $this->_septic( 0, 0, undef, 1, <<'EXPECT'); 342 555 OkATopic 343 556 OkBTopic 344 557 OkTopic 345 558 EXPECT 346 } 347 348 sub verify_no_header_no_footer_no_separator_no_results { 349 my $this = shift; 350 $this->_septic( 0, 0, undef, 0, <<EXPECT); 559 560 return; 561 } 562 563 sub test_no_header_no_footer_no_separator_no_results { 564 my $this = shift; 565 $this->_septic( 0, 0, undef, 0, <<'EXPECT'); 351 566 EXPECT 352 } 353 354 sub verify_no_header_no_footer_empty_separator_with_results { 355 my $this = shift; 356 $this->_septic( 0, 0, "", 1, <<EXPECT); 567 568 return; 569 } 570 571 sub test_no_header_no_footer_empty_separator_with_results { 572 my $this = shift; 573 $this->_septic( 0, 0, "", 1, <<'EXPECT'); 357 574 OkATopicOkBTopicOkTopic 358 575 EXPECT 359 } 360 361 sub verify_no_header_no_footer_empty_separator_no_results { 362 my $this = shift; 363 $this->_septic( 0, 0, "", 0, <<EXPECT); 576 577 return; 578 } 579 580 sub test_no_header_no_footer_empty_separator_no_results { 581 my $this = shift; 582 $this->_septic( 0, 0, "", 0, <<'EXPECT'); 364 583 EXPECT 365 } 366 367 sub verify_no_header_no_footer_with_separator_with_results { 368 my $this = shift; 369 $this->_septic( 0, 0, ",", 1, <<EXPECT); 584 585 return; 586 } 587 588 sub test_no_header_no_footer_with_separator_with_results { 589 my $this = shift; 590 $this->_septic( 0, 0, ",", 1, <<'EXPECT'); 370 591 OkATopic,OkBTopic,OkTopic 371 592 EXPECT 372 } 373 374 sub verify_no_header_no_footer_with_nl_separator_with_results { 375 my $this = shift; 376 $this->_septic( 0, 0, '$n', 1, <<EXPECT); 593 594 return; 595 } 596 597 sub test_no_header_no_footer_with_nl_separator_with_results { 598 my $this = shift; 599 $this->_septic( 0, 0, '$n', 1, <<'EXPECT'); 377 600 OkATopic 378 601 OkBTopic 379 602 OkTopic 380 603 EXPECT 381 } 382 383 sub verify_no_header_no_footer_with_separator_no_results { 384 my $this = shift; 385 $this->_septic( 0, 0, ",", 0, <<EXPECT); 604 605 return; 606 } 607 608 sub test_no_header_no_footer_with_separator_no_results { 609 my $this = shift; 610 $this->_septic( 0, 0, ",", 0, <<'EXPECT'); 386 611 EXPECT 612 613 return; 387 614 } 388 615 ##################### 389 616 390 sub verify_no_header_with_footer_no_separator_with_results {391 my $this = shift; 392 $this->_septic( 0, 1, undef, 1, << EXPECT);617 sub test_no_header_with_footer_no_separator_with_results { 618 my $this = shift; 619 $this->_septic( 0, 1, undef, 1, <<'EXPECT'); 393 620 OkATopic 394 621 OkBTopic … … 396 623 FOOT 397 624 EXPECT 398 } 399 400 sub verify_no_header_with_footer_no_separator_no_results { 401 my $this = shift; 402 $this->_septic( 0, 1, undef, 0, <<EXPECT); 625 626 return; 627 } 628 629 sub test_no_header_with_footer_no_separator_no_results { 630 my $this = shift; 631 $this->_septic( 0, 1, undef, 0, <<'EXPECT'); 403 632 EXPECT 404 } 405 406 sub verify_no_header_with_footer_empty_separator_with_results { 407 my $this = shift; 408 $this->_septic( 0, 1, "", 1, <<EXPECT); 633 634 return; 635 } 636 637 sub test_no_header_with_footer_empty_separator_with_results { 638 my $this = shift; 639 $this->_septic( 0, 1, "", 1, <<'EXPECT'); 409 640 OkATopicOkBTopicOkTopicFOOT 410 641 EXPECT 411 } 412 413 sub verify_no_header_with_footer_empty_separator_no_results { 414 my $this = shift; 415 $this->_septic( 0, 1, "", 0, <<EXPECT); 642 643 return; 644 } 645 646 sub test_no_header_with_footer_empty_separator_no_results { 647 my $this = shift; 648 $this->_septic( 0, 1, "", 0, <<'EXPECT'); 416 649 EXPECT 417 } 418 419 sub verify_no_header_with_footer_with_separator_with_results { 420 my $this = shift; 421 $this->_septic( 0, 1, ",", 1, <<EXPECT); 650 651 return; 652 } 653 654 sub test_no_header_with_footer_with_separator_with_results { 655 my $this = shift; 656 $this->_septic( 0, 1, ",", 1, <<'EXPECT'); 422 657 OkATopic,OkBTopic,OkTopicFOOT 423 658 EXPECT 659 660 return; 424 661 } 425 662 426 663 ##################### 427 664 428 sub verify_with_header_with_footer_no_separator_with_results {429 my $this = shift; 430 $this->_septic( 1, 1, undef, 1, << EXPECT);665 sub test_with_header_with_footer_no_separator_with_results { 666 my $this = shift; 667 $this->_septic( 1, 1, undef, 1, <<'EXPECT'); 431 668 HEAD 432 669 OkATopic … … 435 672 FOOT 436 673 EXPECT 437 } 438 439 sub verify_with_header_with_footer_no_separator_no_results { 440 my $this = shift; 441 $this->_septic( 1, 1, undef, 0, <<EXPECT); 674 675 return; 676 } 677 678 sub test_with_header_with_footer_no_separator_no_results { 679 my $this = shift; 680 $this->_septic( 1, 1, undef, 0, <<'EXPECT'); 442 681 EXPECT 443 } 444 445 sub verify_with_header_with_footer_empty_separator_with_results { 446 my $this = shift; 447 $this->_septic( 1, 1, "", 1, <<EXPECT); 682 683 return; 684 } 685 686 sub test_with_header_with_footer_empty_separator_with_results { 687 my $this = shift; 688 $this->_septic( 1, 1, "", 1, <<'EXPECT'); 448 689 HEADOkATopicOkBTopicOkTopicFOOT 449 690 EXPECT 450 } 451 452 sub verify_with_header_with_footer_empty_separator_no_results { 453 my $this = shift; 454 $this->_septic( 1, 1, "", 0, <<EXPECT); 691 692 return; 693 } 694 695 sub test_with_header_with_footer_empty_separator_no_results { 696 my $this = shift; 697 $this->_septic( 1, 1, "", 0, <<'EXPECT'); 455 698 EXPECT 456 } 457 458 sub verify_with_header_with_footer_with_separator_with_results { 459 my $this = shift; 460 $this->_septic( 1, 1, ",", 1, <<EXPECT); 699 700 return; 701 } 702 703 sub test_with_header_with_footer_with_separator_with_results { 704 my $this = shift; 705 $this->_septic( 1, 1, ",", 1, <<'EXPECT'); 461 706 HEADOkATopic,OkBTopic,OkTopicFOOT 462 707 EXPECT 463 } 464 465 sub verify_with_header_with_footer_with_separator_no_results { 466 my $this = shift; 467 $this->_septic( 1, 1, ",", 0, <<EXPECT); 708 709 return; 710 } 711 712 sub test_with_header_with_footer_with_separator_no_results { 713 my $this = shift; 714 $this->_septic( 1, 1, ",", 0, <<'EXPECT'); 468 715 EXPECT 716 717 return; 469 718 } 470 719 471 720 ##################### 472 721 473 sub verify_with_header_no_footer_no_separator_with_results {474 my $this = shift; 475 $this->_septic( 1, 0, undef, 1, << EXPECT);722 sub test_with_header_no_footer_no_separator_with_results { 723 my $this = shift; 724 $this->_septic( 1, 0, undef, 1, <<'EXPECT'); 476 725 HEAD 477 726 OkATopic … … 479 728 OkTopic 480 729 EXPECT 481 } 482 483 sub verify_with_header_no_footer_no_separator_no_results { 484 my $this = shift; 485 $this->_septic( 1, 0, undef, 0, <<EXPECT); 730 731 return; 732 } 733 734 sub test_with_header_no_footer_no_separator_no_results { 735 my $this = shift; 736 $this->_septic( 1, 0, undef, 0, <<'EXPECT'); 486 737 EXPECT 487 } 488 489 sub verify_with_header_no_footer_empty_separator_with_results { 490 my $this = shift; 491 $this->_septic( 1, 0, "", 1, <<EXPECT); 738 739 return; 740 } 741 742 sub test_with_header_no_footer_empty_separator_with_results { 743 my $this = shift; 744 $this->_septic( 1, 0, "", 1, <<'EXPECT'); 492 745 HEADOkATopicOkBTopicOkTopic 493 746 EXPECT 494 } 495 496 sub verify_with_header_no_footer_empty_separator_no_results { 497 my $this = shift; 498 $this->_septic( 1, 0, "", 0, <<EXPECT); 747 748 return; 749 } 750 751 sub test_with_header_no_footer_empty_separator_no_results { 752 my $this = shift; 753 $this->_septic( 1, 0, "", 0, <<'EXPECT'); 499 754 EXPECT 500 } 501 502 sub verify_with_header_no_footer_with_separator_with_results { 503 my $this = shift; 504 $this->_septic( 1, 0, ",", 1, <<EXPECT); 755 756 return; 757 } 758 759 sub test_with_header_no_footer_with_separator_with_results { 760 my $this = shift; 761 $this->_septic( 1, 0, ",", 1, <<'EXPECT'); 505 762 HEADOkATopic,OkBTopic,OkTopic 506 763 EXPECT 507 } 508 509 sub verify_with_header_no_footer_with_separator_no_results { 510 my $this = shift; 511 $this->_septic( 1, 0, ",", 0, <<EXPECT); 764 765 return; 766 } 767 768 sub test_with_header_no_footer_with_separator_no_results { 769 my $this = shift; 770 $this->_septic( 1, 0, ",", 0, <<'EXPECT'); 512 771 EXPECT 513 } 514 515 sub verify_no_header_no_footer_with_nl_separator { 516 my $this = shift; 517 $this->_septic( 0, 0, '$n', 1, <<EXPECT); 772 773 return; 774 } 775 776 sub test_no_header_no_footer_with_nl_separator { 777 my $this = shift; 778 $this->_septic( 0, 0, '$n', 1, <<'EXPECT'); 518 779 OkATopic 519 780 OkBTopic 520 781 OkTopic 521 782 EXPECT 522 } 523 524 ##################### 525 526 sub verify_footer_with_ntopics { 527 my $this = shift; 528 529 my $result = 530 $this->{test_topicObject}->expandMacros( 531 '%SEARCH{"name~\'*Topic\'" type="query" nonoise="on" footer="Total found: $ntopics" format="$topic"}%' 532 ); 533 534 $this->assert_str_equals( 535 join( "\n", sort qw(OkATopic OkBTopic OkTopic) ) . "\nTotal found: 3", 536 $result ); 537 } 538 539 sub verify_multiple_and_footer_with_ntopics_and_nhits { 540 my $this = shift; 541 542 $this->set_up_for_formatted_search(); 543 544 my $result = 545 $this->{test_topicObject}->expandMacros( 546 '%SEARCH{"Bullet" type="regex" multiple="on" nonoise="on" footer="Total found: $ntopics, Hits: $nhits" format="$text - $nhits"}%' 547 ); 548 549 $this->assert_str_equals( 550 " * Bullet 1 - 1\n * Bullet 2 - 2\n * Bullet 3 - 3\n * Bullet 4 - 4\nTotal found: 1, Hits: 4", 551 $result 552 ); 553 } 554 555 sub verify_footer_with_ntopics_empty_format { 556 my $this = shift; 557 558 my $result = 559 $this->{test_topicObject}->expandMacros( 560 '%SEARCH{"name~\'*Topic\'" type="query" nonoise="on" footer="Total found: $ntopics" format="" separator=""}%' 561 ); 562 563 $this->assert_str_equals( "Total found: 3", $result ); 564 } 565 566 sub verify_nofinalnewline { 567 my $this = shift; 568 569 # nofinalnewline="off" 570 my $result = 571 $this->{test_topicObject}->expandMacros( 572 '%SEARCH{"name~\'OkTopic\'" type="query" nonoise="on" format="$topic" nofinalnewline="off"}%' 573 ); 574 575 $this->assert_str_equals( "OkTopic\n", $result ); 576 577 # nofinalnewline="on" 578 $result = 579 $this->{test_topicObject}->expandMacros( 580 '%SEARCH{"name~\'OkTopic\'" type="query" nonoise="on" format="$topic" nofinalnewline="on"}%' 581 ); 582 583 $this->assert_str_equals( "OkTopic", $result ); 584 585 # nofinalnewline should default be on 586 $result = 587 $this->{test_topicObject}->expandMacros( 588 '%SEARCH{"name~\'OkTopic\'" type="query" nonoise="on" format="$topic"}%' 589 ); 590 591 $this->assert_str_equals( "OkTopic", $result ); 592 783 784 return; 593 785 } 594 786 … … 604 796 $this->assert_matches( qr/OkBTopic/, $result ); 605 797 $this->assert_matches( qr/OkATopic/, $result ); 798 799 return; 606 800 } 607 801 … … 619 813 $this->assert_matches( qr/OkBTopic/, $result ); 620 814 $this->assert_matches( qr/OkATopic/, $result ); 815 816 return; 621 817 } 622 818 … … 634 830 $this->assert_matches( qr/OkBTopic/, $result ); 635 831 $this->assert_matches( qr/OkATopic/, $result ); 832 833 return; 636 834 } 637 835 … … 649 847 $this->assert_does_not_match( qr/OkBTopic/, $result ); 650 848 $this->assert_does_not_match( qr/OkATopic/, $result ); 849 850 return; 651 851 } 652 852 … … 666 866 $this->assert_matches( qr/OkBTopic/, $result ); 667 867 $this->assert_matches( qr/OkATopic/, $result ); 868 869 return; 668 870 } 669 871 … … 681 883 $this->assert_matches( qr/OkBTopic/, $result ); 682 884 $this->assert_matches( qr/OkATopic/, $result ); 885 886 return; 683 887 } 684 888 … … 697 901 $this->assert_matches( qr/OkATopic/, $result ); 698 902 903 return; 699 904 } 700 905 … … 713 918 $this->assert_does_not_match( qr/OkATopic/, $result ); 714 919 920 return; 715 921 } 716 922 … … 730 936 $this->assert_does_not_match( qr/OkBTopic/, $result ); 731 937 $this->assert_does_not_match( qr/OkATopic/, $result ); 938 939 return; 732 940 } 733 941 … … 746 954 $this->assert_does_not_match( qr/OkATopic/, $result ); 747 955 956 return; 748 957 } 749 958 … … 762 971 $this->assert_does_not_match( qr/OkATopic/, $result ); 763 972 973 return; 764 974 } 765 975 … … 778 988 $this->assert_does_not_match( qr/OkATopic/, $result ); 779 989 990 return; 780 991 } 781 992 … … 796 1007 $this->assert_does_not_match( qr/OkATopic/, $result ); 797 1008 1009 return; 798 1010 } 799 1011 … … 812 1024 $this->assert_does_not_match( qr/OkATopic/, $result ); 813 1025 1026 return; 814 1027 } 815 1028 … … 828 1041 $this->assert_does_not_match( qr/OkATopic/, $result ); 829 1042 1043 return; 830 1044 } 831 1045 … … 844 1058 $this->assert_does_not_match( qr/OkATopic/, $result ); 845 1059 1060 return; 846 1061 } 847 1062 … … 862 1077 $this->assert_does_not_match( qr/OkBTopic/, $result ); 863 1078 1079 return; 864 1080 } 865 1081 … … 878 1094 $this->assert_does_not_match( qr/OkBTopic/, $result ); 879 1095 1096 return; 880 1097 } 881 1098 … … 894 1111 $this->assert_matches( qr/OkATopic/, $result ); 895 1112 1113 return; 896 1114 } 897 1115 … … 907 1125 $this->assert_does_not_match( qr/OkATopic/, $result ); 908 1126 $this->assert_matches( qr/OkBTopic/, $result ); 1127 1128 return; 909 1129 } 910 1130 … … 922 1142 HERE 923 1143 $this->assert_str_equals( "$wn $this->{users_web}.$wn\n", $result ); 1144 1145 return; 924 1146 } 925 1147 … … 931 1153 '%SEARCH{"" type="regex" scope="text" nonoise="on" format="$topic"}%'); 932 1154 $this->assert_str_equals( "", $result ); 1155 1156 return; 933 1157 } 934 1158 … … 941 1165 ); 942 1166 $this->assert_str_equals( "", $result ); 1167 1168 return; 943 1169 } 944 1170 … … 951 1177 ); 952 1178 $this->assert_str_equals( "", $result ); 1179 1180 return; 953 1181 } 954 1182 … … 960 1188 '%SEARCH{"" type="word" scope="text" nonoise="on" format="$topic"}%'); 961 1189 $this->assert_str_equals( "", $result ); 1190 1191 return; 962 1192 } 963 1193 … … 970 1200 ); 971 1201 $this->assert_str_equals( "", $result ); 1202 1203 return; 972 1204 } 973 1205 … … 980 1212 ); 981 1213 $this->assert_str_equals( "", $result ); 1214 1215 return; 982 1216 } 983 1217 … … 990 1224 ); 991 1225 $this->assert_str_equals( "", $result ); 1226 1227 return; 992 1228 } 993 1229 … … 1000 1236 ); 1001 1237 $this->assert_str_equals( "", $result ); 1238 1239 return; 1002 1240 } 1003 1241 … … 1021 1259 HERE 1022 1260 1023 my $topicObject=1024 Foswiki:: Meta->new( $this->{session}, $this->{test_web},1025 'FormattedSearchTopic1', $text);1261 my ($topicObject) = 1262 Foswiki::Func::readTopic( $this->{test_web}, 'FormattedSearchTopic1' ); 1263 $topicObject->text($text); 1026 1264 $topicObject->save(); 1027 } 1028 1029 sub verify_formatted_search_summary_with_exclamation_marks { 1265 $topicObject->finish(); 1266 1267 return; 1268 } 1269 1270 sub test_footer_with_ntopics { 1271 my $this = shift; 1272 1273 my $result = 1274 $this->{test_topicObject}->expandMacros( 1275 '%SEARCH{"name~\'*Topic\'" type="query" nonoise="on" footer="Total found: $ntopics" format="$topic"}%' 1276 ); 1277 1278 $this->assert_str_equals( 1279 join( "\n", sort qw(OkATopic OkBTopic OkTopic) ) . "\nTotal found: 3", 1280 $result ); 1281 1282 return; 1283 } 1284 1285 sub test_multiple_and_footer_with_ntopics_and_nhits { 1286 my $this = shift; 1287 1288 $this->set_up_for_formatted_search(); 1289 1290 my $result = 1291 $this->{test_topicObject}->expandMacros( 1292 '%SEARCH{"Bullet" type="regex" multiple="on" nonoise="on" footer="Total found: $ntopics, Hits: $nhits" format="$text - $nhits"}%' 1293 ); 1294 1295 $this->assert_str_equals( 1296 " * Bullet 1 - 1\n * Bullet 2 - 2\n * Bullet 3 - 3\n * Bullet 4 - 4\nTotal found: 1, Hits: 4", 1297 $result 1298 ); 1299 1300 return; 1301 } 1302 1303 sub test_footer_with_ntopics_empty_format { 1304 my $this = shift; 1305 1306 my $result = 1307 $this->{test_topicObject}->expandMacros( 1308 '%SEARCH{"name~\'*Topic\'" type="query" nonoise="on" footer="Total found: $ntopics" format="" separator=""}%' 1309 ); 1310 1311 $this->assert_str_equals( "Total found: 3", $result ); 1312 1313 return; 1314 } 1315 1316 sub test_nofinalnewline { 1317 my $this = shift; 1318 1319 # nofinalnewline="off" 1320 my $result = 1321 $this->{test_topicObject}->expandMacros( 1322 '%SEARCH{"name~\'OkTopic\'" type="query" nonoise="on" format="$topic" nofinalnewline="off"}%' 1323 ); 1324 1325 $this->assert_str_equals( "OkTopic\n", $result ); 1326 1327 # nofinalnewline="on" 1328 $result = 1329 $this->{test_topicObject}->expandMacros( 1330 '%SEARCH{"name~\'OkTopic\'" type="query" nonoise="on" format="$topic" nofinalnewline="on"}%' 1331 ); 1332 1333 $this->assert_str_equals( "OkTopic", $result ); 1334 1335 # nofinalnewline should default be on 1336 $result = 1337 $this->{test_topicObject}->expandMacros( 1338 '%SEARCH{"name~\'OkTopic\'" type="query" nonoise="on" format="$topic"}%' 1339 ); 1340 1341 $this->assert_str_equals( "OkTopic", $result ); 1342 1343 return; 1344 } 1345 1346 sub test_formatted_search_summary_with_exclamation_marks { 1030 1347 my $this = shift; 1031 1348 my $session = $this->{session}; … … 1050 1367 $expected = '<nop>AnnaAnchor'; 1051 1368 $this->assert_str_equals( $expected, $actual ); 1369 1370 return; 1052 1371 } 1053 1372 1054 1373 # Item8718 1055 sub verify_formatted_search_with_exclamation_marks_inside_bracket_link {1374 sub test_formatted_search_with_exclamation_marks_inside_bracket_link { 1056 1375 my $this = shift; 1057 1376 my $session = $this->{session}; … … 1069 1388 1070 1389 $this->assert_str_equals( $expected, $actual ); 1390 1391 return; 1071 1392 } 1072 1393 … … 1085 1406 $result 1086 1407 ); 1408 1409 return; 1087 1410 } 1088 1411 … … 1099 1422 $this->assert_str_equals( "FormattedSearchTopic1 \$email \$html \$time", 1100 1423 $result ); 1101 } 1102 1103 sub verify_METASEARCH { 1424 1425 return; 1426 } 1427 1428 sub test_METASEARCH { 1104 1429 my $this = shift; 1105 1430 my $session = $this->{session}; … … 1124 1449 $this->{test_topicObject}->renderTML('Children: FormattedSearchTopic1 '); 1125 1450 $this->assert_str_equals( $expected, $actual ); 1451 1452 return; 1126 1453 } 1127 1454 … … 1142 1469 %META:FILEATTACHMENT{name="README" comment="Blah Blah" date="1157965062" size="5504"}% 1143 1470 HERE 1144 my $topicObject=1145 Foswiki:: Meta->new( $this->{session}, $this->{test_web}, 'QueryTopic',1146 $text);1471 my ($topicObject) = 1472 Foswiki::Func::readTopic( $this->{test_web}, 'QueryTopic' ); 1473 $topicObject->text($text); 1147 1474 $topicObject->save(); 1475 $topicObject->finish(); 1148 1476 1149 1477 $text = <<'HERE'; … … 1160 1488 %META:FIELD{name="form" attributes="" title="Blah" value="form good"}% 1161 1489 %META:FIELD{name="FORM" attributes="" title="Blah" value="FORM GOOD"}% 1162 %META:FIELD{name="NewField" attributes="" title="Item10269" value=" TaxonProfile/Builder.TermForm"}%1490 %META:FIELD{name="NewField" attributes="" title="Item10269" value="Profile/Builder.TermForm"}% 1163 1491 %META:FILEATTACHMENT{name="porn.gif" comment="Cor" date="15062" size="15504"}% 1164 1492 %META:FILEATTACHMENT{name="flib.xml" comment="Cor" date="1157965062" size="1"}% 1165 1493 HERE 1166 $topicObject=1167 Foswiki:: Meta->new( $this->{session}, $this->{test_web}, 'QueryTopicTwo',1168 $text);1494 ($topicObject) = 1495 Foswiki::Func::readTopic( $this->{test_web}, 'QueryTopicTwo' ); 1496 $topicObject->text($text); 1169 1497 $topicObject->save(); 1170 1171 $this->{session}->finish(); 1172 my $query = new Unit::Request("");1498 $topicObject->finish(); 1499 1500 my $query = Unit::Request->new(''); 1173 1501 $query->path_info("/$this->{test_web}/$this->{test_topic}"); 1174 1502 1175 $this-> {session} = new Foswiki( undef, $query );1503 $this->createNewFoswikiSession( undef, $query ); 1176 1504 $this->assert_str_equals( $this->{test_web}, $this->{session}->{webName} ); 1177 $Foswiki::Plugins::SESSION = $this->{session}; 1178 1179 $this->{test_topicObject} = 1180 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 1181 $this->{test_topic} ); 1505 1506 return; 1182 1507 } 1183 1508 … … 1195 1520 ->expandMacros( '%SEARCH{"parent.name=\'WebHome\'"' . $stdCrap ); 1196 1521 $this->assert_str_equals( 'QueryTopic', $result ); 1522 1523 return; 1197 1524 } 1198 1525 … … 1206 1533 ->expandMacros( '%SEARCH{"attachments[size > 0]"' . $stdCrap ); 1207 1534 $this->assert_str_equals( 'QueryTopic QueryTopicTwo', $result ); 1535 1536 return; 1208 1537 } 1209 1538 … … 1217 1546 '%SEARCH{"META:FILEATTACHMENT[size > 10000]"' . $stdCrap ); 1218 1547 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1548 1549 return; 1219 1550 } 1220 1551 … … 1228 1559 ->expandMacros( '%SEARCH{"attachments[name=\'flib.xml\']"' . $stdCrap ); 1229 1560 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1561 1562 return; 1230 1563 } 1231 1564 … … 1239 1572 ->expandMacros( '%SEARCH{"Lastname=\'Peel\'"' . $stdCrap ); 1240 1573 $this->assert_str_equals( 'QueryTopic QueryTopicTwo', $result ); 1574 1575 return; 1241 1576 } 1242 1577 … … 1250 1585 '%SEARCH{"text ~ \'*SMONG*\' AND Lastname=\'Peel\'"' . $stdCrap ); 1251 1586 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1587 1588 return; 1252 1589 } 1253 1590 … … 1261 1598 '%SEARCH{"text ~ \'*FURTLE*\' AND Lastname=\'Peel\'"' . $stdCrap ); 1262 1599 $this->assert_str_equals( 'QueryTopic', $result ); 1600 1601 return; 1263 1602 } 1264 1603 … … 1272 1611 ->expandMacros( '%SEARCH{"Lastname=\'Peel\'"' . $stdCrap ); 1273 1612 $this->assert_str_equals( 'QueryTopic QueryTopicTwo', $result ); 1613 1614 return; 1274 1615 } 1275 1616 … … 1283 1624 ->expandMacros( '%SEARCH{"form.name=\'TestyForm\'"' . $stdCrap ); 1284 1625 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1285 } 1286 1626 1627 return; 1628 } 1629 1630 #Item10520: in Sven's reading of System.QuerySearch, this should return no results, as there is no field of the name 'TestForm' 1287 1631 sub verify_formQuery2 { 1288 1632 my $this = shift; … … 1293 1637 $this->{test_topicObject} 1294 1638 ->expandMacros( '%SEARCH{"TestForm"' . $stdCrap ); 1295 $this->assert_str_equals( 'QueryTopic', $result ); 1639 my $expected = 1640 $this->_expect_with_deps( '', 'Foswiki,<,1.2' => 'QueryTopic' ); 1641 1642 $this->assert_str_equals( $expected, $result ); 1643 1644 return; 1296 1645 } 1297 1646 … … 1305 1654 '%SEARCH{"TestForm[name=\'Field1\'].value=\'A Field\'"' . $stdCrap ); 1306 1655 $this->assert_str_equals( 'QueryTopic', $result ); 1656 1657 return; 1307 1658 } 1308 1659 … … 1328 1679 ->expandMacros( '%SEARCH{"TestForm.Field1=\'A Field\'"' . $stdCrap ); 1329 1680 $this->assert_str_equals( 'QueryTopic', $result ); 1681 1682 return; 1330 1683 } 1331 1684 … … 1355 1708 ->expandMacros( '%SEARCH{"TestyForm.FORM=\'FORM GOOD\'"' . $stdCrap ); 1356 1709 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1710 1711 return; 1357 1712 } 1358 1713 … … 1367 1722 . $stdCrap ); 1368 1723 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1724 1725 return; 1369 1726 } 1370 1727 … … 1412 1769 1413 1770 my $result = 1414 $this->{test_topicObject}->expandMacros( '%SEARCH{"A *B"' . $stdCrap );1415 $this->assert_matches( qr/Error was: Syntax error in 'A \* B' at ' \*B'/s,1771 $this->{test_topicObject}->expandMacros( '%SEARCH{"A ¬ B"' . $stdCrap ); 1772 $this->assert_matches( qr/Error was: Syntax error in 'A ¬ B' at ' ¬ B'/s, 1416 1773 $result ); 1774 1775 return; 1417 1776 } 1418 1777 … … 1434 1793 my $vD = ( $n == 1 ) ? 'A' : 'B'; 1435 1794 my $vE = ( $n == 2 ) ? 'A' : 'B'; 1436 my $text = << HERE;1795 my $text = <<"HERE"; 1437 1796 %META:TOPICINFO{author="TopicUserMapping_guest" date="12" format="1.1" version="1.2"}% 1438 1797 ---+ Progressive Sexuality … … 1461 1820 %META:FIELD{name="FieldE" attributes="" title="Banother Field" value="$vE"}% 1462 1821 HERE 1463 my $topicObject=1464 Foswiki:: Meta->new( $this->{session}, $this->{test_web},1465 "QueryTopic$n", $text);1822 my ($topicObject) = 1823 Foswiki::Func::readTopic( $this->{test_web}, "QueryTopic$n", ); 1824 $topicObject->text($text); 1466 1825 $topicObject->save(); 1826 $topicObject->finish(); 1467 1827 } 1468 1828 require Benchmark; 1469 1829 1470 1830 # Search using a regular expression 1471 my $start = new Benchmark;1831 my $start = Benchmark->new(); 1472 1832 1473 1833 my $result = … … 1475 1835 '%SEARCH{"^[%]META:FIELD{name=\"FieldA\".*\bvalue=\"A\";^[%]META:FIELD{name=\"FieldB\".*\bvalue=\"A\";^[%]META:FIELD{name=\"FieldC\".*\bvalue=\"A\";^[%]META:FIELD{name=\"FieldD\".*\bvalue=\"A\"|^[%]META:FIELD{name=\"FieldE\".*\bvalue=\"A\"" type="regex" nonoise="on" format="$topic" separator=" "}%' 1476 1836 ); 1477 my $retime = Benchmark::timediff( new Benchmark, $start );1837 my $retime = Benchmark::timediff( Benchmark->new(), $start ); 1478 1838 $this->assert_str_equals( 'QueryTopic1 QueryTopic2', $result ); 1479 1839 1480 1840 # Repeat using a query 1481 $start = new Benchmark;1841 $start = Benchmark->new; 1482 1842 $result = 1483 1843 $this->{test_topicObject}->expandMacros( … … 1488 1848 print STDERR "Query " . Benchmark::timestr($querytime), 1489 1849 "\nRE " . Benchmark::timestr($retime), "\n"; 1490 } 1491 1492 sub verify_4347 { 1850 1851 return; 1852 } 1853 1854 sub test_4347 { 1493 1855 my $this = shift; 1494 1856 … … 1498 1860 ); 1499 1861 $this->assert_str_equals( '', $result ); 1862 1863 return; 1500 1864 } 1501 1865 … … 1515 1879 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1516 1880 1517 my $topicObject = 1518 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 1519 'QueryTopicTwo' ); 1881 my ($topicObject) = 1882 Foswiki::Func::readTopic( $this->{test_web}, 'QueryTopicTwo' ); 1520 1883 $result = 1521 1884 $topicObject->expandMacros( '%SEARCH{"text ~ \'*SMONG*\'" ' . $stdCrap ); 1522 1885 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1523 1886 1524 $topicObject =1525 Foswiki::Meta->new( $this->{session}, $this->{test_web},1526 'QueryTopicTwo' );1887 $topicObject->finish(); 1888 ($topicObject) = 1889 Foswiki::Func::readTopic( $this->{test_web}, 'QueryTopicTwo' ); 1527 1890 $result = $topicObject->expandMacros( 1528 1891 '%SEARCH{"text ~ \'*QueryTopicTwo*\'" ' . $stdCrap ); 1529 1892 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1530 1893 $topicObject->finish(); 1894 1895 return; 1531 1896 } 1532 1897 … … 1612 1977 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1613 1978 1614 my $topicObject = 1615 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 1616 'QueryTopicTwo' ); 1979 my ($topicObject) = 1980 Foswiki::Func::readTopic( $this->{test_web}, 'QueryTopicTwo' ); 1617 1981 $result = 1618 1982 $topicObject->expandMacros( '%SEARCH{"text ~ \'*SMONG*\'" web="' … … 1621 1985 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1622 1986 1623 $topicObject =1624 Foswiki::Meta->new( $this->{session}, $this->{test_web},1625 'QueryTopicTwo' );1987 $topicObject->finish(); 1988 ($topicObject) = 1989 Foswiki::Func::readTopic( $this->{test_web}, 'QueryTopicTwo' ); 1626 1990 $result = 1627 1991 $topicObject->expandMacros( '%SEARCH{"text ~ \'*QueryTopicTwo*\'" web="' … … 1630 1994 $this->assert_str_equals( 'QueryTopicTwo', $result ); 1631 1995 1632 $topicObject =1633 Foswiki::Meta->new( $this->{session}, $this->{test_web},1634 'QueryTopicTwo' );1996 $topicObject->finish(); 1997 ($topicObject) = 1998 Foswiki::Func::readTopic( $this->{test_web}, 'QueryTopicTwo' ); 1635 1999 $result = 1636 2000 $topicObject->expandMacros( '%SEARCH{"text ~ \'*Notinthetopics*\'" web="' … … 1638 2002 . $stdCrap ); 1639 2003 $this->assert_str_equals( '', $result ); 2004 $topicObject->finish(); 1640 2005 1641 2006 $result = … … 1645 2010 . $stdCrap ); 1646 2011 $this->assert_str_equals( 'QueryTopic', $result ); 1647 } 1648 1649 sub verify_pattern { 2012 2013 return; 2014 } 2015 2016 sub test_pattern { 1650 2017 my $this = shift; 1651 2018 … … 1657 2024 $this->assert_matches( qr/Xdont.matchmeY/, $result ); 1658 2025 $this->assert_matches( qr/XY/, $result ); 1659 } 1660 1661 sub verify_badpattern { 2026 2027 return; 2028 } 2029 2030 sub test_badpattern { 1662 2031 my $this = shift; 1663 2032 … … 1677 2046 # and format should be XY for all 3 topics 1678 2047 $this->assert_equals( 3, $result =~ s/^XY$//gm ); 1679 } 1680 1681 sub verify_validatepattern { 2048 2049 return; 2050 } 2051 2052 sub test_validatepattern { 1682 2053 my $this = shift; 1683 2054 my ( $pattern, $temp ); … … 1713 2084 $this->assert_matches( qr/$pattern/, 'foobluebar' ); 1714 2085 2086 return; 1715 2087 } 1716 2088 1717 2089 #Item977 1718 sub verify_formatOfLinks { 1719 my $this = shift; 1720 1721 my $topicObject = Foswiki::Meta->new( 1722 $this->{session}, 1723 $this->{test_web}, 'Item977', "---+ Apache 2090 sub test_formatOfLinks { 2091 my $this = shift; 2092 2093 my ($topicObject) = 2094 Foswiki::Func::readTopic( $this->{test_web}, 'Item977' ); 2095 $topicObject->text(<<'HERE'); 2096 ---+ Apache 1724 2097 1725 2098 Apache is the [[http://www.apache.org/httpd/][well known web server]]. 1726 " 1727 ); 2099 HERE 1728 2100 $topicObject->save(); 2101 $topicObject->finish(); 1729 2102 1730 2103 my $result = … … 1765 2138 ->TML2PlainText('Apache is the well known web server.') ); 1766 2139 2140 return; 1767 2141 } 1768 2142 1769 2143 sub _getTopicList { 1770 my $this = shift; 1771 my $web = shift; 1772 my $options = shift; 2144 my ( $this, $web, $options, $sadness, $default_expected, %expected_list ) = 2145 @_; 2146 my $expected = 2147 $this->_expect_with_deps( $default_expected, %expected_list ); 1773 2148 1774 2149 # my $options = { … … 1779 2154 # }; 1780 2155 2156 $this->assert_str_equals( 'ARRAY', ref($expected) ); 1781 2157 my $webObject = Foswiki::Meta->new( $this->{session}, $web ); 1782 2158 … … 1786 2162 Foswiki::Search::InfoCache::getTopicListIterator( $webObject, $options ); 1787 2163 1788 ASSERT( UNIVERSAL::isa( $iter, 'Foswiki::Iterator') ) if DEBUG;2164 ASSERT( $iter->isa('Foswiki::Iterator') ) if DEBUG; 1789 2165 my @topicList = (); 1790 2166 while ( my $t = $iter->next() ) { 2167 next if ( $t eq 'InvisibleTopic' ); #and user != admin or... 1791 2168 push( @topicList, $t ); 1792 2169 } 1793 2170 $webObject->finish(); 2171 2172 my $l1 = join( ',', @{$expected} ); 2173 my $l2 = join( ',', @topicList ); 2174 $this->assert_str_equals( $l1, $l2, "$sadness:\nwant: $l2\n got: $l1" ); 1794 2175 return \@topicList; 1795 2176 } … … 1799 2180 1800 2181 #no topics specified.. 1801 $this->assert_deep_equals( 2182 $this->_getTopicList( 2183 $this->{test_web}, 2184 {}, 2185 'no filters, all topics in test_web', 1802 2186 [ 1803 2187 'OkATopic', 'OkBTopic', … … 1805 2189 'WebPreferences' 1806 2190 ], 1807 $this->_getTopicList( $this->{test_web}, {} ), 1808 'no filters, all topics in test_web' 1809 ); 1810 $this->assert_deep_equals( 2191 ); 2192 $this->_getTopicList( 2193 '_default', 2194 {}, 2195 'no filters, all topics in test_web', 1811 2196 [ 1812 2197 'WebAtom', 'WebChanges', … … 1817 2202 'WebSearchAdvanced', 'WebTopicList' 1818 2203 ], 1819 $this->_getTopicList( '_default', {} ),1820 'no filters, all topics in _default web'1821 2204 ); 1822 2205 1823 2206 #use wildcards 1824 $this->assert_deep_equals( 2207 $this->_getTopicList( 2208 $this->{test_web}, 2209 { includeTopics => 'Ok*' }, 2210 'comma separated list', 1825 2211 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 1826 $this->_getTopicList( $this->{test_web}, { includeTopics => 'Ok*' } ), 1827 'test_web, Wildcard includeTopics Ok*' 1828 ); 1829 $this->assert_deep_equals( 2212 ); 2213 $this->_getTopicList( 2214 '_default', 2215 { includeTopics => 'Web*' }, 2216 'no filters, all topics in test_web', 1830 2217 [ 1831 2218 'WebAtom', 'WebChanges', … … 1836 2223 'WebSearchAdvanced', 'WebTopicList' 1837 2224 ], 1838 $this->_getTopicList( '_default', { includeTopics => 'Web*' } ),1839 '_default web, Wildcard includeTopics Web*'1840 2225 ); 1841 2226 1842 2227 #comma separated list specifed for inclusion 1843 $this->assert_deep_equals( 1844 [ 'TestTopicSEARCH', 'OkTopic' ], 1845 $this->_getTopicList( 1846 $this->{test_web}, 1847 { includeTopics => 'TestTopicSEARCH,OkTopic,NoSuchTopic' } 1848 ), 1849 'test_web, comma separated includeTopics, missing topic' 1850 ); 1851 $this->assert_deep_equals( 1852 [ 'WebTopicList', 'WebCreateNewTopic' ], 1853 $this->_getTopicList( 1854 '_default', 1855 { includeTopics => 'WebTopicList, WebCreateNewTopic, NoSuchTopic' } 1856 ), 1857 '_default web, comma-space separated includeTopics, missing topic ' 2228 $this->_getTopicList( 2229 $this->{test_web}, 2230 { includeTopics => 'TestTopicSEARCH,OkTopic,NoSuchTopic' }, 2231 'comma separated list', 2232 [ 'OkTopic', 'TestTopicSEARCH' ], 2233 'Foswiki,<,1.2' => [ 'TestTopicSEARCH', 'OkTopic' ], 2234 ); 2235 $this->_getTopicList( 2236 '_default', 2237 { includeTopics => 'WebTopicList, WebCreateNewTopic, NoSuchTopic' }, 2238 'no filters, all topics in test_web', 2239 [ 'WebCreateNewTopic', 'WebTopicList' ], 2240 'Foswiki,<,1.2' => [ 'WebTopicList', 'WebCreateNewTopic' ], 1858 2241 ); 1859 2242 1860 2243 #excludes 1861 $this->assert_deep_equals( 2244 $this->_getTopicList( 2245 $this->{test_web}, 2246 { excludeTopics => 'NoSuchTopic,OkBTopic' }, 2247 'no filters, all topics in test_web', 1862 2248 [ 'OkATopic', 'OkTopic', 'TestTopicSEARCH', 'WebPreferences' ], 1863 $this->_getTopicList( 1864 $this->{test_web}, { excludeTopics => 'NoSuchTopic,OkBTopic' } 1865 ), 1866 'test_web, comma separated excludeTopics list' 1867 ); 1868 $this->assert_deep_equals( 2249 ); 2250 $this->_getTopicList( 2251 '_default', 2252 { excludeTopics => 'WebSearch' }, 2253 'no filters, all topics in test_web', 1869 2254 [ 1870 2255 'WebAtom', 'WebChanges', … … 1875 2260 'WebTopicList' 1876 2261 ], 1877 $this->_getTopicList( '_default', { excludeTopics => 'WebSearch' } ),1878 '_default web, exclude WebSearch'1879 2262 ); 1880 2263 1881 2264 #Talk about missing alot of tests 1882 $this->assert_deep_equals( 2265 $this->_getTopicList( 2266 $this->{test_web}, 2267 { includeTopics => '*' }, 2268 'all topics, using wildcard', 1883 2269 [ 1884 2270 'OkATopic', 'OkBTopic', … … 1886 2272 'WebPreferences' 1887 2273 ], 1888 $this->_getTopicList( $this->{test_web}, { includeTopics => '*' } ), 1889 'all topics, using wildcard' 1890 ); 1891 $this->assert_deep_equals( 2274 ); 2275 $this->_getTopicList( 2276 $this->{test_web}, 2277 { includeTopics => 'Ok*' }, 2278 'Ok* topics, using wildcard', 1892 2279 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 1893 $this->_getTopicList( $this->{test_web}, { includeTopics => 'Ok*' } ), 1894 'Ok* topics, using wildcard' 1895 ); 1896 $this->assert_deep_equals( 2280 ); 2281 $this->_getTopicList( 2282 $this->{test_web}, 2283 { 2284 includeTopics => 'ok*', 2285 casesensitive => 1 2286 }, 2287 'case sensitive ok* topics, using wildcard', 1897 2288 [], 1898 $this->_getTopicList( 1899 $this->{test_web}, 1900 { 1901 includeTopics => 'ok*', 1902 casesensitive => 1 1903 } 1904 ), 1905 'case sensitive ok* topics, using wildcard' 1906 ); 1907 $this->assert_deep_equals( 2289 ); 2290 $this->_getTopicList( 2291 $this->{test_web}, 2292 { 2293 includeTopics => 'ok*', 2294 casesensitive => 0 2295 }, 2296 'case insensitive ok* topics, using wildcard', 1908 2297 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 1909 $this->_getTopicList(1910 $this->{test_web},1911 {1912 includeTopics => 'ok*',1913 casesensitive => 01914 }1915 ),1916 'case insensitive ok* topics, using wildcard'1917 2298 ); 1918 2299 … … 1923 2304 1924 2305 # this test won't work on Mac OS X or windows. 1925 $this->assert_deep_equals(1926 [],1927 $this->_getTopicList(1928 $this->{test_web},1929 {1930 includeTopics => 'okatopic',1931 casesensitive => 11932 }1933 ),1934 'case sensitive okatopic topic 1'1935 );1936 }1937 1938 $this->assert_deep_equals(1939 ['OkATopic'],1940 2306 $this->_getTopicList( 1941 2307 $this->{test_web}, 1942 2308 { 1943 2309 includeTopics => 'okatopic', 1944 casesensitive => 0 1945 } 1946 ), 1947 'case insensitive okatopic topic' 2310 casesensitive => 1 2311 }, 2312 'case sensitive okatopic topic 1', 2313 [], 2314 ); 2315 } 2316 2317 $this->_getTopicList( 2318 $this->{test_web}, 2319 { 2320 includeTopics => 'okatopic', 2321 casesensitive => 0 2322 }, 2323 'case insensitive okatopic topic', 2324 ['OkATopic'], 1948 2325 ); 1949 2326 ##### same again, with excludes. 1950 $this->assert_deep_equals( 2327 $this->_getTopicList( 2328 $this->{test_web}, 2329 { 2330 includeTopics => '*', 2331 excludeTopics => 'web*' 2332 }, 2333 'all topics, using wildcard', 1951 2334 [ 1952 2335 'OkATopic', 'OkBTopic', … … 1954 2337 'WebPreferences' 1955 2338 ], 1956 $this->_getTopicList( 1957 $this->{test_web}, 1958 { 1959 includeTopics => '*', 1960 excludeTopics => 'web*' 1961 } 1962 ), 1963 'all topics, using wildcard' 1964 ); 1965 $this->assert_deep_equals( 2339 ); 2340 $this->_getTopicList( 2341 $this->{test_web}, 2342 { 2343 includeTopics => 'Ok*', 2344 excludeTopics => 'okatopic' 2345 }, 2346 'Ok* topics, using wildcard', 1966 2347 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 1967 $this->_getTopicList( 1968 $this->{test_web}, 1969 { 1970 includeTopics => 'Ok*', 1971 excludeTopics => 'okatopic' 1972 } 1973 ), 1974 'Ok* topics, using wildcard' 1975 ); 1976 $this->assert_deep_equals( 2348 ); 2349 $this->_getTopicList( 2350 $this->{test_web}, 2351 { 2352 includeTopics => 'ok*', 2353 excludeTopics => 'WebPreferences', 2354 casesensitive => 1 2355 }, 2356 'case sensitive ok* topics, using wildcard', 1977 2357 [], 1978 $this->_getTopicList( 1979 $this->{test_web}, 1980 { 1981 includeTopics => 'ok*', 1982 excludeTopics => 'WebPreferences', 1983 casesensitive => 1 1984 } 1985 ), 1986 'case sensitive ok* topics, using wildcard' 1987 ); 1988 $this->assert_deep_equals( 2358 ); 2359 $this->_getTopicList( 2360 $this->{test_web}, 2361 { 2362 includeTopics => 'ok*', 2363 excludeTopics => '', 2364 casesensitive => 0 2365 }, 2366 'case insensitive ok* topics, using wildcard', 1989 2367 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 1990 $this->_getTopicList( 1991 $this->{test_web}, 1992 { 1993 includeTopics => 'ok*', 1994 excludeTopics => '', 1995 casesensitive => 0 1996 } 1997 ), 1998 'case insensitive ok* topics, using wildcard' 1999 ); 2000 2001 $this->assert_deep_equals( 2368 ); 2369 2370 $this->_getTopicList( 2371 $this->{test_web}, 2372 { 2373 includeTopics => 'Ok*', 2374 excludeTopics => '*ATopic', 2375 casesensitive => 1 2376 }, 2377 'case sensitive okatopic topic 2', 2002 2378 [ 'OkBTopic', 'OkTopic' ], 2003 $this->_getTopicList( 2004 $this->{test_web}, 2005 { 2006 includeTopics => 'Ok*', 2007 excludeTopics => '*ATopic', 2008 casesensitive => 1 2009 } 2010 ), 2011 'case sensitive okatopic topic 2' 2012 ); 2013 2014 $this->assert_deep_equals( 2379 ); 2380 2381 $this->_getTopicList( 2382 $this->{test_web}, 2383 { 2384 includeTopics => 'Ok*', 2385 excludeTopics => '*atopic', 2386 casesensitive => 1 2387 }, 2388 'case sensitive okatopic topic 3', 2015 2389 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 2016 $this->_getTopicList( 2017 $this->{test_web}, 2018 { 2019 includeTopics => 'Ok*', 2020 excludeTopics => '*atopic', 2021 casesensitive => 1 2022 } 2023 ), 2024 'case sensitive okatopic topic 3' 2025 ); 2026 2027 $this->assert_deep_equals( 2390 ); 2391 2392 $this->_getTopicList( 2393 $this->{test_web}, 2394 { 2395 includeTopics => 'ok*topic', 2396 excludeTopics => 'okatopic', 2397 casesensitive => 0 2398 }, 2399 'case insensitive okatopic topic', 2028 2400 [ 'OkBTopic', 'OkTopic' ], 2029 $this->_getTopicList( 2030 $this->{test_web}, 2031 { 2032 includeTopics => 'ok*topic', 2033 excludeTopics => 'okatopic', 2034 casesensitive => 0 2035 } 2036 ), 2037 'case insensitive okatopic topic' 2038 ); 2039 2401 ); 2402 2403 return; 2040 2404 } 2041 2405 … … 2111 2475 $this->assert_str_equals( $expected, $actual ); 2112 2476 2477 return; 2113 2478 } 2114 2479 … … 2116 2481 my $this = shift; 2117 2482 2118 my $topicObject=2119 Foswiki:: Meta->new( $this->{session}, $this->{test_web}, 'TestForm',2120 <<'FORM');2483 my ($topicObject) = 2484 Foswiki::Func::readTopic( $this->{test_web}, 'TestForm' ); 2485 $topicObject->text(<<'FORM'); 2121 2486 | *Name* | *Type* | *Size* | *Value* | *Tooltip message* | *Attributes* | 2122 2487 | Why | text | 32 | | Mandatory field | M | … … 2124 2489 FORM 2125 2490 $topicObject->save(); 2126 $topicObject = 2127 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'SplodgeOne', 2128 <<FORM); 2491 $topicObject->finish(); 2492 ($topicObject) = 2493 Foswiki::Func::readTopic( $this->{test_web}, 'SplodgeOne' ); 2494 $topicObject->text( <<'FORM'); 2129 2495 %META:FORM{name="TestForm"}% 2130 2496 %META:FIELD{name="Ecks" attributes="" title="X" value="Blah"}% … … 2137 2503 my $expected = 'SplodgeOne;Blah'; 2138 2504 $this->assert_str_equals( $expected, $actual ); 2139 2505 $topicObject->finish(); 2506 2507 return; 2140 2508 } 2141 2509 … … 2143 2511 my $this = shift; 2144 2512 2145 my $topicObject=2146 Foswiki:: Meta->new( $this->{session}, $this->{test_web}, 'TestForm',2147 <<'FORM');2513 my ($topicObject) = 2514 Foswiki::Func::readTopic( $this->{test_web}, 'TestForm' ); 2515 $topicObject->text( <<'FORM'); 2148 2516 | *Name* | *Type* | *Size* | *Value* | *Tooltip message* | *Attributes* | 2149 2517 | Why | text | 32 | | Mandatory field | M | … … 2151 2519 FORM 2152 2520 $topicObject->save(); 2153 $topicObject = 2154 Foswiki::Meta->new( $this->{session}, $this->{test_web}, 'SplodgeOne', 2155 <<FORM); 2521 $topicObject->finish(); 2522 ($topicObject) = 2523 Foswiki::Func::readTopic( $this->{test_web}, 'SplodgeOne' ); 2524 $topicObject->text(<<'FORM'); 2156 2525 %META:FORM{name="TestForm"}% 2157 2526 %META:FIELD{name="Ecks" attributes="" title="X" value="Blah"}% … … 2164 2533 my $expected = 'SplodgeOne;Blah'; 2165 2534 $this->assert_str_equals( $expected, $actual ); 2166 2535 $topicObject->finish(); 2536 2537 return; 2167 2538 } 2168 2539 … … 2188 2559 HERE 2189 2560 $this->assert_str_equals( $expected, $actual ); 2561 2562 return; 2190 2563 } 2191 2564 … … 2195 2568 #need summary, and multiple 2196 2569 sub _multiWebSeptic { 2197 my ( $this, $head, $foot, $sep, $results, $expected, $format ) = @_; 2570 my ( $this, $head, $foot, $sep, $results, $format, $default, %expectations ) 2571 = @_; 2198 2572 my $str = $results ? '*Preferences' : 'Septic'; 2199 2573 $head = $head ? 'header="HEAD($web)"' : ''; … … 2201 2575 $sep = defined $sep ? "separator=\"$sep\"" : ''; 2202 2576 $format = '$topic' unless ( defined($format) ); 2577 my $expected = $this->_expect_with_deps( $default, %expectations ); 2203 2578 2204 2579 my $result = $this->{test_topicObject}->expandMacros( … … 2214 2589 $expected =~ s/\n$//s; 2215 2590 $this->assert_str_equals( $expected, $result ); 2591 2592 return; 2216 2593 } 2217 2594 2218 2595 ##################### 2219 2596 2220 sub verify_multiWeb_no_header_no_footer_no_separator_with_results { 2221 my $this = shift; 2222 $this->_multiWebSeptic( 0, 0, undef, 1, <<EXPECT); 2597 sub test_multiWeb_no_header_no_footer_no_separator_with_results { 2598 my $this = shift; 2599 $this->_multiWebSeptic( 2600 0, 0, undef, 1, undef, <<'FOSWIKI12', 2601 SitePreferences 2602 WebPreferences 2603 DefaultPreferences 2604 WebPreferences 2605 FOSWIKI12 2606 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2223 2607 DefaultPreferences 2224 2608 WebPreferences 2225 2609 SitePreferences 2226 2610 WebPreferences 2227 EXPECT 2228 } 2229 2230 sub verify_multiWeb_no_header_no_footer_no_separator_with_results_counters { 2231 my $this = shift; 2232 $this->_multiWebSeptic( 0, 0, undef, 1, 2233 <<EXPECT, '$nhits, $ntopics, $index, $topic' ); 2611 FOSWIKI11 2612 2613 return; 2614 } 2615 2616 sub test_multiWeb_no_header_no_footer_no_separator_with_results_counters { 2617 my $this = shift; 2618 $this->_multiWebSeptic( 2619 0, 0, undef, 1, 2620 '$nhits, $ntopics, $index, $topic', <<'FOSWIKI12', 2621 1, 1, 1, SitePreferences 2622 2, 2, 2, WebPreferences 2623 1, 1, 3, DefaultPreferences 2624 2, 2, 4, WebPreferences 2625 FOSWIKI12 2626 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2234 2627 1, 1, 1, DefaultPreferences 2235 2628 2, 2, 2, WebPreferences 2236 2629 1, 1, 3, SitePreferences 2237 2630 2, 2, 4, WebPreferences 2238 EXPECT 2239 } 2240 2241 sub verify_multiWeb_no_header_no_footer_no_separator_no_results { 2242 my $this = shift; 2243 $this->_multiWebSeptic( 0, 0, undef, 0, <<EXPECT); 2244 EXPECT 2245 } 2246 2247 sub verify_multiWeb_no_header_no_footer_empty_separator_with_results { 2248 my $this = shift; 2249 $this->_multiWebSeptic( 0, 0, "", 1, <<EXPECT); 2631 FOSWIKI11 2632 2633 return; 2634 } 2635 2636 sub test_multiWeb_no_header_no_footer_no_separator_no_results { 2637 my $this = shift; 2638 $this->_multiWebSeptic( 0, 0, undef, 0, undef, <<'FOSWIKI12'); 2639 FOSWIKI12 2640 2641 return; 2642 } 2643 2644 sub test_multiWeb_no_header_no_footer_empty_separator_with_results { 2645 my $this = shift; 2646 $this->_multiWebSeptic( 2647 0, 0, "", 1, undef, <<'FOSWIKI12', 2648 SitePreferencesWebPreferencesDefaultPreferencesWebPreferences 2649 FOSWIKI12 2650 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2250 2651 DefaultPreferencesWebPreferencesSitePreferencesWebPreferences 2251 EXPECT 2252 } 2253 2254 sub verify_multiWeb_no_header_no_footer_empty_separator_no_results { 2255 my $this = shift; 2256 $this->_multiWebSeptic( 0, 0, "", 0, <<EXPECT); 2257 EXPECT 2258 } 2259 2260 sub verify_multiWeb_no_header_no_footer_with_separator_with_results { 2261 my $this = shift; 2262 $this->_multiWebSeptic( 0, 0, ",", 1, <<EXPECT); 2652 FOSWIKI11 2653 2654 return; 2655 } 2656 2657 sub test_multiWeb_no_header_no_footer_empty_separator_no_results { 2658 my $this = shift; 2659 $this->_multiWebSeptic( 0, 0, "", 0, undef, <<'FOSWIKI12'); 2660 FOSWIKI12 2661 2662 return; 2663 } 2664 2665 sub test_multiWeb_no_header_no_footer_with_separator_with_results { 2666 my $this = shift; 2667 $this->_multiWebSeptic( 2668 0, 0, ",", 1, undef, <<'FOSWIKI12', 2669 SitePreferences,WebPreferences,DefaultPreferences,WebPreferences 2670 FOSWIKI12 2671 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2263 2672 DefaultPreferences,WebPreferences,SitePreferences,WebPreferences 2264 EXPECT 2265 } 2266 2267 sub verify_multiWeb_no_header_no_footer_with_separator_no_results { 2268 my $this = shift; 2269 $this->_multiWebSeptic( 0, 0, ",", 0, <<EXPECT); 2270 EXPECT 2673 FOSWIKI11 2674 2675 return; 2676 } 2677 2678 sub test_multiWeb_no_header_no_footer_with_separator_no_results { 2679 my $this = shift; 2680 $this->_multiWebSeptic( 0, 0, ",", 0, undef, <<'FOSWIKI12'); 2681 FOSWIKI12 2682 2683 return; 2271 2684 } 2272 2685 ##################### 2273 2686 2274 sub verify_multiWeb_no_header_with_footer_no_separator_with_results { 2275 my $this = shift; 2276 $this->_multiWebSeptic( 0, 1, undef, 1, <<EXPECT); 2687 sub test_multiWeb_no_header_with_footer_no_separator_with_results { 2688 my $this = shift; 2689 $this->_multiWebSeptic( 2690 0, 1, undef, 1, undef, <<'FOSWIKI12', 2691 SitePreferences 2692 WebPreferences 2693 FOOT(2,2)DefaultPreferences 2694 WebPreferences 2695 FOOT(2,2) 2696 FOSWIKI12 2697 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2277 2698 DefaultPreferences 2278 2699 WebPreferences … … 2280 2701 WebPreferences 2281 2702 FOOT(2,2) 2282 EXPECT 2283 } 2284 2285 sub verify_multiWeb_no_header_with_footer_no_separator_no_results { 2286 my $this = shift; 2287 $this->_multiWebSeptic( 0, 1, undef, 0, <<EXPECT); 2288 EXPECT 2289 } 2290 2291 sub verify_multiWeb_no_header_with_footer_empty_separator_with_results { 2292 my $this = shift; 2293 $this->_multiWebSeptic( 0, 1, "", 1, <<EXPECT); 2703 FOSWIKI11 2704 2705 return; 2706 } 2707 2708 sub test_multiWeb_no_header_with_footer_no_separator_no_results { 2709 my $this = shift; 2710 $this->_multiWebSeptic( 0, 1, undef, 0, undef, <<'FOSWIKI12'); 2711 FOSWIKI12 2712 2713 return; 2714 } 2715 2716 sub test_multiWeb_no_header_with_footer_empty_separator_with_results { 2717 my $this = shift; 2718 $this->_multiWebSeptic( 2719 0, 1, "", 1, undef, <<'FOSWIKI12', 2720 SitePreferencesWebPreferencesFOOT(2,2)DefaultPreferencesWebPreferencesFOOT(2,2) 2721 FOSWIKI12 2722 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2294 2723 DefaultPreferencesWebPreferencesFOOT(2,2)SitePreferencesWebPreferencesFOOT(2,2) 2295 EXPECT 2296 } 2297 2298 sub verify_multiWeb_no_header_with_footer_empty_separator_no_results { 2299 my $this = shift; 2300 $this->_multiWebSeptic( 0, 1, "", 0, <<EXPECT); 2301 EXPECT 2302 } 2303 2304 sub verify_multiWeb_no_header_with_footer_with_separator_with_results { 2305 my $this = shift; 2306 $this->_multiWebSeptic( 0, 1, ",", 1, <<EXPECT); 2724 FOSWIKI11 2725 2726 return; 2727 } 2728 2729 sub test_multiWeb_no_header_with_footer_empty_separator_no_results { 2730 my $this = shift; 2731 $this->_multiWebSeptic( 0, 1, "", 0, undef, <<'FOSWIKI12'); 2732 FOSWIKI12 2733 2734 return; 2735 } 2736 2737 sub test_multiWeb_no_header_with_footer_with_separator_with_results { 2738 my $this = shift; 2739 $this->_multiWebSeptic( 2740 0, 1, ",", 1, undef, <<'FOSWIKI12', 2741 SitePreferences,WebPreferencesFOOT(2,2)DefaultPreferences,WebPreferencesFOOT(2,2) 2742 FOSWIKI12 2743 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2307 2744 DefaultPreferences,WebPreferencesFOOT(2,2)SitePreferences,WebPreferencesFOOT(2,2) 2308 EXPECT 2745 FOSWIKI11 2746 2747 return; 2309 2748 } 2310 2749 2311 2750 ##################### 2312 2751 2313 sub verify_multiWeb_with_header_with_footer_no_separator_with_results { 2314 my $this = shift; 2315 $this->_multiWebSeptic( 1, 1, undef, 1, <<EXPECT); 2752 sub test_multiWeb_with_header_with_footer_no_separator_with_results { 2753 my $this = shift; 2754 $this->_multiWebSeptic( 2755 1, 1, undef, 1, undef, <<'FOSWIKI12', 2756 HEAD(Main) 2757 SitePreferences 2758 WebPreferences 2759 FOOT(2,2)HEAD(System) 2760 DefaultPreferences 2761 WebPreferences 2762 FOOT(2,2) 2763 FOSWIKI12 2764 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2316 2765 HEAD(System) 2317 2766 DefaultPreferences … … 2321 2770 WebPreferences 2322 2771 FOOT(2,2) 2323 EXPECT 2324 } 2325 2326 sub verify_multiWeb_with_header_with_footer_no_separator_no_results { 2327 my $this = shift; 2328 $this->_multiWebSeptic( 1, 1, undef, 0, <<EXPECT); 2329 EXPECT 2330 } 2331 2332 sub verify_multiWeb_with_header_with_footer_empty_separator_with_results { 2333 my $this = shift; 2334 $this->_multiWebSeptic( 1, 1, "", 1, <<EXPECT); 2772 FOSWIKI11 2773 2774 return; 2775 } 2776 2777 sub test_multiWeb_with_header_with_footer_no_separator_no_results { 2778 my $this = shift; 2779 $this->_multiWebSeptic( 1, 1, undef, 0, undef, <<'FOSWIKI12'); 2780 FOSWIKI12 2781 2782 return; 2783 } 2784 2785 sub test_multiWeb_with_header_with_footer_empty_separator_with_results { 2786 my $this = shift; 2787 $this->_multiWebSeptic( 2788 1, 1, "", 1, undef, <<'FOSWIKI12', 2789 HEAD(Main)SitePreferencesWebPreferencesFOOT(2,2)HEAD(System)DefaultPreferencesWebPreferencesFOOT(2,2) 2790 FOSWIKI12 2791 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2335 2792 HEAD(System)DefaultPreferencesWebPreferencesFOOT(2,2)HEAD(Main)SitePreferencesWebPreferencesFOOT(2,2) 2336 EXPECT 2337 } 2338 2339 sub verify_multiWeb_with_header_with_footer_empty_separator_no_results { 2340 my $this = shift; 2341 $this->_multiWebSeptic( 1, 1, "", 0, <<EXPECT); 2342 EXPECT 2343 } 2344 2345 sub verify_multiWeb_with_header_with_footer_with_separator_with_results { 2346 my $this = shift; 2347 $this->_multiWebSeptic( 1, 1, ",", 1, <<EXPECT); 2793 FOSWIKI11 2794 2795 return; 2796 } 2797 2798 sub test_multiWeb_with_header_with_footer_empty_separator_no_results { 2799 my $this = shift; 2800 $this->_multiWebSeptic( 1, 1, "", 0, undef, <<'FOSWIKI12'); 2801 FOSWIKI12 2802 2803 return; 2804 } 2805 2806 sub test_multiWeb_with_header_with_footer_with_separator_with_results { 2807 my $this = shift; 2808 $this->_multiWebSeptic( 2809 1, 1, ",", 1, undef, <<'FOSWIKI12', 2810 HEAD(Main)SitePreferences,WebPreferencesFOOT(2,2)HEAD(System)DefaultPreferences,WebPreferencesFOOT(2,2) 2811 FOSWIKI12 2812 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2348 2813 HEAD(System)DefaultPreferences,WebPreferencesFOOT(2,2)HEAD(Main)SitePreferences,WebPreferencesFOOT(2,2) 2349 EXPECT 2350 } 2351 2352 sub verify_multiWeb_with_header_with_footer_with_separator_no_results { 2353 my $this = shift; 2354 $this->_multiWebSeptic( 1, 1, ",", 0, <<EXPECT); 2355 EXPECT 2814 FOSWIKI11 2815 2816 return; 2817 } 2818 2819 sub test_multiWeb_with_header_with_footer_with_separator_no_results { 2820 my $this = shift; 2821 $this->_multiWebSeptic( 1, 1, ",", 0, undef, <<'FOSWIKI12'); 2822 FOSWIKI12 2823 2824 return; 2356 2825 } 2357 2826 2358 2827 ##################### 2359 2828 2360 sub verify_multiWeb_with_header_no_footer_no_separator_with_results { 2361 my $this = shift; 2362 $this->_multiWebSeptic( 1, 0, undef, 1, <<EXPECT); 2829 sub test_multiWeb_with_header_no_footer_no_separator_with_results { 2830 my $this = shift; 2831 $this->_multiWebSeptic( 2832 1, 0, undef, 1, undef, <<'FOSWIKI12', 2833 HEAD(Main) 2834 SitePreferences 2835 WebPreferences 2836 HEAD(System) 2837 DefaultPreferences 2838 WebPreferences 2839 FOSWIKI12 2840 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2363 2841 HEAD(System) 2364 2842 DefaultPreferences … … 2367 2845 SitePreferences 2368 2846 WebPreferences 2369 EXPECT 2370 } 2371 2372 sub verify_multiWeb_with_header_no_footer_no_separator_no_results { 2373 my $this = shift; 2374 $this->_multiWebSeptic( 1, 0, undef, 0, <<EXPECT); 2375 EXPECT 2376 } 2377 2378 sub verify_multiWeb_with_header_no_footer_empty_separator_with_results { 2379 my $this = shift; 2380 $this->_multiWebSeptic( 1, 0, "", 1, <<EXPECT); 2847 FOSWIKI11 2848 2849 return; 2850 } 2851 2852 sub test_multiWeb_with_header_no_footer_no_separator_no_results { 2853 my $this = shift; 2854 $this->_multiWebSeptic( 1, 0, undef, 0, undef, <<'FOSWIKI12'); 2855 FOSWIKI12 2856 2857 return; 2858 } 2859 2860 sub test_multiWeb_with_header_no_footer_empty_separator_with_results { 2861 my $this = shift; 2862 $this->_multiWebSeptic( 2863 1, 0, "", 1, undef, <<'FOSWIKI12', 2864 HEAD(Main)SitePreferencesWebPreferencesHEAD(System)DefaultPreferencesWebPreferences 2865 FOSWIKI12 2866 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2381 2867 HEAD(System)DefaultPreferencesWebPreferencesHEAD(Main)SitePreferencesWebPreferences 2382 EXPECT 2383 } 2384 2385 sub verify_multiWeb_with_header_no_footer_empty_separator_no_results { 2386 my $this = shift; 2387 $this->_multiWebSeptic( 1, 0, "", 0, <<EXPECT); 2388 EXPECT 2389 } 2390 2391 sub verify_multiWeb_with_header_no_footer_with_separator_with_results { 2392 my $this = shift; 2393 $this->_multiWebSeptic( 1, 0, ",", 1, <<EXPECT); 2868 FOSWIKI11 2869 2870 return; 2871 } 2872 2873 sub test_multiWeb_with_header_no_footer_empty_separator_no_results { 2874 my $this = shift; 2875 $this->_multiWebSeptic( 1, 0, "", 0, undef, <<'FOSWIKI12'); 2876 FOSWIKI12 2877 2878 return; 2879 } 2880 2881 sub test_multiWeb_with_header_no_footer_with_separator_with_results { 2882 my $this = shift; 2883 $this->_multiWebSeptic( 2884 1, 0, ",", 1, undef, <<'FOSWIKI12', 2885 HEAD(Main)SitePreferences,WebPreferencesHEAD(System)DefaultPreferences,WebPreferences 2886 FOSWIKI12 2887 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2394 2888 HEAD(System)DefaultPreferences,WebPreferencesHEAD(Main)SitePreferences,WebPreferences 2395 EXPECT 2396 } 2397 2398 sub verify_multiWeb_with_header_no_footer_with_separator_no_results { 2399 my $this = shift; 2400 $this->_multiWebSeptic( 1, 0, ",", 0, <<EXPECT); 2401 EXPECT 2889 FOSWIKI11 2890 2891 return; 2892 } 2893 2894 sub test_multiWeb_with_header_no_footer_with_separator_no_results { 2895 my $this = shift; 2896 $this->_multiWebSeptic( 1, 0, ",", 0, undef, <<'FOSWIKI12'); 2897 FOSWIKI12 2898 2899 return; 2402 2900 } 2403 2901 2404 2902 #Item1992: calling Foswiki::Search::_makeTopicPattern repeatedly made a big mess. 2405 sub verify_web_and_topic_expansion {2903 sub test_web_and_topic_expansion { 2406 2904 my $this = shift; 2407 2905 my $result = $this->{test_topicObject}->expandMacros( … … 2417 2915 }%' 2418 2916 ); 2419 my $expected = <<EXPECT; 2917 my $expected = $this->_expect_with_deps( 2918 <<'FOSWIKI12', 2919 Main.WebHome 2920 Main.WebPreferences 2921 FOOT(2,2)Sandbox.WebHome 2922 Sandbox.WebPreferences 2923 FOOT(2,2)System.WebHome 2924 System.WebPreferences 2925 FOOT(2,2) 2926 FOSWIKI12 2927 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2420 2928 System.WebHome 2421 2929 System.WebPreferences … … 2425 2933 Sandbox.WebPreferences 2426 2934 FOOT(2,2) 2427 EXPECT 2935 FOSWIKI11 2428 2936 $expected =~ s/\n$//s; 2429 2937 $this->assert_str_equals( $expected, $result ); 2938 2939 return; 2430 2940 } 2431 2941 2432 2942 ##################### 2433 2943 # PAGING 2434 sub verify_paging_three_webs_first_five { 2435 my $this = shift; 2436 2944 sub test_paging_three_webs_first_page { 2945 my $this = shift; 2437 2946 my $result = $this->{test_topicObject}->expandMacros( 2438 2947 '%SEARCH{ … … 2450 2959 ); 2451 2960 2452 my $expected = <<EXPECT; 2961 my $expected = $this->_expect_with_deps( 2962 <<'FOSWIKI12', 2963 Main.WebChanges 2964 Main.WebHome 2965 Main.WebIndex 2966 Main.WebPreferences 2967 FOOT(4,4)Sandbox.WebChanges 2968 FOOT(1,1) 2969 FOSWIKI12 2970 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2453 2971 System.WebChanges 2454 2972 System.WebHome … … 2457 2975 FOOT(4,4)Main.WebChanges 2458 2976 FOOT(1,1) 2459 EXPECT 2977 FOSWIKI11 2460 2978 $expected =~ s/\n$//s; 2461 2979 $this->assert_str_equals( $expected, $result ); 2462 } 2463 2464 sub verify_paging_three_webs_second_five { 2980 2981 return; 2982 } 2983 2984 sub test_paging_three_webs_second_page { 2465 2985 my $this = shift; 2466 2986 … … 2480 3000 ); 2481 3001 2482 my $expected = <<EXPECT; 3002 my $expected = $this->_expect_with_deps( 3003 <<'FOSWIKI12', 3004 Sandbox.WebHome 3005 Sandbox.WebIndex 3006 Sandbox.WebPreferences 3007 FOOT(3,3)System.WebChanges 3008 System.WebHome 3009 FOOT(2,2) 3010 FOSWIKI12 3011 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2483 3012 Main.WebHome 2484 3013 Main.WebIndex … … 2487 3016 Sandbox.WebHome 2488 3017 FOOT(2,2) 2489 EXPECT 3018 FOSWIKI11 2490 3019 $expected =~ s/\n$//s; 2491 3020 $this->assert_str_equals( $expected, $result ); 2492 } 2493 2494 sub verify_paging_three_webs_third_five { 3021 3022 return; 3023 } 3024 3025 sub test_paging_three_webs_third_page { 2495 3026 my $this = shift; 2496 3027 … … 2510 3041 ); 2511 3042 2512 my $expected = <<EXPECT; 3043 my $expected = $this->_expect_with_deps( 3044 <<'FOSWIKI12', 3045 System.WebIndex 3046 System.WebPreferences 3047 FOOT(2,2) 3048 FOSWIKI12 3049 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2513 3050 Sandbox.WebIndex 2514 3051 Sandbox.WebPreferences 2515 3052 FOOT(2,2) 2516 EXPECT 3053 FOSWIKI11 2517 3054 $expected =~ s/\n$//s; 2518 3055 $this->assert_str_equals( $expected, $result ); 2519 } 2520 2521 sub verify_paging_three_webs_fourth_five { 3056 3057 return; 3058 } 3059 3060 sub test_paging_three_webs_fourth_page { 2522 3061 my $this = shift; 2523 3062 … … 2537 3076 ); 2538 3077 2539 my $expected = << EXPECT;3078 my $expected = <<'EXPECT'; 2540 3079 EXPECT 2541 3080 $expected =~ s/\n$//s; 2542 3081 $this->assert_str_equals( $expected, $result ); 2543 } 2544 2545 sub verify_paging_three_webs_way_too_far { 3082 3083 return; 3084 } 3085 3086 sub test_paging_three_webs_way_too_far { 2546 3087 my $this = shift; 2547 3088 … … 2561 3102 ); 2562 3103 2563 my $expected = << EXPECT;3104 my $expected = <<'EXPECT'; 2564 3105 EXPECT 2565 3106 $expected =~ s/\n$//s; 2566 3107 $this->assert_str_equals( $expected, $result ); 3108 3109 return; 2567 3110 } 2568 3111 … … 2586 3129 }%' 2587 3130 ); 2588 2589 my $expected = <<EXPECT; 3131 my $expected = $this->_expect_with_deps( 3132 <<'FOSWIKI12', 3133 Main.WebPreferences 3134 FOOT(1,1) 3135 Sandbox.WebPreferences 3136 FOOT(1,1) 3137 System.WebPreferences 3138 FOOT(1,1) 3139 FOSWIKI12 3140 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2590 3141 System.WebPreferences 2591 3142 FOOT(1,1) … … 2594 3145 Sandbox.WebPreferences 2595 3146 FOOT(1,1) 2596 EXPECT 3147 FOSWIKI11 3148 2597 3149 $expected =~ s/\n$//s; 2598 3150 $this->assert_str_equals( $expected, $result ); 3151 3152 return; 2599 3153 } 2600 3154 2601 3155 #------------------------------------ 2602 3156 # PAGING with limit= does weird things. 2603 sub verify_paging_with_limit_first_five {3157 sub test_paging_with_limit_first_page { 2604 3158 my $this = shift; 2605 3159 … … 2620 3174 ); 2621 3175 2622 my $expected = <<EXPECT; 3176 my $expected = $this->_expect_with_deps( 3177 <<'FOSWIKI12', 3178 Main.WebChanges 3179 Main.WebHome 3180 Main.WebIndex 3181 FOOT(3,3) 3182 FOSWIKI12 3183 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2623 3184 System.WebChanges 2624 3185 System.WebHome 2625 3186 System.WebIndex 2626 3187 FOOT(3,3) 2627 EXPECT 3188 FOSWIKI11 2628 3189 $expected =~ s/\n$//s; 2629 3190 $this->assert_str_equals( $expected, $result ); 2630 } 2631 2632 sub verify_paging_with_limit_second_five { 3191 3192 return; 3193 } 3194 3195 sub test_paging_with_limit_second_page { 2633 3196 my $this = shift; 2634 3197 … … 2649 3212 ); 2650 3213 2651 my $expected = <<EXPECT; 3214 my $expected = $this->_expect_with_deps( 3215 <<'FOSWIKI12', 3216 Sandbox.WebChanges 3217 Sandbox.WebHome 3218 Sandbox.WebIndex 3219 FOOT(3,3) 3220 FOSWIKI12 3221 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2652 3222 Main.WebChanges 2653 3223 Main.WebHome 2654 3224 Main.WebIndex 2655 3225 FOOT(3,3) 2656 EXPECT 3226 FOSWIKI11 2657 3227 $expected =~ s/\n$//s; 2658 3228 $this->assert_str_equals( $expected, $result ); 2659 } 2660 2661 sub verify_paging_with_limit_third_five { 3229 3230 return; 3231 } 3232 3233 sub test_paging_with_limit_third_page { 2662 3234 my $this = shift; 2663 3235 … … 2678 3250 ); 2679 3251 2680 my $expected = <<EXPECT; 3252 my $expected = $this->_expect_with_deps( 3253 <<'FOSWIKI12', 3254 System.WebChanges 3255 System.WebHome 3256 System.WebIndex 3257 FOOT(3,3) 3258 FOSWIKI12 3259 'Foswiki,<,1.2' => <<'FOSWIKI11'); 2681 3260 Sandbox.WebChanges 2682 3261 Sandbox.WebHome 2683 3262 Sandbox.WebIndex 2684 3263 FOOT(3,3) 2685 EXPECT 3264 FOSWIKI11 2686 3265 $expected =~ s/\n$//s; 2687 3266 $this->assert_str_equals( $expected, $result ); 2688 } 2689 2690 sub verify_paging_with_limit_fourth_five { 3267 3268 return; 3269 } 3270 3271 sub test_paging_with_limit_fourth_page { 2691 3272 my $this = shift; 2692 3273 … … 2707 3288 ); 2708 3289 2709 my $expected = << EXPECT;3290 my $expected = <<'EXPECT'; 2710 3291 EXPECT 2711 3292 $expected =~ s/\n$//s; 2712 3293 $this->assert_str_equals( $expected, $result ); 2713 } 2714 2715 sub verify_paging_with_limit_way_too_far { 3294 3295 return; 3296 } 3297 3298 sub test_paging_with_limit_way_too_far { 2716 3299 my $this = shift; 2717 3300 … … 2732 3315 ); 2733 3316
