From d89697246ef32fe9b0ca71f72acd3b32d1ca3a8b Mon Sep 17 00:00:00 2001 From: SvenDowideit Date: Thu, 26 Mar 2009 04:04:16 +0000 Subject: [PATCH] Item1373: add tests for casesensitive setting - ok on 1.0 git-svn-id: http://svn.foswiki.org/branches/Release01x00@3276 0b4bb1d4-4e5a-0410-9cc4-b2b747904278 --- UnitTestContrib/test/unit/Fn_SEARCH.pm | 82 ++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/UnitTestContrib/test/unit/Fn_SEARCH.pm b/UnitTestContrib/test/unit/Fn_SEARCH.pm index 830c348a24..366bb8eef3 100644 --- a/UnitTestContrib/test/unit/Fn_SEARCH.pm +++ b/UnitTestContrib/test/unit/Fn_SEARCH.pm @@ -1154,4 +1154,86 @@ Apache is the [[http://www.apache.org/httpd/][well known web server]]. } +sub verify_casesensitivesetting { + my $this = shift; + my $session = $this->{session}; + + my $actual, my $expected; + + $actual = + $this->{twiki}->handleCommonTags( +'%SEARCH{"BLEEGLE" type="regex" multiple="on" casesensitive="on" nosearch="on" noheader="on" nototal="on" format="$topic" separator=","}%', + $this->{test_web}, $this->{test_topic} + ); + #$actual = $this->{test_topicObject}->renderTML($actual); + $expected = 'Ok+Topic,Ok-Topic,OkTopic,TestTopicSEARCH'; + $this->assert_str_equals( $expected, $actual ); + + $actual = + $this->{twiki}->handleCommonTags( +'%SEARCH{"bleegle" type="regex" multiple="on" casesensitive="on" nosearch="on" noheader="on" nototal="on" format="$topic" separator=","}%', + $this->{test_web}, $this->{test_topic} + ); + #$actual = $this->{test_topicObject}->renderTML($actual); + $expected = ''; + $this->assert_str_equals( $expected, $actual ); + + $actual = + $this->{twiki}->handleCommonTags( +'%SEARCH{"BLEEGLE" type="regex" multiple="on" casesensitive="off" nosearch="on" noheader="on" nototal="on" format="$topic" separator=","}%', + $this->{test_web}, $this->{test_topic} + ); + #$actual = $this->{test_topicObject}->renderTML($actual); + $expected = 'Ok+Topic,Ok-Topic,OkTopic,TestTopicSEARCH'; + $this->assert_str_equals( $expected, $actual ); + + $actual = + $this->{twiki}->handleCommonTags( +'%SEARCH{"bleegle" type="regex" multiple="on" casesensitive="off" nosearch="on" noheader="on" nototal="on" format="$topic" separator=","}%', + $this->{test_web}, $this->{test_topic} + ); + #$actual = $this->{test_topicObject}->renderTML($actual); + $expected = 'Ok+Topic,Ok-Topic,OkTopic,TestTopicSEARCH'; + $this->assert_str_equals( $expected, $actual ); + +#topic scope + $actual = + $this->{twiki}->handleCommonTags( +'%SEARCH{"Ok" type="regex" scope="topic" multiple="on" casesensitive="on" nosearch="on" noheader="on" nototal="on" format="$topic" separator=","}%', + $this->{test_web}, $this->{test_topic} + ); + #$actual = $this->{test_topicObject}->renderTML($actual); + $expected = 'Ok+Topic,Ok-Topic,OkTopic'; + $this->assert_str_equals( $expected, $actual ); + + $actual = + $this->{twiki}->handleCommonTags( +'%SEARCH{"ok" type="regex" scope="topic" multiple="on" casesensitive="on" nosearch="on" noheader="on" nototal="on" format="$topic" separator=","}%', + $this->{test_web}, $this->{test_topic} + ); + #$actual = $this->{test_topicObject}->renderTML($actual); + $expected = ''; + $this->assert_str_equals( $expected, $actual ); + + $actual = + $this->{twiki}->handleCommonTags( +'%SEARCH{"Ok" type="regex" scope="topic" multiple="on" casesensitive="off" nosearch="on" noheader="on" nototal="on" format="$topic" separator=","}%', + $this->{test_web}, $this->{test_topic} + ); + #$actual = $this->{test_topicObject}->renderTML($actual); + $expected = 'Ok+Topic,Ok-Topic,OkTopic'; + $this->assert_str_equals( $expected, $actual ); + + $actual = + $this->{twiki}->handleCommonTags( +'%SEARCH{"ok" type="regex" scope="topic" multiple="on" casesensitive="off" nosearch="on" noheader="on" nototal="on" format="$topic" separator=","}%', + $this->{test_web}, $this->{test_topic} + ); + #$actual = $this->{test_topicObject}->renderTML($actual); + $expected = 'Ok+Topic,Ok-Topic,OkTopic'; + $this->assert_str_equals( $expected, $actual ); + +} + + 1;