Ignore:
Timestamp:
01/23/12 07:00:46 (4 months ago)
Author:
PaulHarvey
Message:

Item11431: Clean UnitTests of Foswiki->new/finish

Committing what was 96 commits rebased on top of Foswikirev:13781. You
can view this full commit history at
 https://github.com/csirac2/UnitTestContrib/commits/Item11431-rebased

Tackling memory leaks, this effort seems to have saved 300MB and 10
minutes from the cost of running a full FoswikiSuite.

The recipe was:

  • Find and remove all Foswiki->new/finish calls with $this->createNewFoswikiSession()
  • Generally removed $fatwilly variables and replaced with $this->{session}, to avoid references to ->finish()'d Foswiki singleton/session objects
  • Addressed perlcriticisms in touched files
  • Convert Foswiki::Meta->new/load to Foswiki::Func::readTopic, for the sake of store2 re-integration
  • Call $topicObject->finish() where/whenever we can

Some of the tests in the default plugins need a little work, and
there's some uncommitted stuff against core lib/Foswiki.pm to help
assert SINGLE_SINGLETONS from Foswiki::new/::finish subs, we'll get
to that later...

Conflicts:

test/unit/AddressTests.pm
test/unit/AdminOnlyAccessControlTests.pm
test/unit/Fn_SEARCH.pm

File:
1 edited

Legend:

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

    r13729 r13794  
    22 
    33package Fn_IF; 
    4  
    54use strict; 
    6  
    7 use FoswikiFnTestCase; 
     5use warnings; 
     6 
     7use FoswikiFnTestCase(); 
    88our @ISA = qw( FoswikiFnTestCase ); 
    99 
    10 use Foswiki; 
     10use Foswiki(); 
    1111use Error qw( :try ); 
    1212use Assert; 
     
    1717 
    1818sub new { 
    19     my $self = shift()->SUPER::new( 'IF', @_ ); 
    20     my $dep = new Foswiki::Configure::Dependency( 
     19    my ( $class, @args ) = @_; 
     20    my $dep = Foswiki::Configure::Dependency->new( 
    2121        type    => "perl", 
    2222        module  => "Foswiki", 
     
    2424    ); 
    2525    ( $post11, my $message ) = $dep->check(); 
    26     return $self; 
     26 
     27    return $class->SUPER::new( 'IF', @args ); 
    2728} 
    2829 
     
    3031    my $this = shift; 
    3132    $this->simpleTest( test => "'A'='B'", then => 0, else => 1 ); 
     33 
     34    return; 
    3235} 
    3336 
     
    3538    my $this = shift; 
    3639    $this->simpleTest( test => "'A'!='B'", then => 1, else => 0 ); 
     40 
     41    return; 
    3742} 
    3843 
     
    4045    my $this = shift; 
    4146    $this->simpleTest( test => "'A'='A'", then => 1, else => 0 ); 
     47 
     48    return; 
    4249} 
    4350 
     
    4552    my $this = shift; 
    4653    $this->simpleTest( test => "'A'='B'", then => 0, else => 1 ); 
     54 
     55    return; 
    4756} 
    4857 
     
    5059    my $this = shift; 
    5160    $this->simpleTest( test => 'context test', then => 1, else => 0 ); 
     61 
     62    return; 
    5263} 
    5364 
     
    5566    my $this = shift; 
    5667    $this->simpleTest( test => 'context \'test\'', then => 1, else => 0 ); 
     68 
     69    return; 
    5770} 
    5871 
     
    6073    my $this = shift; 
    6174    $this->simpleTest( test => "{Fnargle}='Fleeble'", then => 1, else => 0 ); 
     75 
     76    return; 
    6277} 
    6378 
     
    6580    my $this = shift; 
    6681    $this->simpleTest( test => "{A}{B}='C'", then => 1, else => 0 ); 
     82 
     83    return; 
    6784} 
    6885 
     
    7592        else => 0 
    7693    ); 
     94 
     95    return; 
    7796} 
    7897 
     
    85104        else => 0 
    86105    ); 
     106 
     107    return; 
    87108} 
    88109 
     
    92113 
    93114    # See test_96* for other 'defined' tests 
     115 
     116    return; 
    94117} 
    95118 
     
    141164        else => 1 
    142165    ); 
     166 
     167    return; 
    143168} 
    144169 
     
    146171    my $this = shift; 
    147172    $this->simpleTest( test => '0>1', then => 0, else => 1 ); 
     173 
     174    return; 
    148175} 
    149176 
     
    151178    my $this = shift; 
    152179    $this->simpleTest( test => '1>0', then => 1, else => 0 ); 
     180 
     181    return; 
    153182} 
    154183 
     
    156185    my $this = shift; 
    157186    $this->simpleTest( test => '1<0', then => 0, else => 1 ); 
     187 
     188    return; 
    158189} 
    159190 
     
    161192    my $this = shift; 
    162193    $this->simpleTest( test => '0<1', then => 1, else => 0 ); 
     194 
     195    return; 
    163196} 
    164197 
     
    166199    my $this = shift; 
    167200    $this->simpleTest( test => "0>=\t1", then => 0, else => 1 ); 
     201 
     202    return; 
    168203} 
    169204 
     
    171206    my $this = shift; 
    172207    $this->simpleTest( test => '1>=0', then => 1, else => 0 ); 
     208 
     209    return; 
    173210} 
    174211 
     
    176213    my $this = shift; 
    177214    $this->simpleTest( test => '1>=1', then => 1, else => 0 ); 
     215 
     216    return; 
    178217} 
    179218 
     
    181220    my $this = shift; 
    182221    $this->simpleTest( test => '1<=0', then => 0, else => 1 ); 
     222 
     223    return; 
    183224} 
    184225 
     
    186227    my $this = shift; 
    187228    $this->simpleTest( test => '0<=1', then => 1, else => 0 ); 
     229 
     230    return; 
    188231} 
    189232 
     
    191234    my $this = shift; 
    192235    $this->simpleTest( test => '1<=1', then => 1, else => 0 ); 
     236 
     237    return; 
    193238} 
    194239 
     
    196241    my $this = shift; 
    197242    $this->simpleTest( test => "not 'A'='B'", then => 1, else => 0 ); 
     243 
     244    return; 
    198245} 
    199246 
     
    201248    my $this = shift; 
    202249    $this->simpleTest( test => "not NOT 'A'='B'", then => 0, else => 1 ); 
     250 
     251    return; 
    203252} 
    204253 
     
    206255    my $this = shift; 
    207256    $this->simpleTest( test => "'A'='A' AND 'B'='B'", then => 1, else => 0 ); 
     257 
     258    return; 
    208259} 
    209260 
     
    211262    my $this = shift; 
    212263    $this->simpleTest( test => "'A'='A' and 'B'='B'", then => 1, else => 0 ); 
     264 
     265    return; 
    213266} 
    214267 
     
    216269    my $this = shift; 
    217270    $this->simpleTest( test => "'A'='A' and 'B'='B'", then => 1, else => 0 ); 
     271 
     272    return; 
    218273} 
    219274 
     
    225280        else => 0 
    226281    ); 
     282 
     283    return; 
    227284} 
    228285 
     
    230287    my $this = shift; 
    231288    $this->simpleTest( test => "'A'='B' or 'B'='B'", then => 1, else => 0 ); 
     289 
     290    return; 
    232291} 
    233292 
     
    235294    my $this = shift; 
    236295    $this->simpleTest( test => "'A'='A' or 'B'='A'", then => 1, else => 0 ); 
     296 
     297    return; 
    237298} 
    238299 
     
    240301    my $this = shift; 
    241302    $this->simpleTest( test => "'A'='B' or 'B'='A'", then => 0, else => 1 ); 
     303 
     304    return; 
    242305} 
    243306 
     
    249312        else => 0 
    250313    ); 
     314 
     315    return; 
    251316} 
    252317 
     
    258323        else => 0 
    259324    ); 
     325 
     326    return; 
    260327} 
    261328 
     
    263330    my $this = shift; 
    264331    $this->simpleTest( test => "'A'~'B'", then => 0, else => 1 ); 
     332 
     333    return; 
    265334} 
    266335 
     
    268337    my $this = shift; 
    269338    $this->simpleTest( test => "'ABLABA'~'*B?AB*'", then => 1, else => 0 ); 
     339 
     340    return; 
    270341} 
    271342 
     
    273344    my $this = shift; 
    274345    $this->simpleTest( test => '\"BABBA\"~\"*BB?\"', then => 1, else => 0 ); 
     346 
     347    return; 
    275348} 
    276349 
     
    278351    my $this = shift; 
    279352    $this->simpleTest( test => "lc('FRED')='fred'", then => 1, else => 0 ); 
     353 
     354    return; 
    280355} 
    281356 
     
    283358    my $this = shift; 
    284359    $this->simpleTest( test => "('FRED')=uc 'fred'", then => 1, else => 0 ); 
     360 
     361    return; 
    285362} 
    286363 
     
    293370        else => 0 
    294371    ); 
     372 
     373    return; 
    295374} 
    296375 
     
    302381        else => 1 
    303382    ); 
     383 
     384    return; 
    304385} 
    305386 
     
    307388    my $this = shift; 
    308389    $this->simpleTest( test => "1 = 1 > 0", then => 1, else => 0 ); 
     390 
     391    return; 
    309392} 
    310393 
     
    312395    my $this = shift; 
    313396    $this->simpleTest( test => "1 > 1 = 0", then => 1, else => 0 ); 
     397 
     398    return; 
    314399} 
    315400 
     
    317402    my $this = shift; 
    318403    $this->simpleTest( test => "not 1 = 2", then => 1, else => 0 ); 
     404 
     405    return; 
    319406} 
    320407 
     
    322409    my $this = shift; 
    323410    $this->simpleTest( test => "not not 1 and 1", then => 1, else => 0 ); 
     411 
     412    return; 
    324413} 
    325414 
     
    327416    my $this = shift; 
    328417    $this->simpleTest( test => "0 or not not 1 and 1", then => 1, else => 0 ); 
     418 
     419    return; 
    329420} 
    330421 
     
    339430        else => 1 
    340431    ); 
     432 
     433    return; 
    341434} 
    342435 
     
    352445        else => 1 
    353446    ); 
     447 
     448    return; 
    354449} 
    355450 
     
    361456        else => 1 
    362457    ); 
     458 
     459    return; 
    363460} 
    364461 
     
    373470        else => 1 
    374471    ); 
     472 
     473    return; 
    375474} 
    376475 
     
    386485        else => 1 
    387486    ); 
     487 
     488    return; 
    388489} 
    389490 
     
    397498        else => 1 
    398499    ); 
     500 
     501    return; 
    399502} 
    400503 
     
    411514        else => 1 
    412515    ); 
     516 
     517    return; 
    413518} 
    414519 
     
    422527        else => 1 
    423528    ); 
     529 
     530    return; 
    424531} 
    425532 
     
    433540        else => 1 
    434541    ); 
     542 
     543    return; 
    435544} 
    436545 
     
    447556        else => 0 
    448557    ); 
     558 
     559    return; 
    449560} 
    450561 
     
    458569        else => 0 
    459570    ); 
     571 
     572    return; 
    460573} 
    461574 
     
    470583        else => 1 
    471584    ); 
     585 
     586    return; 
    472587} 
    473588 
     
    479594        else => 1 
    480595    ); 
     596 
     597    return; 
    481598} 
    482599 
     
    488605        else => 1 
    489606    ); 
     607 
     608    return; 
    490609} 
    491610 
     
    497616        else => 1 
    498617    ); 
     618 
     619    return; 
    499620} 
    500621 
     
    506627        else => 0 
    507628    ); 
     629 
     630    return; 
    508631} 
    509632 
     
    515638        else => 1 
    516639    ); 
     640 
     641    return; 
    517642} 
    518643 
     
    525650        else => 1 
    526651    ); 
     652 
     653    return; 
    527654} 
    528655 
     
    535662        else => 1 
    536663    ); 
     664 
     665    return; 
    537666} 
    538667 
     
    544673        else => 0 
    545674    ); 
     675 
     676    return; 
    546677} 
    547678 
     
    553684        else => 1 
    554685    ); 
     686 
     687    return; 
    555688} 
    556689 
     
    563696        else => 1 
    564697    ); 
     698 
     699    return; 
    565700} 
    566701 
     
    573708        else => 1 
    574709    ); 
     710 
     711    return; 
    575712} 
    576713 
     
    582719        else => 0 
    583720    ); 
     721 
     722    return; 
    584723} 
    585724 
     
    591730        else => 1 
    592731    ); 
     732 
     733    return; 
    593734} 
    594735 
     
    601742        else => 1 
    602743    ); 
     744 
     745    return; 
    603746} 
    604747 
     
    611754        else => 1 
    612755    ); 
     756 
     757    return; 
    613758} 
    614759 
     
    620765        else => 0 
    621766    ); 
     767 
     768    return; 
    622769} 
    623770 
     
    631778        else => 1 
    632779    ); 
     780 
     781    return; 
    633782} 
    634783 
     
    642791        else => 1 
    643792    ); 
     793 
     794    return; 
    644795} 
    645796 
     
    654805        else => 1 
    655806    ); 
     807 
     808    return; 
    656809} 
    657810 
     
    665818        else => 0 
    666819    ); 
     820 
     821    return; 
    667822} 
    668823 
     
    676831        else => 1 
    677832    ); 
     833 
     834    return; 
    678835} 
    679836 
     
    687844        else => 1 
    688845    ); 
     846 
     847    return; 
    689848} 
    690849 
     
    699858        else => 0 
    700859    ); 
     860 
     861    return; 
    701862} 
    702863 
     
    710871        else => 1 
    711872    ); 
     873 
     874    return; 
    712875} 
    713876 
     
    721884        else => 1 
    722885    ); 
     886 
     887    return; 
    723888} 
    724889 
     
    732897        else => 1 
    733898    ); 
     899 
     900    return; 
    734901} 
    735902 
     
    744911        else => 1 
    745912    ); 
     913 
     914    return; 
    746915} 
    747916 
     
    753922        else => 0 
    754923    ); 
     924 
     925    return; 
    755926} 
    756927 
     
    762933        else => 1 
    763934    ); 
     935 
     936    return; 
    764937} 
    765938 
     
    773946        else => 1 
    774947    ); 
     948 
     949    return; 
    775950} 
    776951 
     
    785960        else => 0 
    786961    ); 
     962 
     963    return; 
    787964} 
    788965 
     
    794971        else => 1 
    795972    ); 
     973 
     974    return; 
    796975} 
    797976 
     
    803982        else => 1 
    804983    ); 
     984 
     985    return; 
    805986} 
    806987 
     
    814995        else => 1 
    815996    ); 
     997 
     998    return; 
    816999} 
    8171000 
     
    8261009        else => 1 
    8271010    ); 
     1011 
     1012    return; 
    8281013} 
    8291014 
     
    8371022        else => 0 
    8381023    ); 
     1024 
     1025    return; 
    8391026} 
    8401027 
     
    8461033        else => 1 
    8471034    ); 
     1035 
     1036    return; 
    8481037} 
    8491038 
     
    8571046        else => 1 
    8581047    ); 
     1048 
     1049    return; 
    8591050} 
    8601051 
     
    8691060        else => 0 
    8701061    ); 
     1062 
     1063    return; 
    8711064} 
    8721065 
     
    8781071        else => 1 
    8791072    ); 
     1073 
     1074    return; 
    8801075} 
    8811076 
     
    8871082        else => 1 
    8881083    ); 
     1084 
     1085    return; 
    8891086} 
    8901087 
     
    8981095        else => 1 
    8991096    ); 
     1097 
     1098    return; 
    9001099} 
    9011100 
     
    9101109        else => 1 
    9111110    ); 
     1111 
     1112    return; 
    9121113} 
    9131114 
     
    9211122        else => 0 
    9221123    ); 
     1124 
     1125    return; 
    9231126} 
    9241127 
     
    9261129    my $this = shift; 
    9271130    $this->simpleTest( test => "isweb 'System'", then => 1, else => 0 ); 
     1131 
     1132    return; 
    9281133} 
    9291134 
     
    9311136    my $this = shift; 
    9321137    $this->simpleTest( test => "isweb 'Not a web'", then => 0, else => 1 ); 
     1138 
     1139    return; 
    9331140} 
    9341141 
     
    9361143    my $this = shift; 
    9371144    $this->simpleTest( test => "istopic \$'System'", then => 0, else => 1 ); 
     1145 
     1146    return; 
    9381147} 
    9391148 
     
    9411150    my $this = shift; 
    9421151    $this->simpleTest( test => "istopic \$'Not a web'", then => 0, else => 1 ); 
     1152 
     1153    return; 
    9431154} 
    9441155 
     
    9501161        else => 1 
    9511162    ); 
     1163 
     1164    return; 
    9521165} 
    9531166 
     
    9591172        else => 1 
    9601173    ); 
     1174 
     1175    return; 
    9611176} 
    9621177 
     
    9681183        else => 1 
    9691184    ); 
     1185 
     1186    return; 
    9701187} 
    9711188 
     
    9771194        else => 1 
    9781195    ); 
     1196 
     1197    return; 
    9791198} 
    9801199 
     
    9821201    my $this = shift; 
    9831202    $this->simpleTest( test => "isweb \$ 'SYSTEMWEB'", then => 1, else => 0 ); 
     1203 
     1204    return; 
    9841205} 
    9851206 
     
    9871208    my $this = shift; 
    9881209    $this->simpleTest( test => 'defined \'SYSTEMWEB\'', then => 1, else => 0 ); 
     1210 
     1211    return; 
    9891212} 
    9901213 
     
    9941217 
    9951218    # see also test_9 and test_96* 
     1219 
     1220    return; 
    9961221} 
    9971222 
     
    9991224    my $this = shift; 
    10001225    $this->simpleTest( test => 'defined( SYSTEMWEB )', then => 1, else => 0 ); 
     1226 
     1227    return; 
    10011228} 
    10021229 
     
    10041231    my $this = shift; 
    10051232    $this->simpleTest( test => "defined( 'SYSTEMWEB' )", then => 1, else => 0 ); 
     1233 
     1234    return; 
    10061235} 
    10071236 
     
    10091238    my $this = shift; 
    10101239    $this->simpleTest( test => 'defined( UNDEF )', then => 0, else => 1 ); 
     1240 
     1241    return; 
    10111242} 
    10121243 
     
    10141245    my $this = shift; 
    10151246    $this->simpleTest( test => "defined( 'UNDEF' )", then => 0, else => 1 ); 
     1247 
     1248    return; 
    10161249} 
    10171250 
     
    10191252    my $this = shift; 
    10201253    $this->simpleTest( test => 'defined \'IF\'', then => 1, else => 0 ); 
     1254 
     1255    return; 
    10211256} 
    10221257 
     
    10241259    my $this = shift; 
    10251260    $this->simpleTest( test => 'defined IF', then => 1, else => 0 ); 
     1261 
     1262    return; 
    10261263} 
    10271264 
     
    10391276        #print STDERR "catched error ".shift."\n"; 
    10401277    }; 
     1278 
     1279    return; 
    10411280} 
    10421281 
     
    10451284    $this->SUPER::set_up(@_); 
    10461285 
    1047     my $topicObject = Foswiki::Meta->new( 
    1048         $this->{session}, 
    1049         $this->{users_web}, 
    1050         "GropeGroup", 
    1051         "   * Set GROUP = " 
    1052           . Foswiki::Func::getWikiName( $this->{session}->{user} ) . "\n" 
    1053     ); 
     1286    my ($topicObject) = 
     1287      Foswiki::Func::readTopic( $this->{users_web}, "GropeGroup" ); 
     1288    $topicObject->text( "   * Set GROUP = " 
     1289          . Foswiki::Func::getWikiName( $this->{session}->{user} ) 
     1290          . "\n" ); 
    10541291    $topicObject->save(); 
     1292    $topicObject->finish(); 
    10551293 
    10561294    # Create WebHome topic to trap existance errors related to 
    10571295    # normalizeWebTopicName 
    1058     $topicObject = Foswiki::Meta->new( 
    1059         $this->{session}, $this->{test_web}, 
    1060         "WebHome",        "Gormless gimboid\n" 
    1061     ); 
     1296    ($topicObject) = Foswiki::Func::readTopic( $this->{test_web}, "WebHome" ); 
     1297    $topicObject->text("Gormless gimboid\n"); 
    10621298    $topicObject->save(); 
     1299    $topicObject->finish(); 
     1300 
     1301    return; 
    10631302} 
    10641303 
     
    10901329    #print STDERR "$text => $result\n"; 
    10911330    $this->assert_equals( '1', $result, $text . " => " . $result ); 
     1331 
     1332    return; 
    10921333} 
    10931334 
     
    10951336    my $this = shift; 
    10961337 
    1097     my $topicObject = 
    1098       Foswiki::Meta->new( $this->{session}, $this->{test_web}, "DeadHerring", 
    1099         <<'SMELL'); 
     1338    my ($topicObject) = 
     1339      Foswiki::Func::readTopic( $this->{test_web}, "DeadHerring" ); 
     1340    $topicObject->text( <<'SMELL'); 
    11001341one %IF{ "defined NAME" then="1" else="0" }% 
    11011342two %IF{ "$ NAME='%NAME%'" then="1" else="0" }% 
     
    11031344SMELL 
    11041345    $topicObject->save(); 
     1346    $topicObject->finish(); 
    11051347    my $text = <<'PONG'; 
    11061348%INCLUDE{"DeadHerring" NAME="Red" warn="on"}% 
     
    11081350    my $result = $this->{test_topicObject}->expandMacros($text); 
    11091351    $this->assert_matches( qr/^\s*one 1\s+two 1\s+three 1\s*$/s, $result ); 
     1352 
     1353    return; 
    11101354} 
    11111355 
     
    11301374        $this->assert_str_equals( $test->{expect}, $result ); 
    11311375    } 
     1376 
     1377    return; 
    11321378} 
    11331379 
     
    11351381    my $this = shift; 
    11361382 
    1137     my $topicObject = 
    1138       Foswiki::Meta->new( $this->{session}, $this->{test_web}, "DeadHerring", 
    1139         <<'SMELL'); 
     1383    my ($topicObject) = 
     1384      Foswiki::Func::readTopic( $this->{test_web}, "DeadHerring" ); 
     1385    $topicObject->text( <<'SMELL'); 
    11401386one %IF{ "BleaghForm.Wibble='Woo'" then="1" else="0" }% 
    11411387%META:FORM{name="BleaghForm"}% 
     
    11431389SMELL 
    11441390    $topicObject->save(); 
     1391    $topicObject->finish(); 
    11451392    my $text = <<'PONG'; 
    11461393%INCLUDE{"DeadHerring" NAME="Red" warn="on"}% 
     
    11481395    my $result = $this->{test_topicObject}->expandMacros($text); 
    11491396    $this->assert_matches( qr/^\s*one 1\s*$/s, $result ); 
     1397 
     1398    return; 
    11501399} 
    11511400 
     
    11531402    my $this = shift; 
    11541403    my $wn   = Foswiki::Func::getWikiName( $this->{session}->{user} ); 
    1155     my $meta = 
    1156       Foswiki::Meta->new( $this->{session}, $this->{test_web}, "DeadDog", 
    1157         <<PONG); 
     1404    my ($meta) = Foswiki::Func::readTopic( $this->{test_web}, "DeadDog" ); 
     1405    $meta->text( <<"PONG"); 
    11581406   * Set ALLOWTOPICVIEW = WibbleFloon 
    11591407   * Set ALLOWTOPICCHANGE = $wn 
    11601408PONG 
    11611409    $meta->save(); 
     1410    $meta->finish(); 
    11621411 
    11631412    my @tests; 
     
    12971546        } 
    12981547    ); 
    1299     $this->{session}->finish(); 
    1300     my $request = new Unit::Request( {} ); 
     1548    my $request = Unit::Request->new( {} ); 
    13011549    $request->path_info("/$this->{test_web}/$this->{test_topic}"); 
    1302     $this->{session} = new Foswiki( undef, $request ); 
    1303     $meta = 
    1304       Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    1305         $this->{test_topic} ); 
     1550    $this->createNewFoswikiSession( undef, $request ); 
     1551    ($meta) = 
     1552      Foswiki::Func::readTopic( $this->{test_web}, $this->{test_topic} ); 
    13061553 
    13071554    foreach my $test (@tests) { 
     
    13111558            "$text: '$result'" ); 
    13121559    } 
     1560    $meta->finish(); 
     1561 
     1562    return; 
    13131563} 
    13141564 
     
    13181568   * Set LOOP = %IF{"$ LOOP = '1'" then="ping" else="pong"}% 
    13191569PONG 
    1320     my $topicObject = 
    1321       Foswiki::Meta->new( $this->{session}, $this->{test_web}, 
    1322         $this->{test_topic}, $text ); 
     1570    my ($topicObject) = 
     1571      Foswiki::Func::readTopic( $this->{test_web}, $this->{test_topic} ); 
     1572    $topicObject->text($text); 
    13231573    $topicObject->save(); 
     1574    $topicObject->finish(); 
    13241575    my $result = $this->{test_topicObject}->expandMacros($text); 
    13251576    $this->assert_str_equals( "   * Set LOOP = pong\n", $result ); 
     1577 
     1578    return; 
    13261579} 
    13271580 
     
    13311584    my $topicName = 'TopicInfo'; 
    13321585 
    1333     my $meta = 
    1334       Foswiki::Meta->new( $this->{session}, $this->{test_web}, $topicName, 
    1335         <<PONG); 
     1586    my ($meta) = Foswiki::Func::readTopic( $this->{test_web}, $topicName ); 
     1587    $meta->text( <<'PONG'); 
    13361588oneapeny twoapenny we all fall down 
    13371589PONG 
    13381590    $meta->save(); 
    1339  
    1340     $meta = 
    1341       Foswiki::Meta->load( $this->{session}, $this->{test_web}, $topicName ); 
     1591    $meta->finish(); 
     1592 
     1593    ($meta) = Foswiki::Func::readTopic( $this->{test_web}, $topicName ); 
    13421594    $meta->getRevisionInfo(); 
    13431595    my $ti = $meta->get('TOPICINFO'); 
     
    14081660            "$text: '$result'" ); 
    14091661    } 
     1662    $meta->finish(); 
     1663 
     1664    return; 
    14101665} 
    14111666 
     
    14131668    my $this = shift; 
    14141669    $this->simpleTest( test => 'isempty notthere', then => 1, else => 0 ); 
     1670 
     1671    return; 
    14151672} 
    14161673 
     
    14191676    $this->simpleTest( test => 'defined empty', then => 1, else => 0 ); 
    14201677    $this->simpleTest( test => 'isempty empty', then => 1, else => 0 ); 
     1678 
     1679    return; 
    14211680} 
    14221681 
     
    14241683    my $this = shift; 
    14251684    $this->simpleTest( test => 'isempty notempty', then => 0, else => 1 ); 
     1685 
     1686    return; 
    14261687} 
    14271688 
     
    14291690    my $this = shift; 
    14301691    $this->simpleTest( test => 'isempty NOTTHERE', then => 1, else => 0 ); 
     1692 
     1693    return; 
    14311694} 
    14321695 
     
    14351698    $this->simpleTest( test => 'defined EMPTY', then => 1, else => 0 ); 
    14361699    $this->simpleTest( test => 'isempty EMPTY', then => 1, else => 0 ); 
     1700 
     1701    return; 
    14371702} 
    14381703 
     
    14401705    my $this = shift; 
    14411706    $this->simpleTest( test => 'isempty SNOTEMPTY', then => 0, else => 1 ); 
     1707 
     1708    return; 
    14421709} 
    14431710 
     
    14451712    my $this = shift; 
    14461713    $this->simpleTest( test => 'isempty SNOTTHERE', then => 1, else => 0 ); 
     1714 
     1715    return; 
    14471716} 
    14481717 
     
    14511720    $this->simpleTest( test => 'defined SEMPTY', then => 1, else => 0 ); 
    14521721    $this->simpleTest( test => 'isempty SEMPTY', then => 1, else => 0 ); 
     1722 
     1723    return; 
    14531724} 
    14541725 
     
    14561727    my $this = shift; 
    14571728    $this->simpleTest( test => 'isempty NOTEMPTY', then => 0, else => 1 ); 
     1729 
     1730    return; 
    14581731} 
    14591732 
     
    14611734    my $this = shift; 
    14621735    $this->simpleTest( test => "isempty ''", then => 1, else => 0 ); 
     1736 
     1737    return; 
    14631738} 
    14641739 
     
    14661741    my $this = shift; 
    14671742    $this->simpleTest( test => "isempty undef", then => 1, else => 0 ); 
     1743 
     1744    return; 
    14681745} 
    14691746 
     
    16951972    ); 
    16961973 
     1974    return; 
    16971975} 
    16981976 
     
    17211999    $this->simpleTest( test => "'0.0'", then => 1, else => 0 ); 
    17222000    $this->simpleTest( test => "''",    then => 0, else => 1 ); 
     2001 
     2002    return; 
    17232003} 
    17242004 
Note: See TracChangeset for help on using the changeset viewer.