mirror of
https://github.com/boostorg/build.git
synced 2026-02-20 14:42:14 +00:00
Bugfix: conditionals properties was misbehaving when there were ":" in
property value. * new/property.jam (evaluate-conditionals-in-context): Don't be greedy in regex. * test/conditionals3.py: New test. [SVN r19243]
This commit is contained in:
@@ -114,7 +114,7 @@ rule evaluate-conditionals-in-context ( properties * : context * )
|
||||
for local p in $(conditionals)
|
||||
{
|
||||
# Separate condition and property
|
||||
local s = [ MATCH (.*):(.*) : $(p) ] ;
|
||||
local s = [ MATCH ([^:]*):(.*) : $(p) ] ;
|
||||
# Split condition into individual properties
|
||||
local c = [ regex.split $(s[1]) "," ] ;
|
||||
# Evaluate condition
|
||||
|
||||
34
test/conditionals3.py
Normal file
34
test/conditionals3.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and
|
||||
# distribute this software is granted provided this copyright notice appears in
|
||||
# all copies. This software is provided "as is" without express or implied
|
||||
# warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
# Test that conditional properties work, even if property is free, and
|
||||
# value includes colon.
|
||||
from BoostBuild import Tester, List
|
||||
|
||||
|
||||
t = Tester()
|
||||
|
||||
# Create the needed files
|
||||
t.write("project-root.jam", "")
|
||||
t.write("Jamfile", """
|
||||
exe hello : hello.cpp : <variant>debug:<define>CLASS=Foo::Bar ;
|
||||
""")
|
||||
t.write("hello.cpp", """
|
||||
namespace Foo { class Bar { } ; }
|
||||
int main()
|
||||
{
|
||||
CLASS c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
""")
|
||||
|
||||
# Don't check stderr, which can include warning about unused 'c'.
|
||||
t.run_build_system(stderr=None)
|
||||
t.expect_addition("bin/$toolset/debug/main-target-hello/hello")
|
||||
|
||||
t.cleanup()
|
||||
@@ -101,6 +101,7 @@ tests = [ "project_test1",
|
||||
"conditionals2",
|
||||
"property_expansion",
|
||||
"loop",
|
||||
"conditionals3",
|
||||
]
|
||||
|
||||
if os.name == 'posix':
|
||||
|
||||
@@ -114,7 +114,7 @@ rule evaluate-conditionals-in-context ( properties * : context * )
|
||||
for local p in $(conditionals)
|
||||
{
|
||||
# Separate condition and property
|
||||
local s = [ MATCH (.*):(.*) : $(p) ] ;
|
||||
local s = [ MATCH ([^:]*):(.*) : $(p) ] ;
|
||||
# Split condition into individual properties
|
||||
local c = [ regex.split $(s[1]) "," ] ;
|
||||
# Evaluate condition
|
||||
|
||||
34
v2/test/conditionals3.py
Normal file
34
v2/test/conditionals3.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and
|
||||
# distribute this software is granted provided this copyright notice appears in
|
||||
# all copies. This software is provided "as is" without express or implied
|
||||
# warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
# Test that conditional properties work, even if property is free, and
|
||||
# value includes colon.
|
||||
from BoostBuild import Tester, List
|
||||
|
||||
|
||||
t = Tester()
|
||||
|
||||
# Create the needed files
|
||||
t.write("project-root.jam", "")
|
||||
t.write("Jamfile", """
|
||||
exe hello : hello.cpp : <variant>debug:<define>CLASS=Foo::Bar ;
|
||||
""")
|
||||
t.write("hello.cpp", """
|
||||
namespace Foo { class Bar { } ; }
|
||||
int main()
|
||||
{
|
||||
CLASS c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
""")
|
||||
|
||||
# Don't check stderr, which can include warning about unused 'c'.
|
||||
t.run_build_system(stderr=None)
|
||||
t.expect_addition("bin/$toolset/debug/main-target-hello/hello")
|
||||
|
||||
t.cleanup()
|
||||
@@ -101,6 +101,7 @@ tests = [ "project_test1",
|
||||
"conditionals2",
|
||||
"property_expansion",
|
||||
"loop",
|
||||
"conditionals3",
|
||||
]
|
||||
|
||||
if os.name == 'posix':
|
||||
|
||||
Reference in New Issue
Block a user