2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 00:52:16 +00:00
Files
build/v2/util/assert.jam
Dave Abrahams bfbb5533d9 some small progress made
[SVN r11760]
2001-11-21 04:47:44 +00:00

57 lines
1.2 KiB
Plaintext

# (C) Copyright David Abrahams 2001. 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.
import errors : error ;
rule equal ( a * : b * )
{
if $(a) != $(b)
{
error assertion failure: \"$(a)\" "!=" \"$(b)\" ;
}
}
rule result ( expected * : rule-name args * )
{
module [ CALLER_MODULE ]
{
result = [ $(rule-name) $(args) ] ;
}
if $(result) != $(expected)
{
error assertion failure: "[" $(rule-name) \"$(args)\" "]"
: expected: \"$(expected)\"
: got: \"$(result)\" ;
}
}
rule nonempty-variable ( name )
{
local empty ;
if $($(variable)) = $(empty)
{
error assertion failure: expecting non-empty variable $(variable) ;
}
}
rule true ( rule-name args * )
{
local result caller-module = [ CALLER_MODULE ] ;
module $(caller-module)
{
result = [ $(rule-name) $(args) ] ;
}
if ! $(result)
{
error assertion failure: expecting true result from
"[" $(rule-name) \"$(args)\" "]" ;
}
}