2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-12 12:02:24 +00:00

tests for local rules and backtraces

[SVN r11761]
This commit is contained in:
Dave Abrahams
2001-11-21 04:48:41 +00:00
parent bc99a39bf0
commit b326d85682

View File

@@ -107,8 +107,16 @@ rule identity ( list * )
rule shift1 ( dummy ) { }
rule my_module.not_really ( ) { return something ; }
IMPORT my_module : : identity : id ;
module my_module
{
# assert-equal operates in its own module, so call id in here and use
# identity later.
local f = [ id x y z ] ;
assert-equal x y z : identity $(f) ;
module local w y ;
module local x2 x3 z = 1 2 3 ;
@@ -133,8 +141,12 @@ rule identity ( list * )
{
return $($(symbol)) ;
}
local rule not_really ( ) { return nothing ; }
}
# show that not_really was actually a local definition
assert-equal something : my_module.not_really ;
my_module.shift1 ;
y = $(y[2-]) ;
assert-equal $(x) : identity $(y) ;
@@ -175,18 +187,22 @@ rule identity ( list * )
shift2 ;
y = $(y[2-]) ;
assert-equal $(x) : identity $(y) ;
IMPORT my_module : : identity : id ;
module my_module {
local f = [ id x y z ] ;
assert-equal $(f) : x y z ;
}
}
#
# test CALLER_MODULE
# test CALLER_MODULE and backtrace
#
{
rule backtrace ( )
{
local bt = [ BACKTRACE ] ;
bt = $(bt[5-]) ;
while $(bt)
{
ECHO $(bt[1]):$(bt[2]): "in" $(bt[4]) ;
bt = $(bt[5-]) ;
}
}
module module1
{
rule f ( )
@@ -203,6 +219,7 @@ rule identity ( list * )
{
local m = [ CALLER_MODULE ] ;
assert-equal module1 : identity $(m) ;
backtrace ;
}
}
module1.f ;