Changeset 13835


Ignore:
Timestamp:
01/27/12 04:43:16 (4 weeks ago)
Author:
PaulHarvey
Message:

Item11456: Finally, sync Fn_SEARCH

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Release01x01/UnitTestContrib/test/unit/Fn_SEARCH.pm

    r13729 r13835  
    11# tests for the correct expansion of SEARCH 
    22# 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# 
    415package Fn_SEARCH; 
    516 
     
    718use warnings; 
    819 
    9 use FoswikiFnTestCase; 
     20use FoswikiFnTestCase(); 
    1021our @ISA = qw( FoswikiFnTestCase ); 
    1122 
    12 use Foswiki; 
     23use Foswiki(); 
    1324use Error qw( :try ); 
    1425use Assert; 
    15 use Foswiki::Search; 
    16 use Foswiki::Search::InfoCache; 
    17 use Foswiki::Render; 
     26use English qw( -no_match_vars ); 
     27use Foswiki::Search(); 
     28use Foswiki::Search::InfoCache(); 
    1829 
    1930use File::Spec qw(case_tolerant) 
     
    2132 
    2233sub new { 
    23     my $self = shift()->SUPER::new( 'SEARCH', @_ ); 
     34    my ( $class, @args ) = @_; 
     35    my $self = $class->SUPER::new( 'SEARCH', @args ); 
     36 
    2437    return $self; 
    2538} 
     
    3447 
    3548sub 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; 
    5277} 
    5378 
     
    6085                next unless $alg =~ /^(.*)\.pm$/; 
    6186                $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' ); 
    6791                $salgs{$alg} = 1; 
    6892            } 
     
    82106        my $fn = $alg . 'Search'; 
    83107        push( @groups, $fn ); 
    84         next if ( defined(&$fn) ); 
    85         eval <<SUB; 
     108        next if ( defined( &{$fn} ) ); 
     109        if ( not eval <<"SUB" or $EVAL_ERROR ) { 
    86110sub $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} 
     1141; 
    89115SUB 
    90         die $@ if $@; 
     116            die $EVAL_ERROR; 
     117        } 
    91118    } 
    92119    foreach my $alg ( keys %qalgs ) { 
     
    94121        push( @groups, $fn ); 
    95122        next if ( defined(&$fn) ); 
    96         eval <<SUB; 
     123        if ( not eval <<"SUB" or $EVAL_ERROR ) { 
    97124sub $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} 
     1281; 
    100129SUB 
    101         die $@ if $@; 
     130            die $EVAL_ERROR; 
     131        } 
    102132    } 
    103133 
    104     return \@groups; 
     134    return ( \@groups ); 
    105135} 
    106136 
    107137sub 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 
     165sub tear_down { 
    108166    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; 
    110181} 
    111182 
     
    121192    $this->assert_matches( qr/OkBTopic/, $result ); 
    122193    $this->assert_matches( qr/OkATopic/, $result ); 
     194 
     195    return; 
    123196} 
    124197 
     
    131204 
    132205    $this->assert_str_equals( '', $result ); 
     206 
     207    return; 
    133208} 
    134209 
     
    145220    $this->assert_does_not_match( qr/OkBTopic/, $result ); 
    146221    $this->assert_does_not_match( qr/OkATopic/, $result ); 
     222 
     223    return; 
    147224} 
    148225 
     
    160237    $this->assert_matches( qr/OkBTopic/, $result ); 
    161238    $this->assert_matches( qr/OkATopic/, $result ); 
     239 
     240    return; 
    162241} 
    163242 
     
    173252    $this->assert_matches( qr/OkBTopic/, $result ); 
    174253    $this->assert_matches( qr/OkATopic/, $result ); 
     254 
     255    return; 
    175256} 
    176257 
     
    188269    $this->assert_matches( qr/OkBTopic/, $result ); 
    189270    $this->assert_matches( qr/OkATopic/, $result ); 
     271 
     272    return; 
    190273} 
    191274 
     
    203286    $this->assert_matches( qr/OkBTopic/, $result ); 
    204287    $this->assert_matches( qr/OkATopic/, $result ); 
     288 
     289    return; 
    205290} 
    206291 
     
    220305    # 'blah' is in OkATopic, but not as a word 
    221306    $this->assert_does_not_match( qr/OkBTopic/, $result, $result ); 
     307 
     308    return; 
    222309} 
    223310 
     
    225312    my $this = shift; 
    226313 
    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"); 
    230317    $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"); 
    234321    $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"); 
    238327    $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"); 
    242332    $topicObject->save(); 
     333    $topicObject->finish(); 
    243334 
    244335    my $result = 
     
    247338      ); 
    248339 
    249     my $expected = <<EXPECT; 
     340    my $expected = <<'EXPECT'; 
    250341RealBeer 
    251342VirtualBeer 
     
    253344EXPECT 
    254345    $this->assert_str_equals( $expected, $result . "\n" ); 
     346 
     347    return; 
    255348} 
    256349 
     
    258351    my $this = shift; 
    259352 
    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"); 
    263356    $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"); 
    267360    $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"); 
    271366    $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"); 
    275371    $topicObject->save(); 
     372    $topicObject->finish(); 
    276373 
    277374    my $result = 
     
    280377      ); 
    281378 
    282     my $expected = <<EXPECT; 
     379    my $expected = <<'EXPECT'; 
    283380FamouslyBeered 
    284381RealBeer 
     
    287384EXPECT 
    288385    $this->assert_str_equals( $expected, $result . "\n" ); 
     386 
     387    return; 
    289388} 
    290389 
     
    292391    my $this = shift; 
    293392 
    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"); 
    297396    $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"); 
    301400    $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"); 
    305406    $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"); 
    309411    $topicObject->save(); 
     412    $topicObject->finish(); 
    310413 
    311414    my $result = 
     
    314417      ); 
    315418 
    316     my $expected = <<EXPECT; 
     419    my $expected = <<'EXPECT'; 
    317420RealBeer 
    318421VirtualBeer 
    319422EXPECT 
    320423    $this->assert_str_equals( $expected, $result . "\n" ); 
    321 } 
     424 
     425    return; 
     426} 
     427 
     428sub _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 
     451sub 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', 
     465Main.WebHome 
     466Main.WebPreferences 
     467Main.WebSearch 
     468Sandbox.WebHome 
     469Sandbox.WebPreferences 
     470Sandbox.WebSearch 
     471System.WebHome 
     472System.WebPreferences 
     473System.WebSearch 
     474FOSWIKI12 
     475        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
     476System.WebHome 
     477System.WebPreferences 
     478System.WebSearch 
     479Main.WebHome 
     480Main.WebPreferences 
     481Main.WebSearch 
     482Sandbox.WebHome 
     483Sandbox.WebPreferences 
     484Sandbox.WebSearch 
     485FOSWIKI11 
     486    $expected =~ s/\n$//s; 
     487    $this->assert_str_equals( $expected, $result ); 
     488 
     489    return; 
     490} 
     491 
     492sub 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', 
     506Main.WebHome 
     507Main.WebPreferences 
     508Main.WebSearch 
     509Sandbox.WebHome 
     510Sandbox.WebPreferences 
     511Sandbox.WebSearch 
     512System.WebHome 
     513System.WebPreferences 
     514System.WebSearch 
     515FOSWIKI12 
     516        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
     517System.WebHome 
     518System.WebPreferences 
     519System.WebSearch 
     520Main.WebHome 
     521Main.WebPreferences 
     522Main.WebSearch 
     523Sandbox.WebHome 
     524Sandbox.WebPreferences 
     525Sandbox.WebSearch 
     526FOSWIKI11 
     527    $expected =~ s/\n$//s; 
     528    $this->assert_str_equals( $expected, $result ); 
     529 
     530    return; 
     531} 
     532 
    322533##################### 
    323534sub _septic { 
     
    333544    $expected =~ s/\n$//s; 
    334545    $this->assert_str_equals( $expected, $result ); 
     546 
     547    return; 
    335548} 
    336549 
    337550##################### 
    338551 
    339 sub verify_no_header_no_footer_no_separator_with_results { 
    340     my $this = shift; 
    341     $this->_septic( 0, 0, undef, 1, <<EXPECT); 
     552sub test_no_header_no_footer_no_separator_with_results { 
     553    my $this = shift; 
     554    $this->_septic( 0, 0, undef, 1, <<'EXPECT'); 
    342555OkATopic 
    343556OkBTopic 
    344557OkTopic 
    345558EXPECT 
    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 
     563sub test_no_header_no_footer_no_separator_no_results { 
     564    my $this = shift; 
     565    $this->_septic( 0, 0, undef, 0, <<'EXPECT'); 
    351566EXPECT 
    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 
     571sub test_no_header_no_footer_empty_separator_with_results { 
     572    my $this = shift; 
     573    $this->_septic( 0, 0, "", 1, <<'EXPECT'); 
    357574OkATopicOkBTopicOkTopic 
    358575EXPECT 
    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 
     580sub test_no_header_no_footer_empty_separator_no_results { 
     581    my $this = shift; 
     582    $this->_septic( 0, 0, "", 0, <<'EXPECT'); 
    364583EXPECT 
    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 
     588sub test_no_header_no_footer_with_separator_with_results { 
     589    my $this = shift; 
     590    $this->_septic( 0, 0, ",", 1, <<'EXPECT'); 
    370591OkATopic,OkBTopic,OkTopic 
    371592EXPECT 
    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 
     597sub test_no_header_no_footer_with_nl_separator_with_results { 
     598    my $this = shift; 
     599    $this->_septic( 0, 0, '$n', 1, <<'EXPECT'); 
    377600OkATopic 
    378601OkBTopic 
    379602OkTopic 
    380603EXPECT 
    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 
     608sub test_no_header_no_footer_with_separator_no_results { 
     609    my $this = shift; 
     610    $this->_septic( 0, 0, ",", 0, <<'EXPECT'); 
    386611EXPECT 
     612 
     613    return; 
    387614} 
    388615##################### 
    389616 
    390 sub verify_no_header_with_footer_no_separator_with_results { 
    391     my $this = shift; 
    392     $this->_septic( 0, 1, undef, 1, <<EXPECT); 
     617sub test_no_header_with_footer_no_separator_with_results { 
     618    my $this = shift; 
     619    $this->_septic( 0, 1, undef, 1, <<'EXPECT'); 
    393620OkATopic 
    394621OkBTopic 
     
    396623FOOT 
    397624EXPECT 
    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 
     629sub test_no_header_with_footer_no_separator_no_results { 
     630    my $this = shift; 
     631    $this->_septic( 0, 1, undef, 0, <<'EXPECT'); 
    403632EXPECT 
    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 
     637sub test_no_header_with_footer_empty_separator_with_results { 
     638    my $this = shift; 
     639    $this->_septic( 0, 1, "", 1, <<'EXPECT'); 
    409640OkATopicOkBTopicOkTopicFOOT 
    410641EXPECT 
    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 
     646sub test_no_header_with_footer_empty_separator_no_results { 
     647    my $this = shift; 
     648    $this->_septic( 0, 1, "", 0, <<'EXPECT'); 
    416649EXPECT 
    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 
     654sub test_no_header_with_footer_with_separator_with_results { 
     655    my $this = shift; 
     656    $this->_septic( 0, 1, ",", 1, <<'EXPECT'); 
    422657OkATopic,OkBTopic,OkTopicFOOT 
    423658EXPECT 
     659 
     660    return; 
    424661} 
    425662 
    426663##################### 
    427664 
    428 sub verify_with_header_with_footer_no_separator_with_results { 
    429     my $this = shift; 
    430     $this->_septic( 1, 1, undef, 1, <<EXPECT); 
     665sub test_with_header_with_footer_no_separator_with_results { 
     666    my $this = shift; 
     667    $this->_septic( 1, 1, undef, 1, <<'EXPECT'); 
    431668HEAD 
    432669OkATopic 
     
    435672FOOT 
    436673EXPECT 
    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 
     678sub test_with_header_with_footer_no_separator_no_results { 
     679    my $this = shift; 
     680    $this->_septic( 1, 1, undef, 0, <<'EXPECT'); 
    442681EXPECT 
    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 
     686sub test_with_header_with_footer_empty_separator_with_results { 
     687    my $this = shift; 
     688    $this->_septic( 1, 1, "", 1, <<'EXPECT'); 
    448689HEADOkATopicOkBTopicOkTopicFOOT 
    449690EXPECT 
    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 
     695sub test_with_header_with_footer_empty_separator_no_results { 
     696    my $this = shift; 
     697    $this->_septic( 1, 1, "", 0, <<'EXPECT'); 
    455698EXPECT 
    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 
     703sub test_with_header_with_footer_with_separator_with_results { 
     704    my $this = shift; 
     705    $this->_septic( 1, 1, ",", 1, <<'EXPECT'); 
    461706HEADOkATopic,OkBTopic,OkTopicFOOT 
    462707EXPECT 
    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 
     712sub test_with_header_with_footer_with_separator_no_results { 
     713    my $this = shift; 
     714    $this->_septic( 1, 1, ",", 0, <<'EXPECT'); 
    468715EXPECT 
     716 
     717    return; 
    469718} 
    470719 
    471720##################### 
    472721 
    473 sub verify_with_header_no_footer_no_separator_with_results { 
    474     my $this = shift; 
    475     $this->_septic( 1, 0, undef, 1, <<EXPECT); 
     722sub test_with_header_no_footer_no_separator_with_results { 
     723    my $this = shift; 
     724    $this->_septic( 1, 0, undef, 1, <<'EXPECT'); 
    476725HEAD 
    477726OkATopic 
     
    479728OkTopic 
    480729EXPECT 
    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 
     734sub test_with_header_no_footer_no_separator_no_results { 
     735    my $this = shift; 
     736    $this->_septic( 1, 0, undef, 0, <<'EXPECT'); 
    486737EXPECT 
    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 
     742sub test_with_header_no_footer_empty_separator_with_results { 
     743    my $this = shift; 
     744    $this->_septic( 1, 0, "", 1, <<'EXPECT'); 
    492745HEADOkATopicOkBTopicOkTopic 
    493746EXPECT 
    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 
     751sub test_with_header_no_footer_empty_separator_no_results { 
     752    my $this = shift; 
     753    $this->_septic( 1, 0, "", 0, <<'EXPECT'); 
    499754EXPECT 
    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 
     759sub test_with_header_no_footer_with_separator_with_results { 
     760    my $this = shift; 
     761    $this->_septic( 1, 0, ",", 1, <<'EXPECT'); 
    505762HEADOkATopic,OkBTopic,OkTopic 
    506763EXPECT 
    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 
     768sub test_with_header_no_footer_with_separator_no_results { 
     769    my $this = shift; 
     770    $this->_septic( 1, 0, ",", 0, <<'EXPECT'); 
    512771EXPECT 
    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 
     776sub test_no_header_no_footer_with_nl_separator { 
     777    my $this = shift; 
     778    $this->_septic( 0, 0, '$n', 1, <<'EXPECT'); 
    518779OkATopic 
    519780OkBTopic 
    520781OkTopic 
    521782EXPECT 
    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; 
    593785} 
    594786 
     
    604796    $this->assert_matches( qr/OkBTopic/, $result ); 
    605797    $this->assert_matches( qr/OkATopic/, $result ); 
     798 
     799    return; 
    606800} 
    607801 
     
    619813    $this->assert_matches( qr/OkBTopic/, $result ); 
    620814    $this->assert_matches( qr/OkATopic/, $result ); 
     815 
     816    return; 
    621817} 
    622818 
     
    634830    $this->assert_matches( qr/OkBTopic/, $result ); 
    635831    $this->assert_matches( qr/OkATopic/, $result ); 
     832 
     833    return; 
    636834} 
    637835 
     
    649847    $this->assert_does_not_match( qr/OkBTopic/, $result ); 
    650848    $this->assert_does_not_match( qr/OkATopic/, $result ); 
     849 
     850    return; 
    651851} 
    652852 
     
    666866    $this->assert_matches( qr/OkBTopic/, $result ); 
    667867    $this->assert_matches( qr/OkATopic/, $result ); 
     868 
     869    return; 
    668870} 
    669871 
     
    681883    $this->assert_matches( qr/OkBTopic/, $result ); 
    682884    $this->assert_matches( qr/OkATopic/, $result ); 
     885 
     886    return; 
    683887} 
    684888 
     
    697901    $this->assert_matches( qr/OkATopic/, $result ); 
    698902 
     903    return; 
    699904} 
    700905 
     
    713918    $this->assert_does_not_match( qr/OkATopic/, $result ); 
    714919 
     920    return; 
    715921} 
    716922 
     
    730936    $this->assert_does_not_match( qr/OkBTopic/, $result ); 
    731937    $this->assert_does_not_match( qr/OkATopic/, $result ); 
     938 
     939    return; 
    732940} 
    733941 
     
    746954    $this->assert_does_not_match( qr/OkATopic/, $result ); 
    747955 
     956    return; 
    748957} 
    749958 
     
    762971    $this->assert_does_not_match( qr/OkATopic/, $result ); 
    763972 
     973    return; 
    764974} 
    765975 
     
    778988    $this->assert_does_not_match( qr/OkATopic/, $result ); 
    779989 
     990    return; 
    780991} 
    781992 
     
    7961007    $this->assert_does_not_match( qr/OkATopic/, $result ); 
    7971008 
     1009    return; 
    7981010} 
    7991011 
     
    8121024    $this->assert_does_not_match( qr/OkATopic/, $result ); 
    8131025 
     1026    return; 
    8141027} 
    8151028 
     
    8281041    $this->assert_does_not_match( qr/OkATopic/, $result ); 
    8291042 
     1043    return; 
    8301044} 
    8311045 
     
    8441058    $this->assert_does_not_match( qr/OkATopic/, $result ); 
    8451059 
     1060    return; 
    8461061} 
    8471062 
     
    8621077    $this->assert_does_not_match( qr/OkBTopic/, $result ); 
    8631078 
     1079    return; 
    8641080} 
    8651081 
     
    8781094    $this->assert_does_not_match( qr/OkBTopic/, $result ); 
    8791095 
     1096    return; 
    8801097} 
    8811098 
     
    8941111    $this->assert_matches( qr/OkATopic/, $result ); 
    8951112 
     1113    return; 
    8961114} 
    8971115 
     
    9071125    $this->assert_does_not_match( qr/OkATopic/, $result ); 
    9081126    $this->assert_matches( qr/OkBTopic/, $result ); 
     1127 
     1128    return; 
    9091129} 
    9101130 
     
    9221142HERE 
    9231143    $this->assert_str_equals( "$wn $this->{users_web}.$wn\n", $result ); 
     1144 
     1145    return; 
    9241146} 
    9251147 
     
    9311153        '%SEARCH{"" type="regex" scope="text" nonoise="on" format="$topic"}%'); 
    9321154    $this->assert_str_equals( "", $result ); 
     1155 
     1156    return; 
    9331157} 
    9341158 
     
    9411165      ); 
    9421166    $this->assert_str_equals( "", $result ); 
     1167 
     1168    return; 
    9431169} 
    9441170 
     
    9511177      ); 
    9521178    $this->assert_str_equals( "", $result ); 
     1179 
     1180    return; 
    9531181} 
    9541182 
     
    9601188        '%SEARCH{"" type="word" scope="text" nonoise="on" format="$topic"}%'); 
    9611189    $this->assert_str_equals( "", $result ); 
     1190 
     1191    return; 
    9621192} 
    9631193 
     
    9701200      ); 
    9711201    $this->assert_str_equals( "", $result ); 
     1202 
     1203    return; 
    9721204} 
    9731205 
     
    9801212      ); 
    9811213    $this->assert_str_equals( "", $result ); 
     1214 
     1215    return; 
    9821216} 
    9831217 
     
    9901224      ); 
    9911225    $this->assert_str_equals( "", $result ); 
     1226 
     1227    return; 
    9921228} 
    9931229 
     
    10001236      ); 
    10011237    $this->assert_str_equals( "", $result ); 
     1238 
     1239    return; 
    10021240} 
    10031241 
     
    10211259HERE 
    10221260 
    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); 
    10261264    $topicObject->save(); 
    1027 } 
    1028  
    1029 sub verify_formatted_search_summary_with_exclamation_marks { 
     1265    $topicObject->finish(); 
     1266 
     1267    return; 
     1268} 
     1269 
     1270sub 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 
     1285sub 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 
     1303sub 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 
     1316sub 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 
     1346sub test_formatted_search_summary_with_exclamation_marks { 
    10301347    my $this    = shift; 
    10311348    my $session = $this->{session}; 
     
    10501367    $expected = '<nop>AnnaAnchor'; 
    10511368    $this->assert_str_equals( $expected, $actual ); 
     1369 
     1370    return; 
    10521371} 
    10531372 
    10541373# Item8718 
    1055 sub verify_formatted_search_with_exclamation_marks_inside_bracket_link { 
     1374sub test_formatted_search_with_exclamation_marks_inside_bracket_link { 
    10561375    my $this    = shift; 
    10571376    my $session = $this->{session}; 
     
    10691388 
    10701389    $this->assert_str_equals( $expected, $actual ); 
     1390 
     1391    return; 
    10711392} 
    10721393 
     
    10851406        $result 
    10861407    ); 
     1408 
     1409    return; 
    10871410} 
    10881411 
     
    10991422    $this->assert_str_equals( "FormattedSearchTopic1 \$email \$html \$time", 
    11001423        $result ); 
    1101 } 
    1102  
    1103 sub verify_METASEARCH { 
     1424 
     1425    return; 
     1426} 
     1427 
     1428sub test_METASEARCH { 
    11041429    my $this    = shift; 
    11051430    my $session = $this->{session}; 
     
    11241449      $this->{test_topicObject}->renderTML('Children: FormattedSearchTopic1 '); 
    11251450    $this->assert_str_equals( $expected, $actual ); 
     1451 
     1452    return; 
    11261453} 
    11271454 
     
    11421469%META:FILEATTACHMENT{name="README" comment="Blah Blah" date="1157965062" size="5504"}% 
    11431470HERE 
    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); 
    11471474    $topicObject->save(); 
     1475    $topicObject->finish(); 
    11481476 
    11491477    $text = <<'HERE'; 
     
    11601488%META:FIELD{name="form" attributes="" title="Blah" value="form good"}% 
    11611489%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"}% 
    11631491%META:FILEATTACHMENT{name="porn.gif" comment="Cor" date="15062" size="15504"}% 
    11641492%META:FILEATTACHMENT{name="flib.xml" comment="Cor" date="1157965062" size="1"}% 
    11651493HERE 
    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); 
    11691497    $topicObject->save(); 
    1170  
    1171     $this->{session}->finish(); 
    1172     my $query = new Unit::Request(""); 
     1498    $topicObject->finish(); 
     1499 
     1500    my $query = Unit::Request->new(''); 
    11731501    $query->path_info("/$this->{test_web}/$this->{test_topic}"); 
    11741502 
    1175     $this->{session} = new Foswiki( undef, $query ); 
     1503    $this->createNewFoswikiSession( undef, $query ); 
    11761504    $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; 
    11821507} 
    11831508 
     
    11951520      ->expandMacros( '%SEARCH{"parent.name=\'WebHome\'"' . $stdCrap ); 
    11961521    $this->assert_str_equals( 'QueryTopic', $result ); 
     1522 
     1523    return; 
    11971524} 
    11981525 
     
    12061533      ->expandMacros( '%SEARCH{"attachments[size > 0]"' . $stdCrap ); 
    12071534    $this->assert_str_equals( 'QueryTopic QueryTopicTwo', $result ); 
     1535 
     1536    return; 
    12081537} 
    12091538 
     
    12171546        '%SEARCH{"META:FILEATTACHMENT[size > 10000]"' . $stdCrap ); 
    12181547    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
     1548 
     1549    return; 
    12191550} 
    12201551 
     
    12281559      ->expandMacros( '%SEARCH{"attachments[name=\'flib.xml\']"' . $stdCrap ); 
    12291560    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
     1561 
     1562    return; 
    12301563} 
    12311564 
     
    12391572      ->expandMacros( '%SEARCH{"Lastname=\'Peel\'"' . $stdCrap ); 
    12401573    $this->assert_str_equals( 'QueryTopic QueryTopicTwo', $result ); 
     1574 
     1575    return; 
    12411576} 
    12421577 
     
    12501585        '%SEARCH{"text ~ \'*SMONG*\' AND Lastname=\'Peel\'"' . $stdCrap ); 
    12511586    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
     1587 
     1588    return; 
    12521589} 
    12531590 
     
    12611598        '%SEARCH{"text ~ \'*FURTLE*\' AND Lastname=\'Peel\'"' . $stdCrap ); 
    12621599    $this->assert_str_equals( 'QueryTopic', $result ); 
     1600 
     1601    return; 
    12631602} 
    12641603 
     
    12721611      ->expandMacros( '%SEARCH{"Lastname=\'Peel\'"' . $stdCrap ); 
    12731612    $this->assert_str_equals( 'QueryTopic QueryTopicTwo', $result ); 
     1613 
     1614    return; 
    12741615} 
    12751616 
     
    12831624      ->expandMacros( '%SEARCH{"form.name=\'TestyForm\'"' . $stdCrap ); 
    12841625    $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' 
    12871631sub verify_formQuery2 { 
    12881632    my $this = shift; 
     
    12931637      $this->{test_topicObject} 
    12941638      ->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; 
    12961645} 
    12971646 
     
    13051654        '%SEARCH{"TestForm[name=\'Field1\'].value=\'A Field\'"' . $stdCrap ); 
    13061655    $this->assert_str_equals( 'QueryTopic', $result ); 
     1656 
     1657    return; 
    13071658} 
    13081659 
     
    13281679      ->expandMacros( '%SEARCH{"TestForm.Field1=\'A Field\'"' . $stdCrap ); 
    13291680    $this->assert_str_equals( 'QueryTopic', $result ); 
     1681 
     1682    return; 
    13301683} 
    13311684 
     
    13551708      ->expandMacros( '%SEARCH{"TestyForm.FORM=\'FORM GOOD\'"' . $stdCrap ); 
    13561709    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
     1710 
     1711    return; 
    13571712} 
    13581713 
     
    13671722          . $stdCrap ); 
    13681723    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
     1724 
     1725    return; 
    13691726} 
    13701727 
     
    14121769 
    14131770    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, 
    14161773        $result ); 
     1774 
     1775    return; 
    14171776} 
    14181777 
     
    14341793        my $vD = ( $n == 1 )   ? 'A' : 'B'; 
    14351794        my $vE = ( $n == 2 )   ? 'A' : 'B'; 
    1436         my $text = <<HERE; 
     1795        my $text = <<"HERE"; 
    14371796%META:TOPICINFO{author="TopicUserMapping_guest" date="12" format="1.1" version="1.2"}% 
    14381797---+ Progressive Sexuality 
     
    14611820%META:FIELD{name="FieldE" attributes="" title="Banother Field" value="$vE"}% 
    14621821HERE 
    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); 
    14661825        $topicObject->save(); 
     1826        $topicObject->finish(); 
    14671827    } 
    14681828    require Benchmark; 
    14691829 
    14701830    # Search using a regular expression 
    1471     my $start = new Benchmark; 
     1831    my $start = Benchmark->new(); 
    14721832 
    14731833    my $result = 
     
    14751835'%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=" "}%' 
    14761836      ); 
    1477     my $retime = Benchmark::timediff( new Benchmark, $start ); 
     1837    my $retime = Benchmark::timediff( Benchmark->new(), $start ); 
    14781838    $this->assert_str_equals( 'QueryTopic1 QueryTopic2', $result ); 
    14791839 
    14801840    # Repeat using a query 
    1481     $start = new Benchmark; 
     1841    $start = Benchmark->new; 
    14821842    $result = 
    14831843      $this->{test_topicObject}->expandMacros( 
     
    14881848    print STDERR "Query " . Benchmark::timestr($querytime), 
    14891849      "\nRE " . Benchmark::timestr($retime), "\n"; 
    1490 } 
    1491  
    1492 sub verify_4347 { 
     1850 
     1851    return; 
     1852} 
     1853 
     1854sub test_4347 { 
    14931855    my $this = shift; 
    14941856 
     
    14981860      ); 
    14991861    $this->assert_str_equals( '', $result ); 
     1862 
     1863    return; 
    15001864} 
    15011865 
     
    15151879    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
    15161880 
    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' ); 
    15201883    $result = 
    15211884      $topicObject->expandMacros( '%SEARCH{"text ~ \'*SMONG*\'" ' . $stdCrap ); 
    15221885    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
    15231886 
    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' ); 
    15271890    $result = $topicObject->expandMacros( 
    15281891        '%SEARCH{"text ~ \'*QueryTopicTwo*\'" ' . $stdCrap ); 
    15291892    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
    1530  
     1893    $topicObject->finish(); 
     1894 
     1895    return; 
    15311896} 
    15321897 
     
    16121977    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
    16131978 
    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' ); 
    16171981    $result = 
    16181982      $topicObject->expandMacros( '%SEARCH{"text ~ \'*SMONG*\'" web="' 
     
    16211985    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
    16221986 
    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' ); 
    16261990    $result = 
    16271991      $topicObject->expandMacros( '%SEARCH{"text ~ \'*QueryTopicTwo*\'" web="' 
     
    16301994    $this->assert_str_equals( 'QueryTopicTwo', $result ); 
    16311995 
    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' ); 
    16351999    $result = 
    16362000      $topicObject->expandMacros( '%SEARCH{"text ~ \'*Notinthetopics*\'" web="' 
     
    16382002          . $stdCrap ); 
    16392003    $this->assert_str_equals( '', $result ); 
     2004    $topicObject->finish(); 
    16402005 
    16412006    $result = 
     
    16452010          . $stdCrap ); 
    16462011    $this->assert_str_equals( 'QueryTopic', $result ); 
    1647 } 
    1648  
    1649 sub verify_pattern { 
     2012 
     2013    return; 
     2014} 
     2015 
     2016sub test_pattern { 
    16502017    my $this = shift; 
    16512018 
     
    16572024    $this->assert_matches( qr/Xdont.matchmeY/,  $result ); 
    16582025    $this->assert_matches( qr/XY/,              $result ); 
    1659 } 
    1660  
    1661 sub verify_badpattern { 
     2026 
     2027    return; 
     2028} 
     2029 
     2030sub test_badpattern { 
    16622031    my $this = shift; 
    16632032 
     
    16772046    # and format should be XY for all 3 topics 
    16782047    $this->assert_equals( 3, $result =~ s/^XY$//gm ); 
    1679 } 
    1680  
    1681 sub verify_validatepattern { 
     2048 
     2049    return; 
     2050} 
     2051 
     2052sub test_validatepattern { 
    16822053    my $this = shift; 
    16832054    my ( $pattern, $temp ); 
     
    17132084    $this->assert_matches( qr/$pattern/, 'foobluebar' ); 
    17142085 
     2086    return; 
    17152087} 
    17162088 
    17172089#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 
     2090sub test_formatOfLinks { 
     2091    my $this = shift; 
     2092 
     2093    my ($topicObject) = 
     2094      Foswiki::Func::readTopic( $this->{test_web}, 'Item977' ); 
     2095    $topicObject->text(<<'HERE'); 
     2096---+ Apache 
    17242097 
    17252098Apache is the [[http://www.apache.org/httpd/][well known web server]]. 
    1726 " 
    1727     ); 
     2099HERE 
    17282100    $topicObject->save(); 
     2101    $topicObject->finish(); 
    17292102 
    17302103    my $result = 
     
    17652138          ->TML2PlainText('Apache is the well known web server.') ); 
    17662139 
     2140    return; 
    17672141} 
    17682142 
    17692143sub _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 ); 
    17732148 
    17742149    #    my $options = { 
     
    17792154    #    }; 
    17802155 
     2156    $this->assert_str_equals( 'ARRAY', ref($expected) ); 
    17812157    my $webObject = Foswiki::Meta->new( $this->{session}, $web ); 
    17822158 
     
    17862162      Foswiki::Search::InfoCache::getTopicListIterator( $webObject, $options ); 
    17872163 
    1788     ASSERT( UNIVERSAL::isa( $iter, 'Foswiki::Iterator' ) ) if DEBUG; 
     2164    ASSERT( $iter->isa('Foswiki::Iterator') ) if DEBUG; 
    17892165    my @topicList = (); 
    17902166    while ( my $t = $iter->next() ) { 
     2167        next if ( $t eq 'InvisibleTopic' );    #and user != admin or... 
    17912168        push( @topicList, $t ); 
    17922169    } 
    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" ); 
    17942175    return \@topicList; 
    17952176} 
     
    17992180 
    18002181    #no topics specified.. 
    1801     $this->assert_deep_equals( 
     2182    $this->_getTopicList( 
     2183        $this->{test_web}, 
     2184        {}, 
     2185        'no filters, all topics in test_web', 
    18022186        [ 
    18032187            'OkATopic', 'OkBTopic', 
     
    18052189            'WebPreferences' 
    18062190        ], 
    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', 
    18112196        [ 
    18122197            'WebAtom',           'WebChanges', 
     
    18172202            'WebSearchAdvanced', 'WebTopicList' 
    18182203        ], 
    1819         $this->_getTopicList( '_default', {} ), 
    1820         'no filters, all topics in _default web' 
    18212204    ); 
    18222205 
    18232206    #use wildcards 
    1824     $this->assert_deep_equals( 
     2207    $this->_getTopicList( 
     2208        $this->{test_web}, 
     2209        { includeTopics => 'Ok*' }, 
     2210        'comma separated list', 
    18252211        [ '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', 
    18302217        [ 
    18312218            'WebAtom',           'WebChanges', 
     
    18362223            'WebSearchAdvanced', 'WebTopicList' 
    18372224        ], 
    1838         $this->_getTopicList( '_default', { includeTopics => 'Web*' } ), 
    1839         '_default web, Wildcard includeTopics Web*' 
    18402225    ); 
    18412226 
    18422227    #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' ], 
    18582241    ); 
    18592242 
    18602243    #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', 
    18622248        [ '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', 
    18692254        [ 
    18702255            'WebAtom',           'WebChanges', 
     
    18752260            'WebTopicList' 
    18762261        ], 
    1877         $this->_getTopicList( '_default', { excludeTopics => 'WebSearch' } ), 
    1878         '_default web, exclude WebSearch' 
    18792262    ); 
    18802263 
    18812264    #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', 
    18832269        [ 
    18842270            'OkATopic', 'OkBTopic', 
     
    18862272            'WebPreferences' 
    18872273        ], 
    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', 
    18922279        [ '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', 
    18972288        [], 
    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', 
    19082297        [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    1909         $this->_getTopicList( 
    1910             $this->{test_web}, 
    1911             { 
    1912                 includeTopics => 'ok*', 
    1913                 casesensitive => 0 
    1914             } 
    1915         ), 
    1916         'case insensitive ok* topics, using wildcard' 
    19172298    ); 
    19182299 
     
    19232304 
    19242305        # 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 => 1 
    1932                 } 
    1933             ), 
    1934             'case sensitive okatopic topic 1' 
    1935         ); 
    1936     } 
    1937  
    1938     $this->assert_deep_equals( 
    1939         ['OkATopic'], 
    19402306        $this->_getTopicList( 
    19412307            $this->{test_web}, 
    19422308            { 
    19432309                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'], 
    19482325    ); 
    19492326    ##### 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', 
    19512334        [ 
    19522335            'OkATopic', 'OkBTopic', 
     
    19542337            'WebPreferences' 
    19552338        ], 
    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', 
    19662347        [ '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', 
    19772357        [], 
    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', 
    19892367        [ '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', 
    20022378        [ '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', 
    20152389        [ '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', 
    20282400        [ '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; 
    20402404} 
    20412405 
     
    21112475    $this->assert_str_equals( $expected, $actual ); 
    21122476 
     2477    return; 
    21132478} 
    21142479 
     
    21162481    my $this = shift; 
    21172482 
    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'); 
    21212486| *Name*         | *Type* | *Size* | *Value*   | *Tooltip message* | *Attributes* | 
    21222487| Why | text | 32 | | Mandatory field | M | 
     
    21242489FORM 
    21252490    $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'); 
    21292495%META:FORM{name="TestForm"}% 
    21302496%META:FIELD{name="Ecks" attributes="" title="X" value="Blah"}% 
     
    21372503    my $expected = 'SplodgeOne;Blah'; 
    21382504    $this->assert_str_equals( $expected, $actual ); 
    2139  
     2505    $topicObject->finish(); 
     2506 
     2507    return; 
    21402508} 
    21412509 
     
    21432511    my $this = shift; 
    21442512 
    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'); 
    21482516| *Name*         | *Type* | *Size* | *Value*   | *Tooltip message* | *Attributes* | 
    21492517| Why | text | 32 | | Mandatory field | M | 
     
    21512519FORM 
    21522520    $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'); 
    21562525%META:FORM{name="TestForm"}% 
    21572526%META:FIELD{name="Ecks" attributes="" title="X" value="Blah"}% 
     
    21642533    my $expected = 'SplodgeOne;Blah'; 
    21652534    $this->assert_str_equals( $expected, $actual ); 
    2166  
     2535    $topicObject->finish(); 
     2536 
     2537    return; 
    21672538} 
    21682539 
     
    21882559HERE 
    21892560    $this->assert_str_equals( $expected, $actual ); 
     2561 
     2562    return; 
    21902563} 
    21912564 
     
    21952568#need summary, and multiple 
    21962569sub _multiWebSeptic { 
    2197     my ( $this, $head, $foot, $sep, $results, $expected, $format ) = @_; 
     2570    my ( $this, $head, $foot, $sep, $results, $format, $default, %expectations ) 
     2571      = @_; 
    21982572    my $str = $results ? '*Preferences' : 'Septic'; 
    21992573    $head = $head        ? 'header="HEAD($web)"'            : ''; 
     
    22012575    $sep  = defined $sep ? "separator=\"$sep\""             : ''; 
    22022576    $format = '$topic' unless ( defined($format) ); 
     2577    my $expected = $this->_expect_with_deps( $default, %expectations ); 
    22032578 
    22042579    my $result = $this->{test_topicObject}->expandMacros( 
     
    22142589    $expected =~ s/\n$//s; 
    22152590    $this->assert_str_equals( $expected, $result ); 
     2591 
     2592    return; 
    22162593} 
    22172594 
    22182595##################### 
    22192596 
    2220 sub verify_multiWeb_no_header_no_footer_no_separator_with_results { 
    2221     my $this = shift; 
    2222     $this->_multiWebSeptic( 0, 0, undef, 1, <<EXPECT); 
     2597sub test_multiWeb_no_header_no_footer_no_separator_with_results { 
     2598    my $this = shift; 
     2599    $this->_multiWebSeptic( 
     2600        0, 0, undef, 1, undef, <<'FOSWIKI12', 
     2601SitePreferences 
     2602WebPreferences 
     2603DefaultPreferences 
     2604WebPreferences 
     2605FOSWIKI12 
     2606        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    22232607DefaultPreferences 
    22242608WebPreferences 
    22252609SitePreferences 
    22262610WebPreferences 
    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' ); 
     2611FOSWIKI11 
     2612 
     2613    return; 
     2614} 
     2615 
     2616sub 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', 
     26211, 1, 1, SitePreferences 
     26222, 2, 2, WebPreferences 
     26231, 1, 3, DefaultPreferences 
     26242, 2, 4, WebPreferences 
     2625FOSWIKI12 
     2626        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    223426271, 1, 1, DefaultPreferences 
    223526282, 2, 2, WebPreferences 
    223626291, 1, 3, SitePreferences 
    223726302, 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); 
     2631FOSWIKI11 
     2632 
     2633    return; 
     2634} 
     2635 
     2636sub test_multiWeb_no_header_no_footer_no_separator_no_results { 
     2637    my $this = shift; 
     2638    $this->_multiWebSeptic( 0, 0, undef, 0, undef, <<'FOSWIKI12'); 
     2639FOSWIKI12 
     2640 
     2641    return; 
     2642} 
     2643 
     2644sub test_multiWeb_no_header_no_footer_empty_separator_with_results { 
     2645    my $this = shift; 
     2646    $this->_multiWebSeptic( 
     2647        0, 0, "", 1, undef, <<'FOSWIKI12', 
     2648SitePreferencesWebPreferencesDefaultPreferencesWebPreferences 
     2649FOSWIKI12 
     2650        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    22502651DefaultPreferencesWebPreferencesSitePreferencesWebPreferences 
    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); 
     2652FOSWIKI11 
     2653 
     2654    return; 
     2655} 
     2656 
     2657sub test_multiWeb_no_header_no_footer_empty_separator_no_results { 
     2658    my $this = shift; 
     2659    $this->_multiWebSeptic( 0, 0, "", 0, undef, <<'FOSWIKI12'); 
     2660FOSWIKI12 
     2661 
     2662    return; 
     2663} 
     2664 
     2665sub test_multiWeb_no_header_no_footer_with_separator_with_results { 
     2666    my $this = shift; 
     2667    $this->_multiWebSeptic( 
     2668        0, 0, ",", 1, undef, <<'FOSWIKI12', 
     2669SitePreferences,WebPreferences,DefaultPreferences,WebPreferences 
     2670FOSWIKI12 
     2671        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    22632672DefaultPreferences,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 
     2673FOSWIKI11 
     2674 
     2675    return; 
     2676} 
     2677 
     2678sub test_multiWeb_no_header_no_footer_with_separator_no_results { 
     2679    my $this = shift; 
     2680    $this->_multiWebSeptic( 0, 0, ",", 0, undef, <<'FOSWIKI12'); 
     2681FOSWIKI12 
     2682 
     2683    return; 
    22712684} 
    22722685##################### 
    22732686 
    2274 sub verify_multiWeb_no_header_with_footer_no_separator_with_results { 
    2275     my $this = shift; 
    2276     $this->_multiWebSeptic( 0, 1, undef, 1, <<EXPECT); 
     2687sub test_multiWeb_no_header_with_footer_no_separator_with_results { 
     2688    my $this = shift; 
     2689    $this->_multiWebSeptic( 
     2690        0, 1, undef, 1, undef, <<'FOSWIKI12', 
     2691SitePreferences 
     2692WebPreferences 
     2693FOOT(2,2)DefaultPreferences 
     2694WebPreferences 
     2695FOOT(2,2) 
     2696FOSWIKI12 
     2697        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    22772698DefaultPreferences 
    22782699WebPreferences 
     
    22802701WebPreferences 
    22812702FOOT(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); 
     2703FOSWIKI11 
     2704 
     2705    return; 
     2706} 
     2707 
     2708sub test_multiWeb_no_header_with_footer_no_separator_no_results { 
     2709    my $this = shift; 
     2710    $this->_multiWebSeptic( 0, 1, undef, 0, undef, <<'FOSWIKI12'); 
     2711FOSWIKI12 
     2712 
     2713    return; 
     2714} 
     2715 
     2716sub test_multiWeb_no_header_with_footer_empty_separator_with_results { 
     2717    my $this = shift; 
     2718    $this->_multiWebSeptic( 
     2719        0, 1, "", 1, undef, <<'FOSWIKI12', 
     2720SitePreferencesWebPreferencesFOOT(2,2)DefaultPreferencesWebPreferencesFOOT(2,2) 
     2721FOSWIKI12 
     2722        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    22942723DefaultPreferencesWebPreferencesFOOT(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); 
     2724FOSWIKI11 
     2725 
     2726    return; 
     2727} 
     2728 
     2729sub test_multiWeb_no_header_with_footer_empty_separator_no_results { 
     2730    my $this = shift; 
     2731    $this->_multiWebSeptic( 0, 1, "", 0, undef, <<'FOSWIKI12'); 
     2732FOSWIKI12 
     2733 
     2734    return; 
     2735} 
     2736 
     2737sub test_multiWeb_no_header_with_footer_with_separator_with_results { 
     2738    my $this = shift; 
     2739    $this->_multiWebSeptic( 
     2740        0, 1, ",", 1, undef, <<'FOSWIKI12', 
     2741SitePreferences,WebPreferencesFOOT(2,2)DefaultPreferences,WebPreferencesFOOT(2,2) 
     2742FOSWIKI12 
     2743        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    23072744DefaultPreferences,WebPreferencesFOOT(2,2)SitePreferences,WebPreferencesFOOT(2,2) 
    2308 EXPECT 
     2745FOSWIKI11 
     2746 
     2747    return; 
    23092748} 
    23102749 
    23112750##################### 
    23122751 
    2313 sub verify_multiWeb_with_header_with_footer_no_separator_with_results { 
    2314     my $this = shift; 
    2315     $this->_multiWebSeptic( 1, 1, undef, 1, <<EXPECT); 
     2752sub test_multiWeb_with_header_with_footer_no_separator_with_results { 
     2753    my $this = shift; 
     2754    $this->_multiWebSeptic( 
     2755        1, 1, undef, 1, undef, <<'FOSWIKI12', 
     2756HEAD(Main) 
     2757SitePreferences 
     2758WebPreferences 
     2759FOOT(2,2)HEAD(System) 
     2760DefaultPreferences 
     2761WebPreferences 
     2762FOOT(2,2) 
     2763FOSWIKI12 
     2764        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    23162765HEAD(System) 
    23172766DefaultPreferences 
     
    23212770WebPreferences 
    23222771FOOT(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); 
     2772FOSWIKI11 
     2773 
     2774    return; 
     2775} 
     2776 
     2777sub test_multiWeb_with_header_with_footer_no_separator_no_results { 
     2778    my $this = shift; 
     2779    $this->_multiWebSeptic( 1, 1, undef, 0, undef, <<'FOSWIKI12'); 
     2780FOSWIKI12 
     2781 
     2782    return; 
     2783} 
     2784 
     2785sub test_multiWeb_with_header_with_footer_empty_separator_with_results { 
     2786    my $this = shift; 
     2787    $this->_multiWebSeptic( 
     2788        1, 1, "", 1, undef, <<'FOSWIKI12', 
     2789HEAD(Main)SitePreferencesWebPreferencesFOOT(2,2)HEAD(System)DefaultPreferencesWebPreferencesFOOT(2,2) 
     2790FOSWIKI12 
     2791        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    23352792HEAD(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); 
     2793FOSWIKI11 
     2794 
     2795    return; 
     2796} 
     2797 
     2798sub test_multiWeb_with_header_with_footer_empty_separator_no_results { 
     2799    my $this = shift; 
     2800    $this->_multiWebSeptic( 1, 1, "", 0, undef, <<'FOSWIKI12'); 
     2801FOSWIKI12 
     2802 
     2803    return; 
     2804} 
     2805 
     2806sub test_multiWeb_with_header_with_footer_with_separator_with_results { 
     2807    my $this = shift; 
     2808    $this->_multiWebSeptic( 
     2809        1, 1, ",", 1, undef, <<'FOSWIKI12', 
     2810HEAD(Main)SitePreferences,WebPreferencesFOOT(2,2)HEAD(System)DefaultPreferences,WebPreferencesFOOT(2,2) 
     2811FOSWIKI12 
     2812        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    23482813HEAD(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 
     2814FOSWIKI11 
     2815 
     2816    return; 
     2817} 
     2818 
     2819sub test_multiWeb_with_header_with_footer_with_separator_no_results { 
     2820    my $this = shift; 
     2821    $this->_multiWebSeptic( 1, 1, ",", 0, undef, <<'FOSWIKI12'); 
     2822FOSWIKI12 
     2823 
     2824    return; 
    23562825} 
    23572826 
    23582827##################### 
    23592828 
    2360 sub verify_multiWeb_with_header_no_footer_no_separator_with_results { 
    2361     my $this = shift; 
    2362     $this->_multiWebSeptic( 1, 0, undef, 1, <<EXPECT); 
     2829sub test_multiWeb_with_header_no_footer_no_separator_with_results { 
     2830    my $this = shift; 
     2831    $this->_multiWebSeptic( 
     2832        1, 0, undef, 1, undef, <<'FOSWIKI12', 
     2833HEAD(Main) 
     2834SitePreferences 
     2835WebPreferences 
     2836HEAD(System) 
     2837DefaultPreferences 
     2838WebPreferences 
     2839FOSWIKI12 
     2840        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    23632841HEAD(System) 
    23642842DefaultPreferences 
     
    23672845SitePreferences 
    23682846WebPreferences 
    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); 
     2847FOSWIKI11 
     2848 
     2849    return; 
     2850} 
     2851 
     2852sub test_multiWeb_with_header_no_footer_no_separator_no_results { 
     2853    my $this = shift; 
     2854    $this->_multiWebSeptic( 1, 0, undef, 0, undef, <<'FOSWIKI12'); 
     2855FOSWIKI12 
     2856 
     2857    return; 
     2858} 
     2859 
     2860sub test_multiWeb_with_header_no_footer_empty_separator_with_results { 
     2861    my $this = shift; 
     2862    $this->_multiWebSeptic( 
     2863        1, 0, "", 1, undef, <<'FOSWIKI12', 
     2864HEAD(Main)SitePreferencesWebPreferencesHEAD(System)DefaultPreferencesWebPreferences 
     2865FOSWIKI12 
     2866        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    23812867HEAD(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); 
     2868FOSWIKI11 
     2869 
     2870    return; 
     2871} 
     2872 
     2873sub test_multiWeb_with_header_no_footer_empty_separator_no_results { 
     2874    my $this = shift; 
     2875    $this->_multiWebSeptic( 1, 0, "", 0, undef, <<'FOSWIKI12'); 
     2876FOSWIKI12 
     2877 
     2878    return; 
     2879} 
     2880 
     2881sub test_multiWeb_with_header_no_footer_with_separator_with_results { 
     2882    my $this = shift; 
     2883    $this->_multiWebSeptic( 
     2884        1, 0, ",", 1, undef, <<'FOSWIKI12', 
     2885HEAD(Main)SitePreferences,WebPreferencesHEAD(System)DefaultPreferences,WebPreferences 
     2886FOSWIKI12 
     2887        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    23942888HEAD(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 
     2889FOSWIKI11 
     2890 
     2891    return; 
     2892} 
     2893 
     2894sub test_multiWeb_with_header_no_footer_with_separator_no_results { 
     2895    my $this = shift; 
     2896    $this->_multiWebSeptic( 1, 0, ",", 0, undef, <<'FOSWIKI12'); 
     2897FOSWIKI12 
     2898 
     2899    return; 
    24022900} 
    24032901 
    24042902#Item1992: calling Foswiki::Search::_makeTopicPattern repeatedly made a big mess. 
    2405 sub verify_web_and_topic_expansion { 
     2903sub test_web_and_topic_expansion { 
    24062904    my $this   = shift; 
    24072905    my $result = $this->{test_topicObject}->expandMacros( 
     
    24172915        }%' 
    24182916    ); 
    2419     my $expected = <<EXPECT; 
     2917    my $expected = $this->_expect_with_deps( 
     2918        <<'FOSWIKI12', 
     2919Main.WebHome 
     2920Main.WebPreferences 
     2921FOOT(2,2)Sandbox.WebHome 
     2922Sandbox.WebPreferences 
     2923FOOT(2,2)System.WebHome 
     2924System.WebPreferences 
     2925FOOT(2,2) 
     2926FOSWIKI12 
     2927        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    24202928System.WebHome 
    24212929System.WebPreferences 
     
    24252933Sandbox.WebPreferences 
    24262934FOOT(2,2) 
    2427 EXPECT 
     2935FOSWIKI11 
    24282936    $expected =~ s/\n$//s; 
    24292937    $this->assert_str_equals( $expected, $result ); 
     2938 
     2939    return; 
    24302940} 
    24312941 
    24322942##################### 
    24332943# PAGING 
    2434 sub verify_paging_three_webs_first_five { 
    2435     my $this = shift; 
    2436  
     2944sub test_paging_three_webs_first_page { 
     2945    my $this   = shift; 
    24372946    my $result = $this->{test_topicObject}->expandMacros( 
    24382947        '%SEARCH{ 
     
    24502959    ); 
    24512960 
    2452     my $expected = <<EXPECT; 
     2961    my $expected = $this->_expect_with_deps( 
     2962        <<'FOSWIKI12', 
     2963Main.WebChanges 
     2964Main.WebHome 
     2965Main.WebIndex 
     2966Main.WebPreferences 
     2967FOOT(4,4)Sandbox.WebChanges 
     2968FOOT(1,1) 
     2969FOSWIKI12 
     2970        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    24532971System.WebChanges 
    24542972System.WebHome 
     
    24572975FOOT(4,4)Main.WebChanges 
    24582976FOOT(1,1) 
    2459 EXPECT 
     2977FOSWIKI11 
    24602978    $expected =~ s/\n$//s; 
    24612979    $this->assert_str_equals( $expected, $result ); 
    2462 } 
    2463  
    2464 sub verify_paging_three_webs_second_five { 
     2980 
     2981    return; 
     2982} 
     2983 
     2984sub test_paging_three_webs_second_page { 
    24652985    my $this = shift; 
    24662986 
     
    24803000    ); 
    24813001 
    2482     my $expected = <<EXPECT; 
     3002    my $expected = $this->_expect_with_deps( 
     3003        <<'FOSWIKI12', 
     3004Sandbox.WebHome 
     3005Sandbox.WebIndex 
     3006Sandbox.WebPreferences 
     3007FOOT(3,3)System.WebChanges 
     3008System.WebHome 
     3009FOOT(2,2) 
     3010FOSWIKI12 
     3011        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    24833012Main.WebHome 
    24843013Main.WebIndex 
     
    24873016Sandbox.WebHome 
    24883017FOOT(2,2) 
    2489 EXPECT 
     3018FOSWIKI11 
    24903019    $expected =~ s/\n$//s; 
    24913020    $this->assert_str_equals( $expected, $result ); 
    2492 } 
    2493  
    2494 sub verify_paging_three_webs_third_five { 
     3021 
     3022    return; 
     3023} 
     3024 
     3025sub test_paging_three_webs_third_page { 
    24953026    my $this = shift; 
    24963027 
     
    25103041    ); 
    25113042 
    2512     my $expected = <<EXPECT; 
     3043    my $expected = $this->_expect_with_deps( 
     3044        <<'FOSWIKI12', 
     3045System.WebIndex 
     3046System.WebPreferences 
     3047FOOT(2,2) 
     3048FOSWIKI12 
     3049        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    25133050Sandbox.WebIndex 
    25143051Sandbox.WebPreferences 
    25153052FOOT(2,2) 
    2516 EXPECT 
     3053FOSWIKI11 
    25173054    $expected =~ s/\n$//s; 
    25183055    $this->assert_str_equals( $expected, $result ); 
    2519 } 
    2520  
    2521 sub verify_paging_three_webs_fourth_five { 
     3056 
     3057    return; 
     3058} 
     3059 
     3060sub test_paging_three_webs_fourth_page { 
    25223061    my $this = shift; 
    25233062 
     
    25373076    ); 
    25383077 
    2539     my $expected = <<EXPECT; 
     3078    my $expected = <<'EXPECT'; 
    25403079EXPECT 
    25413080    $expected =~ s/\n$//s; 
    25423081    $this->assert_str_equals( $expected, $result ); 
    2543 } 
    2544  
    2545 sub verify_paging_three_webs_way_too_far { 
     3082 
     3083    return; 
     3084} 
     3085 
     3086sub test_paging_three_webs_way_too_far { 
    25463087    my $this = shift; 
    25473088 
     
    25613102    ); 
    25623103 
    2563     my $expected = <<EXPECT; 
     3104    my $expected = <<'EXPECT'; 
    25643105EXPECT 
    25653106    $expected =~ s/\n$//s; 
    25663107    $this->assert_str_equals( $expected, $result ); 
     3108 
     3109    return; 
    25673110} 
    25683111 
     
    25863129}%' 
    25873130    ); 
    2588  
    2589     my $expected = <<EXPECT; 
     3131    my $expected = $this->_expect_with_deps( 
     3132        <<'FOSWIKI12', 
     3133Main.WebPreferences 
     3134FOOT(1,1) 
     3135Sandbox.WebPreferences 
     3136FOOT(1,1) 
     3137System.WebPreferences 
     3138FOOT(1,1) 
     3139FOSWIKI12 
     3140        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    25903141System.WebPreferences 
    25913142FOOT(1,1) 
     
    25943145Sandbox.WebPreferences 
    25953146FOOT(1,1) 
    2596 EXPECT 
     3147FOSWIKI11 
     3148 
    25973149    $expected =~ s/\n$//s; 
    25983150    $this->assert_str_equals( $expected, $result ); 
     3151 
     3152    return; 
    25993153} 
    26003154 
    26013155#------------------------------------ 
    26023156# PAGING with limit= does weird things. 
    2603 sub verify_paging_with_limit_first_five { 
     3157sub test_paging_with_limit_first_page { 
    26043158    my $this = shift; 
    26053159 
     
    26203174    ); 
    26213175 
    2622     my $expected = <<EXPECT; 
     3176    my $expected = $this->_expect_with_deps( 
     3177        <<'FOSWIKI12', 
     3178Main.WebChanges 
     3179Main.WebHome 
     3180Main.WebIndex 
     3181FOOT(3,3) 
     3182FOSWIKI12 
     3183        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    26233184System.WebChanges 
    26243185System.WebHome 
    26253186System.WebIndex 
    26263187FOOT(3,3) 
    2627 EXPECT 
     3188FOSWIKI11 
    26283189    $expected =~ s/\n$//s; 
    26293190    $this->assert_str_equals( $expected, $result ); 
    2630 } 
    2631  
    2632 sub verify_paging_with_limit_second_five { 
     3191 
     3192    return; 
     3193} 
     3194 
     3195sub test_paging_with_limit_second_page { 
    26333196    my $this = shift; 
    26343197 
     
    26493212    ); 
    26503213 
    2651     my $expected = <<EXPECT; 
     3214    my $expected = $this->_expect_with_deps( 
     3215        <<'FOSWIKI12', 
     3216Sandbox.WebChanges 
     3217Sandbox.WebHome 
     3218Sandbox.WebIndex 
     3219FOOT(3,3) 
     3220FOSWIKI12 
     3221        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    26523222Main.WebChanges 
    26533223Main.WebHome 
    26543224Main.WebIndex 
    26553225FOOT(3,3) 
    2656 EXPECT 
     3226FOSWIKI11 
    26573227    $expected =~ s/\n$//s; 
    26583228    $this->assert_str_equals( $expected, $result ); 
    2659 } 
    2660  
    2661 sub verify_paging_with_limit_third_five { 
     3229 
     3230    return; 
     3231} 
     3232 
     3233sub test_paging_with_limit_third_page { 
    26623234    my $this = shift; 
    26633235 
     
    26783250    ); 
    26793251 
    2680     my $expected = <<EXPECT; 
     3252    my $expected = $this->_expect_with_deps( 
     3253        <<'FOSWIKI12', 
     3254System.WebChanges 
     3255System.WebHome 
     3256System.WebIndex 
     3257FOOT(3,3) 
     3258FOSWIKI12 
     3259        'Foswiki,<,1.2' => <<'FOSWIKI11'); 
    26813260Sandbox.WebChanges 
    26823261Sandbox.WebHome 
    26833262Sandbox.WebIndex 
    26843263FOOT(3,3) 
    2685 EXPECT 
     3264FOSWIKI11 
    26863265    $expected =~ s/\n$//s; 
    26873266    $this->assert_str_equals( $expected, $result ); 
    2688 } 
    2689  
    2690 sub verify_paging_with_limit_fourth_five { 
     3267 
     3268    return; 
     3269} 
     3270 
     3271sub test_paging_with_limit_fourth_page { 
    26913272    my $this = shift; 
    26923273 
     
    27073288    ); 
    27083289 
    2709     my $expected = <<EXPECT; 
     3290    my $expected = <<'EXPECT'; 
    27103291EXPECT 
    27113292    $expected =~ s/\n$//s; 
    27123293    $this->assert_str_equals( $expected, $result ); 
    2713 } 
    2714  
    2715 sub verify_paging_with_limit_way_too_far { 
     3294 
     3295    return; 
     3296} 
     3297 
     3298sub test_paging_with_limit_way_too_far { 
    27163299    my $this = shift; 
    27173300 
     
    27323315    ); 
    27333316