mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Variant
- ::operator_match disobeyed rc.search.case.sensitive.
This commit is contained in:
parent
ac07189941
commit
7196ac8554
4 changed files with 6 additions and 19 deletions
|
@ -640,8 +640,9 @@ void Context::staticInitialization ()
|
|||
Task::coefficients[*var] = config.getReal (*var);
|
||||
}
|
||||
|
||||
Lexer::dateFormat = config.get ("dateformat");
|
||||
Variant::dateFormat = config.get ("dateformat");
|
||||
Lexer::dateFormat = config.get ("dateformat");
|
||||
Variant::dateFormat = config.get ("dateformat");
|
||||
Variant::searchCaseSensitive = config.getBoolean ("search.case.sensitive");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <text.h>
|
||||
|
||||
std::string Variant::dateFormat = "";
|
||||
bool Variant::searchCaseSensitive = true;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Variant::Variant ()
|
||||
|
@ -753,7 +754,7 @@ bool Variant::operator_match (const Variant& other) const
|
|||
left.cast (type_string);
|
||||
right.cast (type_string);
|
||||
|
||||
RX r (right._string, true);
|
||||
RX r (right._string, searchCaseSensitive);
|
||||
return r.match (left._string);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ class Variant
|
|||
{
|
||||
public:
|
||||
static std::string dateFormat;
|
||||
static bool searchCaseSensitive;
|
||||
|
||||
enum type {type_unknown, type_boolean, type_integer, type_real, type_string,
|
||||
type_date, type_duration};
|
||||
|
|
|
@ -50,78 +50,62 @@ qx{../src/task rc:caseless.rc add one two three 2>&1};
|
|||
qx{../src/task rc:caseless.rc 1 annotate four five six 2>&1};
|
||||
|
||||
# Description substitution.
|
||||
# 2
|
||||
qx{../src/task rc:caseless.rc rc.search.case.sensitive:yes 1 modify /One/ONE/ 2>&1};
|
||||
my $output = qx{../src/task rc:caseless.rc info 1 2>&1};
|
||||
unlike ($output, qr/One two three/, 'one two three\nfour five six -> /One/ONE/ = fail');
|
||||
|
||||
# 3
|
||||
qx{../src/task rc:caseless.rc rc.search.case.sensitive:no 1 modify /One/ONE/ 2>&1};
|
||||
$output = qx{../src/task rc:caseless.rc info 1 2>&1};
|
||||
like ($output, qr/ONE two three/, 'one two three\nfour five six -> /One/ONE/ = caseless succeed');
|
||||
|
||||
# 4
|
||||
qx{../src/task rc:caseless.rc rc.search.case.sensitive:yes 1 modify /one/One/ 2>&1};
|
||||
$output = qx{../src/task rc:caseless.rc info 1 2>&1};
|
||||
unlike ($output, qr/One two three/, 'ONE two three\nfour five six -> /one/ONE/ = fail');
|
||||
|
||||
# 5
|
||||
qx{../src/task rc:caseless.rc rc.search.case.sensitive:no 1 modify /one/one/ 2>&1};
|
||||
$output = qx{../src/task rc:caseless.rc info 1 2>&1};
|
||||
like ($output, qr/one two three/, 'ONE two three\nfour five six -> /one/one/ = caseless succeed');
|
||||
|
||||
# Annotation substitution.
|
||||
# 6
|
||||
qx{../src/task rc:caseless.rc rc.search.case.sensitive:yes 1 modify /Five/FIVE/ 2>&1};
|
||||
$output = qx{../src/task rc:caseless.rc info 1 2>&1};
|
||||
unlike ($output, qr/four FIVE six/, 'one two three\nfour five six -> /Five/FIVE/ = fail');
|
||||
|
||||
# 7
|
||||
qx{../src/task rc:caseless.rc rc.search.case.sensitive:no 1 modify /Five/FIVE/ 2>&1};
|
||||
$output = qx{../src/task rc:caseless.rc info 1 2>&1};
|
||||
like ($output, qr/four FIVE six/, 'one two three\nfour five six -> /Five/FIVE/ = caseless succeed');
|
||||
|
||||
# 8
|
||||
qx{../src/task rc:caseless.rc rc.search.case.sensitive:yes 1 modify /five/Five/ 2>&1};
|
||||
$output = qx{../src/task rc:caseless.rc info 1 2>&1};
|
||||
unlike ($output, qr/four Five six/, 'one two three\nfour FIVE six -> /five/Five/ = fail');
|
||||
|
||||
# 9
|
||||
qx{../src/task rc:caseless.rc rc.search.case.sensitive:no 1 modify /five/five/ 2>&1};
|
||||
$output = qx{../src/task rc:caseless.rc info 1 2>&1};
|
||||
like ($output, qr/four five six/, 'one two three\nfour FIVE six -> /five/five/ = caseless succeed');
|
||||
|
||||
# Description filter.
|
||||
# 10
|
||||
$output = qx{../src/task rc:caseless.rc rc.search.case.sensitive:yes ls One 2>&1};
|
||||
unlike ($output, qr/one two three/, 'one two three\nfour five six -> ls One = fail');
|
||||
|
||||
# 11
|
||||
$output = qx{../src/task rc:caseless.rc rc.search.case.sensitive:no ls One 2>&1};
|
||||
like ($output, qr/one two three/, 'one two three\nfour five six -> ls One caseless = succeed');
|
||||
|
||||
# 12
|
||||
$output = qx{../src/task rc:caseless.rc rc.search.case.sensitive:yes ls Five 2>&1};
|
||||
unlike ($output, qr/four five six/, 'one two three\nfour five six -> ls Five = fail');
|
||||
|
||||
# 13
|
||||
$output = qx{../src/task rc:caseless.rc rc.search.case.sensitive:no ls Five 2>&1};
|
||||
like ($output, qr/four five six/, 'one two three\nfour five six -> ls Five caseless = succeed');
|
||||
|
||||
# Annotation filter.
|
||||
# 14
|
||||
$output = qx{../src/task rc:caseless.rc rc.search.case.sensitive:yes ls description.contains:Three 2>&1};
|
||||
unlike ($output, qr/one two three/, 'one two three\nfour five six -> ls description.contains:Three = fail');
|
||||
|
||||
# 15
|
||||
$output = qx{../src/task rc:caseless.rc rc.search.case.sensitive:no ls description.contains:Three 2>&1};
|
||||
like ($output, qr/one two three/, 'one two three\nfour five six -> ls description.contains:Three caseless = succeed');
|
||||
|
||||
# 16
|
||||
$output = qx{../src/task rc:caseless.rc rc.search.case.sensitive:yes ls description.contains:Six 2>&1};
|
||||
unlike ($output, qr/four five six/, 'one two three\nfour five six -> ls description.contains:Six = fail');
|
||||
|
||||
# 17
|
||||
$output = qx{../src/task rc:caseless.rc rc.search.case.sensitive:no ls description.contains:Six 2>&1};
|
||||
like ($output, qr/four five six/, 'one two three\nfour five six -> ls description.contains:Six caseless = succeed');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue