-
-
Notifications
You must be signed in to change notification settings - Fork 234
Open
Description
Recently there has been interest in line 399 of the src/tools/python.jam file, to make sure things were working as they should I took a look and got a nasty surprise, in the following Jamfile I report the test that runs the python.jam along with other instructions that demonstrate that the regex engine does not behave exactly as one would expect.
local version = "12345." ;
echo A [ MATCH "([0-9]+)\.([0-9]+)(.*)" : $(version) ] ;
echo B [ MATCH "([0-9]+\.[0-9]+)(.*)" : $(version) ] ;
echo C [ MATCH "([0-9]+)\.([0-9]*)(.*)" : $(version) ] ;
echo D [ MATCH "([0-9]+\.[0-9]*)(.*)" : $(version) ] ;
local major-minor = [ MATCH "^([0-9]+)\.([0-9]+)(.*)$" : $(version) ] ;
if ! $(major-minor[2]) || $(major-minor[3])
{
ECHO "Warning: expects a two part (major, minor) version number; got" $(version) instead ;
}
local version = "67890" ;
echo E [ MATCH "([0-9]+)\.([0-9]+)(.*)" : $(version) ] ;
echo F [ MATCH "([0-9]+\.[0-9]+)(.*)" : $(version) ] ;
echo G [ MATCH "([0-9]+)\.([0-9]*)(.*)" : $(version) ] ;
echo H [ MATCH "([0-9]+\.[0-9]*)(.*)" : $(version) ] ;
local major-minor = [ MATCH "^([0-9]+)\.([0-9]+)(.*)$" : $(version) ] ;
if ! $(major-minor[2]) || $(major-minor[3])
{
ECHO "Warning: expects a two part (major, minor) version number; got" $(version) instead ;
}
A , B, E, F, G, H cases should not give a match
# b2
A 123 5 .
B 12345 .
C 12345
D 12345.
Warning: expects a two part (major, minor) version number; got 12345. instead
E 678 0
F 67890
G 6789
H 67890
...found 1 target...regexeps deserve a few more tests
grafikrobot
Metadata
Metadata
Assignees
Labels
No labels