Changeset 13833


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

Item11456: Fn_SEARCH 1.1 compatibility progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UnitTestContrib/test/unit/Fn_SEARCH.pm

    r13791 r13833  
    440440        }%' 
    441441    ); 
    442     my $expected = <<'EXPECT'; 
     442    my $expected; 
     443    if ( $this->check_dependency('Foswiki,<,1.2') ) { 
     444        $expected = <<'EXPECT'; 
     445System.WebHome 
     446System.WebPreferences 
     447System.WebSearch 
     448Main.WebHome 
     449Main.WebPreferences 
     450Main.WebSearch 
     451Sandbox.WebHome 
     452Sandbox.WebPreferences 
     453Sandbox.WebSearch 
     454EXPECT 
     455    } 
     456    else { 
     457        $expected = <<'EXPECT'; 
    443458Main.WebHome 
    444459Main.WebPreferences 
     
    451466System.WebSearch 
    452467EXPECT 
     468    } 
    453469    $expected =~ s/\n$//s; 
    454470    $this->assert_str_equals( $expected, $result ); 
     
    469485        }%' 
    470486    ); 
    471     my $expected = <<'EXPECT'; 
     487    my $expected; 
     488    if ( $this->check_dependency('Foswiki,<,1.2') ) { 
     489        $expected = <<'EXPECT'; 
     490System.WebHome 
     491System.WebPreferences 
     492System.WebSearch 
     493Main.WebHome 
     494Main.WebPreferences 
     495Main.WebSearch 
     496Sandbox.WebHome 
     497Sandbox.WebPreferences 
     498Sandbox.WebSearch 
     499EXPECT 
     500    } 
     501    else { 
     502        $expected = <<'EXPECT'; 
    472503Main.WebHome 
    473504Main.WebPreferences 
     
    480511System.WebSearch 
    481512EXPECT 
     513    } 
    482514    $expected =~ s/\n$//s; 
    483515    $this->assert_str_equals( $expected, $result ); 
     
    20992131 
    21002132sub _getTopicList { 
    2101     my ( $this, $expected, $web, $options, $sadness ) = @_; 
     2133    my ( $this, $web, $options, $sadness, $default_expected, %expected_list ) = 
     2134      @_; 
     2135    my $expected; 
    21022136 
    21032137    #    my $options = { 
     
    21082142    #    }; 
    21092143 
     2144    foreach my $dep_str ( sort( keys %expected_list ) ) { 
     2145        if ( !$expected && $this->check_dependency($dep_str) ) { 
     2146            $expected = $expected_list{$dep_str}; 
     2147        } 
     2148    } 
     2149    if ( !$expected ) { 
     2150        $expected = $default_expected; 
     2151        $this->assert_str_equals( 'ARRAY', ref($expected) ); 
     2152    } 
    21102153    my $webObject = Foswiki::Meta->new( $this->{session}, $web ); 
    21112154 
     
    21342177    #no topics specified.. 
    21352178    $this->_getTopicList( 
     2179        $this->{test_web}, 
     2180        {}, 
     2181        'no filters, all topics in test_web', 
    21362182        [ 
    21372183            'OkATopic', 'OkBTopic', 
     
    21392185            'WebPreferences' 
    21402186        ], 
    2141         $this->{test_web}, 
     2187    ); 
     2188    $this->_getTopicList( 
     2189        '_default', 
    21422190        {}, 
    2143         'no filters, all topics in test_web' 
    2144     ); 
    2145     $this->_getTopicList( 
     2191        'no filters, all topics in test_web', 
    21462192        [ 
    21472193            'WebAtom',           'WebChanges', 
     
    21522198            'WebSearchAdvanced', 'WebTopicList' 
    21532199        ], 
    2154         '_default', 
    2155         {}, 
    2156         'no filters, all topics in test_web' 
    21572200    ); 
    21582201 
    21592202    #use wildcards 
    21602203    $this->_getTopicList( 
    2161         [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    21622204        $this->{test_web}, 
    21632205        { includeTopics => 'Ok*' }, 
    2164         'comma separated list' 
     2206        'comma separated list', 
     2207        [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    21652208    ); 
    21662209    $this->_getTopicList( 
     2210        '_default', 
     2211        { includeTopics => 'Web*' }, 
     2212        'no filters, all topics in test_web', 
    21672213        [ 
    21682214            'WebAtom',           'WebChanges', 
     
    21732219            'WebSearchAdvanced', 'WebTopicList' 
    21742220        ], 
    2175         '_default', 
    2176         { includeTopics => 'Web*' }, 
    2177         'no filters, all topics in test_web' 
    21782221    ); 
    21792222 
    21802223    #comma separated list specifed for inclusion 
    21812224    $this->_getTopicList( 
    2182         [ 'OkTopic', 'TestTopicSEARCH' ], 
    21832225        $this->{test_web}, 
    21842226        { includeTopics => 'TestTopicSEARCH,OkTopic,NoSuchTopic' }, 
    2185         'comma separated list' 
     2227        'comma separated list', 
     2228        [ 'OkTopic', 'TestTopicSEARCH' ], 
     2229        'Foswiki,<,1.2' => [ 'TestTopicSEARCH', 'OkTopic' ], 
    21862230    ); 
    21872231    $this->_getTopicList( 
    2188         [ 'WebCreateNewTopic', 'WebTopicList' ], 
    21892232        '_default', 
    21902233        { includeTopics => 'WebTopicList, WebCreateNewTopic, NoSuchTopic' }, 
    2191         'no filters, all topics in test_web' 
     2234        'no filters, all topics in test_web', 
     2235        [ 'WebCreateNewTopic', 'WebTopicList' ], 
     2236        'Foswiki,<,1.2' => [ 'WebTopicList', 'WebCreateNewTopic' ], 
    21922237    ); 
    21932238 
    21942239    #excludes 
    21952240    $this->_getTopicList( 
    2196         [ 'OkATopic', 'OkTopic', 'TestTopicSEARCH', 'WebPreferences' ], 
    21972241        $this->{test_web}, 
    21982242        { excludeTopics => 'NoSuchTopic,OkBTopic' }, 
    2199         'no filters, all topics in test_web' 
     2243        'no filters, all topics in test_web', 
     2244        [ 'OkATopic', 'OkTopic', 'TestTopicSEARCH', 'WebPreferences' ], 
    22002245    ); 
    22012246    $this->_getTopicList( 
     2247        '_default', 
     2248        { excludeTopics => 'WebSearch' }, 
     2249        'no filters, all topics in test_web', 
    22022250        [ 
    22032251            'WebAtom',           'WebChanges', 
     
    22082256            'WebTopicList' 
    22092257        ], 
    2210         '_default', 
    2211         { excludeTopics => 'WebSearch' }, 
    2212         'no filters, all topics in test_web' 
    22132258    ); 
    22142259 
    22152260    #Talk about missing alot of tests 
    22162261    $this->_getTopicList( 
     2262        $this->{test_web}, 
     2263        { includeTopics => '*' }, 
     2264        'all topics, using wildcard', 
    22172265        [ 
    22182266            'OkATopic', 'OkBTopic', 
     
    22202268            'WebPreferences' 
    22212269        ], 
    2222         $this->{test_web}, 
    2223         { includeTopics => '*' }, 
    2224         'all topics, using wildcard' 
    22252270    ); 
    22262271    $this->_getTopicList( 
    2227         [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    22282272        $this->{test_web}, 
    22292273        { includeTopics => 'Ok*' }, 
    2230         'Ok* topics, using wildcard' 
     2274        'Ok* topics, using wildcard', 
     2275        [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    22312276    ); 
    22322277    $this->_getTopicList( 
    2233         [], 
    22342278        $this->{test_web}, 
    22352279        { 
     
    22372281            casesensitive => 1 
    22382282        }, 
    2239         'case sensitive ok* topics, using wildcard' 
     2283        'case sensitive ok* topics, using wildcard', 
     2284        [], 
    22402285    ); 
    22412286    $this->_getTopicList( 
    2242         [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    22432287        $this->{test_web}, 
    22442288        { 
     
    22462290            casesensitive => 0 
    22472291        }, 
    2248         'case insensitive ok* topics, using wildcard' 
     2292        'case insensitive ok* topics, using wildcard', 
     2293        [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    22492294    ); 
    22502295 
     
    22562301        # this test won't work on Mac OS X or windows. 
    22572302        $this->_getTopicList( 
    2258             [], 
    22592303            $this->{test_web}, 
    22602304            { 
     
    22622306                casesensitive => 1 
    22632307            }, 
    2264             'case sensitive okatopic topic 1' 
     2308            'case sensitive okatopic topic 1', 
     2309            [], 
    22652310        ); 
    22662311    } 
    22672312 
    22682313    $this->_getTopicList( 
    2269         ['OkATopic'], 
    22702314        $this->{test_web}, 
    22712315        { 
     
    22732317            casesensitive => 0 
    22742318        }, 
    2275         'case insensitive okatopic topic' 
     2319        'case insensitive okatopic topic', 
     2320        ['OkATopic'], 
    22762321    ); 
    22772322    ##### same again, with excludes. 
    22782323    $this->_getTopicList( 
     2324        $this->{test_web}, 
     2325        { 
     2326            includeTopics => '*', 
     2327            excludeTopics => 'web*' 
     2328        }, 
     2329        'all topics, using wildcard', 
    22792330        [ 
    22802331            'OkATopic', 'OkBTopic', 
     
    22822333            'WebPreferences' 
    22832334        ], 
    2284         $this->{test_web}, 
    2285         { 
    2286             includeTopics => '*', 
    2287             excludeTopics => 'web*' 
    2288         }, 
    2289         'all topics, using wildcard' 
    22902335    ); 
    22912336    $this->_getTopicList( 
    2292         [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    22932337        $this->{test_web}, 
    22942338        { 
     
    22962340            excludeTopics => 'okatopic' 
    22972341        }, 
    2298         'Ok* topics, using wildcard' 
     2342        'Ok* topics, using wildcard', 
     2343        [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    22992344    ); 
    23002345    $this->_getTopicList( 
    2301         [], 
    23022346        $this->{test_web}, 
    23032347        { 
     
    23062350            casesensitive => 1 
    23072351        }, 
    2308         'case sensitive ok* topics, using wildcard' 
     2352        'case sensitive ok* topics, using wildcard', 
     2353        [], 
    23092354    ); 
    23102355    $this->_getTopicList( 
    2311         [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    23122356        $this->{test_web}, 
    23132357        { 
     
    23162360            casesensitive => 0 
    23172361        }, 
    2318         'case insensitive ok* topics, using wildcard' 
     2362        'case insensitive ok* topics, using wildcard', 
     2363        [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    23192364    ); 
    23202365 
    23212366    $this->_getTopicList( 
    2322         [ 'OkBTopic', 'OkTopic' ], 
    23232367        $this->{test_web}, 
    23242368        { 
     
    23272371            casesensitive => 1 
    23282372        }, 
    2329         'case sensitive okatopic topic 2' 
     2373        'case sensitive okatopic topic 2', 
     2374        [ 'OkBTopic', 'OkTopic' ], 
    23302375    ); 
    23312376 
    23322377    $this->_getTopicList( 
    2333         [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    2334  
    23352378        $this->{test_web}, 
    23362379        { 
     
    23392382            casesensitive => 1 
    23402383        }, 
    2341         'case sensitive okatopic topic 3' 
     2384        'case sensitive okatopic topic 3', 
     2385        [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 
    23422386    ); 
    23432387 
    23442388    $this->_getTopicList( 
    2345         [ 'OkBTopic', 'OkTopic' ], 
    23462389        $this->{test_web}, 
    23472390        { 
     
    23502393            casesensitive => 0 
    23512394        }, 
    2352         'case insensitive okatopic topic' 
     2395        'case insensitive okatopic topic', 
     2396        [ 'OkBTopic', 'OkTopic' ], 
    23532397    ); 
    23542398 
     
    29733017    ); 
    29743018 
    2975     my $expected = <<'EXPECT'; 
     3019    my $expected; 
     3020    if ( $this->check_dependency('Foswiki,<,1.2') ) { 
     3021        $expected = <<'EXPECT'; 
     3022System.WebPreferences 
     3023FOOT(1,1) 
     3024Main.WebPreferences 
     3025FOOT(1,1) 
     3026Sandbox.WebPreferences 
     3027FOOT(1,1) 
     3028EXPECT 
     3029    } 
     3030    else { 
     3031        $expected = <<'EXPECT'; 
    29763032Main.WebPreferences 
    29773033FOOT(1,1) 
     
    29813037FOOT(1,1) 
    29823038EXPECT 
     3039    } 
    29833040    $expected =~ s/\n$//s; 
    29843041    $this->assert_str_equals( $expected, $result ); 
     
    45114568    ); 
    45124569 
    4513     my $expected = <<'EXPECT'; 
     4570    my $expected; 
     4571    if ( $this->check_dependency('Foswiki,<,1.2') ) { 
     4572        $expected = <<'EXPECT'; 
     4573HEADER(ntopics=0..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=0 
     4574Main.WebHome (ntopics=1..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=1 
     4575Main.WebIndex (ntopics=2..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=2 
     4576Main.WebPreferences (ntopics=3..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=3 
     4577FOOT(3,3)(ntopics=3..prev=1, 2, next=3, numberofpages=3, pagesize=5..)HEADER(ntopics=0..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=0 
     4578Sandbox.WebChanges (ntopics=1..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=1 
     4579Sandbox.WebHome (ntopics=2..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=2 
     4580FOOT(2,2)(ntopics=2..prev=1, 2, next=3, numberofpages=3, pagesize=5..) 
     4581EXPECT 
     4582    } 
     4583    else { 
     4584        $expected = <<'EXPECT'; 
    45144585HEADER(ntopics=0..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=0 
    45154586Sandbox.WebHome (ntopics=1..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=1 
     
    45214592FOOT(2,2)(ntopics=2..prev=1, 2, next=3, numberofpages=3, pagesize=5..) 
    45224593EXPECT 
     4594    } 
    45234595    $expected =~ s/\n$//s; 
    45244596    $this->assert_str_equals( $expected, $result ); 
Note: See TracChangeset for help on using the changeset viewer.