it appears to me that
IF{"'SomeTextToTestFor' ~ 'Test'" ... is incorrectly returning true
similarly (and probably more fatally) IF{"'SomeTextToTestFor' ~ '*Test'" ... is incorrectly returning true
it seems that there are wildcards added to any ~ test, making it ?impossible? to test for the begining and end of a string.
as ~ '*Test*' is already able to match any occurance of Test within the test string, this is an issue that requces the functionality of query and IF.
--
TWiki:Main/SvenDowideit
- 09 Apr 2008
You are right.
Index: UnitTestContrib/test/unit/QueryTests.pm
===================================================================
--- UnitTestContrib/test/unit/QueryTests.pm (revision 16418)
+++ UnitTestContrib/test/unit/QueryTests.pm (working copy)
@@ -155,7 +155,13 @@
$this->check("string~'String '", 0);
$this->check("string='Str'", 0);
$this->check("string~'?trin?'", 1);
+ $this->check("string~'*'", 1);
$this->check("string~'*String'", 1);
+ $this->check("string~'*trin*'", 1);
+ $this->check("string~'*in?'", 1);
+ $this->check("string~'??????'", 1);
+ $this->check("string~'???????'", 0);
+ $this->check("string~'?????'", 0);
$this->check("string~' String'", 0);
$this->check("string!='Str'", 1);
$this->check("string!='String '", 1);
Index: core/lib/TWiki/Query/Node.pm
===================================================================
--- core/lib/TWiki/Query/Node.pm (revision 16587)
+++ core/lib/TWiki/Query/Node.pm (working copy)
@@ -307,7 +307,7 @@
$expr =~ s/\\\?/./g;
$expr =~ s/\\\*/.*/g;
defined($_[0]) && defined($_[1]) &&
- $_[0] =~ m/$expr/ ? 1 : 0;
+ $_[0] =~ m/^$expr$/ ? 1 : 0;
} );
}
--
CrawfordCurrie - 10 Apr 2008
Does this get checked in or???
--
TWiki:Main.KennethLavrsen
- 10 Apr 2008
Yes I will be working on these bugs soon, I wanted to confirm with Crawford (done) and give others the oportunity to comment in case changing this has some important sideeffect.
--
SvenDowideit - 10 Apr 2008