mirror of
https://github.com/boostorg/build.git
synced 2026-02-17 01:32:12 +00:00
Added a new utility.unquote() rule to the Boost Build util/utility.jam module. Tests included. This is part of cleaning up some command line parsing where on some OS's quotes are stripped by the OS and on some they are not.
[SVN r48500]
This commit is contained in:
@@ -124,6 +124,23 @@ rule ungrist ( names * )
|
||||
}
|
||||
|
||||
|
||||
# If the passed value is quoted, unquotes it. Otherwise returns the value
|
||||
# unchanged.
|
||||
#
|
||||
rule unquote ( value ? )
|
||||
{
|
||||
local match-result = [ MATCH ^(\")(.*)(\")$ : $(value) ] ;
|
||||
if $(match-result)
|
||||
{
|
||||
return $(match-result[2]) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $(value) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rule __test__ ( )
|
||||
{
|
||||
import assert ;
|
||||
@@ -155,6 +172,14 @@ rule __test__ ( )
|
||||
assert.result foo : basename foo.so ;
|
||||
assert.result foo.so : basename foo.so.1 ;
|
||||
|
||||
assert.result : unquote ;
|
||||
assert.result "" : unquote "" ;
|
||||
assert.result foo : unquote foo ;
|
||||
assert.result \"foo : unquote \"foo ;
|
||||
assert.result foo\" : unquote foo\" ;
|
||||
assert.result foo : unquote \"foo\" ;
|
||||
assert.result \"foo\" : unquote \"\"foo\"\" ;
|
||||
|
||||
assert.result : ungrist ;
|
||||
assert.result foo : ungrist <foo> ;
|
||||
assert.result <foo> : ungrist <<foo>> ;
|
||||
|
||||
Reference in New Issue
Block a user