Changeset 13833
- Timestamp:
- 01/27/12 04:41:30 (4 weeks ago)
- File:
-
- 1 edited
-
trunk/UnitTestContrib/test/unit/Fn_SEARCH.pm (modified) (28 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/UnitTestContrib/test/unit/Fn_SEARCH.pm
r13791 r13833 440 440 }%' 441 441 ); 442 my $expected = <<'EXPECT'; 442 my $expected; 443 if ( $this->check_dependency('Foswiki,<,1.2') ) { 444 $expected = <<'EXPECT'; 445 System.WebHome 446 System.WebPreferences 447 System.WebSearch 448 Main.WebHome 449 Main.WebPreferences 450 Main.WebSearch 451 Sandbox.WebHome 452 Sandbox.WebPreferences 453 Sandbox.WebSearch 454 EXPECT 455 } 456 else { 457 $expected = <<'EXPECT'; 443 458 Main.WebHome 444 459 Main.WebPreferences … … 451 466 System.WebSearch 452 467 EXPECT 468 } 453 469 $expected =~ s/\n$//s; 454 470 $this->assert_str_equals( $expected, $result ); … … 469 485 }%' 470 486 ); 471 my $expected = <<'EXPECT'; 487 my $expected; 488 if ( $this->check_dependency('Foswiki,<,1.2') ) { 489 $expected = <<'EXPECT'; 490 System.WebHome 491 System.WebPreferences 492 System.WebSearch 493 Main.WebHome 494 Main.WebPreferences 495 Main.WebSearch 496 Sandbox.WebHome 497 Sandbox.WebPreferences 498 Sandbox.WebSearch 499 EXPECT 500 } 501 else { 502 $expected = <<'EXPECT'; 472 503 Main.WebHome 473 504 Main.WebPreferences … … 480 511 System.WebSearch 481 512 EXPECT 513 } 482 514 $expected =~ s/\n$//s; 483 515 $this->assert_str_equals( $expected, $result ); … … 2099 2131 2100 2132 sub _getTopicList { 2101 my ( $this, $expected, $web, $options, $sadness ) = @_; 2133 my ( $this, $web, $options, $sadness, $default_expected, %expected_list ) = 2134 @_; 2135 my $expected; 2102 2136 2103 2137 # my $options = { … … 2108 2142 # }; 2109 2143 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 } 2110 2153 my $webObject = Foswiki::Meta->new( $this->{session}, $web ); 2111 2154 … … 2134 2177 #no topics specified.. 2135 2178 $this->_getTopicList( 2179 $this->{test_web}, 2180 {}, 2181 'no filters, all topics in test_web', 2136 2182 [ 2137 2183 'OkATopic', 'OkBTopic', … … 2139 2185 'WebPreferences' 2140 2186 ], 2141 $this->{test_web}, 2187 ); 2188 $this->_getTopicList( 2189 '_default', 2142 2190 {}, 2143 'no filters, all topics in test_web' 2144 ); 2145 $this->_getTopicList( 2191 'no filters, all topics in test_web', 2146 2192 [ 2147 2193 'WebAtom', 'WebChanges', … … 2152 2198 'WebSearchAdvanced', 'WebTopicList' 2153 2199 ], 2154 '_default',2155 {},2156 'no filters, all topics in test_web'2157 2200 ); 2158 2201 2159 2202 #use wildcards 2160 2203 $this->_getTopicList( 2161 [ 'OkATopic', 'OkBTopic', 'OkTopic' ],2162 2204 $this->{test_web}, 2163 2205 { includeTopics => 'Ok*' }, 2164 'comma separated list' 2206 'comma separated list', 2207 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 2165 2208 ); 2166 2209 $this->_getTopicList( 2210 '_default', 2211 { includeTopics => 'Web*' }, 2212 'no filters, all topics in test_web', 2167 2213 [ 2168 2214 'WebAtom', 'WebChanges', … … 2173 2219 'WebSearchAdvanced', 'WebTopicList' 2174 2220 ], 2175 '_default',2176 { includeTopics => 'Web*' },2177 'no filters, all topics in test_web'2178 2221 ); 2179 2222 2180 2223 #comma separated list specifed for inclusion 2181 2224 $this->_getTopicList( 2182 [ 'OkTopic', 'TestTopicSEARCH' ],2183 2225 $this->{test_web}, 2184 2226 { includeTopics => 'TestTopicSEARCH,OkTopic,NoSuchTopic' }, 2185 'comma separated list' 2227 'comma separated list', 2228 [ 'OkTopic', 'TestTopicSEARCH' ], 2229 'Foswiki,<,1.2' => [ 'TestTopicSEARCH', 'OkTopic' ], 2186 2230 ); 2187 2231 $this->_getTopicList( 2188 [ 'WebCreateNewTopic', 'WebTopicList' ],2189 2232 '_default', 2190 2233 { 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' ], 2192 2237 ); 2193 2238 2194 2239 #excludes 2195 2240 $this->_getTopicList( 2196 [ 'OkATopic', 'OkTopic', 'TestTopicSEARCH', 'WebPreferences' ],2197 2241 $this->{test_web}, 2198 2242 { excludeTopics => 'NoSuchTopic,OkBTopic' }, 2199 'no filters, all topics in test_web' 2243 'no filters, all topics in test_web', 2244 [ 'OkATopic', 'OkTopic', 'TestTopicSEARCH', 'WebPreferences' ], 2200 2245 ); 2201 2246 $this->_getTopicList( 2247 '_default', 2248 { excludeTopics => 'WebSearch' }, 2249 'no filters, all topics in test_web', 2202 2250 [ 2203 2251 'WebAtom', 'WebChanges', … … 2208 2256 'WebTopicList' 2209 2257 ], 2210 '_default',2211 { excludeTopics => 'WebSearch' },2212 'no filters, all topics in test_web'2213 2258 ); 2214 2259 2215 2260 #Talk about missing alot of tests 2216 2261 $this->_getTopicList( 2262 $this->{test_web}, 2263 { includeTopics => '*' }, 2264 'all topics, using wildcard', 2217 2265 [ 2218 2266 'OkATopic', 'OkBTopic', … … 2220 2268 'WebPreferences' 2221 2269 ], 2222 $this->{test_web},2223 { includeTopics => '*' },2224 'all topics, using wildcard'2225 2270 ); 2226 2271 $this->_getTopicList( 2227 [ 'OkATopic', 'OkBTopic', 'OkTopic' ],2228 2272 $this->{test_web}, 2229 2273 { includeTopics => 'Ok*' }, 2230 'Ok* topics, using wildcard' 2274 'Ok* topics, using wildcard', 2275 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 2231 2276 ); 2232 2277 $this->_getTopicList( 2233 [],2234 2278 $this->{test_web}, 2235 2279 { … … 2237 2281 casesensitive => 1 2238 2282 }, 2239 'case sensitive ok* topics, using wildcard' 2283 'case sensitive ok* topics, using wildcard', 2284 [], 2240 2285 ); 2241 2286 $this->_getTopicList( 2242 [ 'OkATopic', 'OkBTopic', 'OkTopic' ],2243 2287 $this->{test_web}, 2244 2288 { … … 2246 2290 casesensitive => 0 2247 2291 }, 2248 'case insensitive ok* topics, using wildcard' 2292 'case insensitive ok* topics, using wildcard', 2293 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 2249 2294 ); 2250 2295 … … 2256 2301 # this test won't work on Mac OS X or windows. 2257 2302 $this->_getTopicList( 2258 [],2259 2303 $this->{test_web}, 2260 2304 { … … 2262 2306 casesensitive => 1 2263 2307 }, 2264 'case sensitive okatopic topic 1' 2308 'case sensitive okatopic topic 1', 2309 [], 2265 2310 ); 2266 2311 } 2267 2312 2268 2313 $this->_getTopicList( 2269 ['OkATopic'],2270 2314 $this->{test_web}, 2271 2315 { … … 2273 2317 casesensitive => 0 2274 2318 }, 2275 'case insensitive okatopic topic' 2319 'case insensitive okatopic topic', 2320 ['OkATopic'], 2276 2321 ); 2277 2322 ##### same again, with excludes. 2278 2323 $this->_getTopicList( 2324 $this->{test_web}, 2325 { 2326 includeTopics => '*', 2327 excludeTopics => 'web*' 2328 }, 2329 'all topics, using wildcard', 2279 2330 [ 2280 2331 'OkATopic', 'OkBTopic', … … 2282 2333 'WebPreferences' 2283 2334 ], 2284 $this->{test_web},2285 {2286 includeTopics => '*',2287 excludeTopics => 'web*'2288 },2289 'all topics, using wildcard'2290 2335 ); 2291 2336 $this->_getTopicList( 2292 [ 'OkATopic', 'OkBTopic', 'OkTopic' ],2293 2337 $this->{test_web}, 2294 2338 { … … 2296 2340 excludeTopics => 'okatopic' 2297 2341 }, 2298 'Ok* topics, using wildcard' 2342 'Ok* topics, using wildcard', 2343 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 2299 2344 ); 2300 2345 $this->_getTopicList( 2301 [],2302 2346 $this->{test_web}, 2303 2347 { … … 2306 2350 casesensitive => 1 2307 2351 }, 2308 'case sensitive ok* topics, using wildcard' 2352 'case sensitive ok* topics, using wildcard', 2353 [], 2309 2354 ); 2310 2355 $this->_getTopicList( 2311 [ 'OkATopic', 'OkBTopic', 'OkTopic' ],2312 2356 $this->{test_web}, 2313 2357 { … … 2316 2360 casesensitive => 0 2317 2361 }, 2318 'case insensitive ok* topics, using wildcard' 2362 'case insensitive ok* topics, using wildcard', 2363 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 2319 2364 ); 2320 2365 2321 2366 $this->_getTopicList( 2322 [ 'OkBTopic', 'OkTopic' ],2323 2367 $this->{test_web}, 2324 2368 { … … 2327 2371 casesensitive => 1 2328 2372 }, 2329 'case sensitive okatopic topic 2' 2373 'case sensitive okatopic topic 2', 2374 [ 'OkBTopic', 'OkTopic' ], 2330 2375 ); 2331 2376 2332 2377 $this->_getTopicList( 2333 [ 'OkATopic', 'OkBTopic', 'OkTopic' ],2334 2335 2378 $this->{test_web}, 2336 2379 { … … 2339 2382 casesensitive => 1 2340 2383 }, 2341 'case sensitive okatopic topic 3' 2384 'case sensitive okatopic topic 3', 2385 [ 'OkATopic', 'OkBTopic', 'OkTopic' ], 2342 2386 ); 2343 2387 2344 2388 $this->_getTopicList( 2345 [ 'OkBTopic', 'OkTopic' ],2346 2389 $this->{test_web}, 2347 2390 { … … 2350 2393 casesensitive => 0 2351 2394 }, 2352 'case insensitive okatopic topic' 2395 'case insensitive okatopic topic', 2396 [ 'OkBTopic', 'OkTopic' ], 2353 2397 ); 2354 2398 … … 2973 3017 ); 2974 3018 2975 my $expected = <<'EXPECT'; 3019 my $expected; 3020 if ( $this->check_dependency('Foswiki,<,1.2') ) { 3021 $expected = <<'EXPECT'; 3022 System.WebPreferences 3023 FOOT(1,1) 3024 Main.WebPreferences 3025 FOOT(1,1) 3026 Sandbox.WebPreferences 3027 FOOT(1,1) 3028 EXPECT 3029 } 3030 else { 3031 $expected = <<'EXPECT'; 2976 3032 Main.WebPreferences 2977 3033 FOOT(1,1) … … 2981 3037 FOOT(1,1) 2982 3038 EXPECT 3039 } 2983 3040 $expected =~ s/\n$//s; 2984 3041 $this->assert_str_equals( $expected, $result ); … … 4511 4568 ); 4512 4569 4513 my $expected = <<'EXPECT'; 4570 my $expected; 4571 if ( $this->check_dependency('Foswiki,<,1.2') ) { 4572 $expected = <<'EXPECT'; 4573 HEADER(ntopics=0..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=0 4574 Main.WebHome (ntopics=1..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=1 4575 Main.WebIndex (ntopics=2..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=2 4576 Main.WebPreferences (ntopics=3..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=3 4577 FOOT(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 4578 Sandbox.WebChanges (ntopics=1..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=1 4579 Sandbox.WebHome (ntopics=2..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=2 4580 FOOT(2,2)(ntopics=2..prev=1, 2, next=3, numberofpages=3, pagesize=5..) 4581 EXPECT 4582 } 4583 else { 4584 $expected = <<'EXPECT'; 4514 4585 HEADER(ntopics=0..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=0 4515 4586 Sandbox.WebHome (ntopics=1..prev=1, 2, next=3, numberofpages=3, pagesize=5..)ntopics=1 … … 4521 4592 FOOT(2,2)(ntopics=2..prev=1, 2, next=3, numberofpages=3, pagesize=5..) 4522 4593 EXPECT 4594 } 4523 4595 $expected =~ s/\n$//s; 4524 4596 $this->assert_str_equals( $expected, $result );
Note: See TracChangeset
for help on using the changeset viewer.
