Lines 187-193
subtest '_split_query() tests' => sub {
Link Here
|
187 |
}; |
187 |
}; |
188 |
|
188 |
|
189 |
subtest '_clean_search_term() tests' => sub { |
189 |
subtest '_clean_search_term() tests' => sub { |
190 |
plan tests => 12; |
190 |
plan tests => 13; |
191 |
|
191 |
|
192 |
my $qb; |
192 |
my $qb; |
193 |
ok( |
193 |
ok( |
Lines 216-226
subtest '_clean_search_term() tests' => sub {
Link Here
|
216 |
$res = $qb->_clean_search_term('test "another : query"'); |
216 |
$res = $qb->_clean_search_term('test "another : query"'); |
217 |
is($res, 'test "another : query"', 'quoted dangling colon not removed'); |
217 |
is($res, 'test "another : query"', 'quoted dangling colon not removed'); |
218 |
|
218 |
|
219 |
$res = $qb->_clean_search_term('test {another part}'); |
219 |
$res = $qb->_clean_search_term('test [123 TO 345]'); |
220 |
is($res, 'test "another part"', 'curly brackets replaced correctly'); |
220 |
is($res, 'test [123 TO 345]', 'keep inculsive range untouched'); |
|
|
221 |
|
222 |
$res = $qb->_clean_search_term('test [test TO TEST} [and] {123 TO 456]'); |
223 |
is($res, 'test [test TO TEST} \[and\] {123 TO 456]', 'keep exclusive range untouched'); |
221 |
|
224 |
|
222 |
$res = $qb->_clean_search_term('test {another part'); |
225 |
$res = $qb->_clean_search_term('test[]test TO TEST] [ {123 to 345}}'); |
223 |
is($res, 'test another part', 'unbalanced curly brackets replaced correctly'); |
226 |
is($res, 'test\[\]test TO TEST\] \[ \{123 to 345\}\}', 'screen all square and curly brackets'); |
224 |
|
227 |
|
225 |
$res = $qb->_clean_search_term('ti:test AND kw:test'); |
228 |
$res = $qb->_clean_search_term('ti:test AND kw:test'); |
226 |
is($res, 'title:test AND test', 'ti converted to title, kw converted to empty string, dangling colon removed with space preserved'); |
229 |
is($res, 'title:test AND test', 'ti converted to title, kw converted to empty string, dangling colon removed with space preserved'); |
227 |
- |
|
|