mirror of
https://github.com/boostorg/build.git
synced 2026-02-14 00:32:11 +00:00
Added internal Boost Build unit tests making sure its equality tests work as expected. Used tests to explicitly document the standard Boost Jam = && != operator behaviour with ignoring trailing empty strings.
[SVN r46262]
This commit is contained in:
@@ -244,6 +244,81 @@ rule variable-not-empty ( name )
|
||||
|
||||
rule __test__ ( )
|
||||
{
|
||||
# Helper rule used to avoid test duplication related to different list
|
||||
# equality test rules.
|
||||
#
|
||||
local rule run-equality-test ( equality-assert : ignore-trailing-empty-strings ? )
|
||||
{
|
||||
local not-equality-assert = not-$(equality-assert) ;
|
||||
|
||||
# When the given equality test is expected to ignore trailing empty
|
||||
# strings some of the test results should be inverted.
|
||||
local not-equality-assert-i = not-$(equality-assert) ;
|
||||
if $(ignore-trailing-empty-strings)
|
||||
{
|
||||
not-equality-assert-i = $(equality-assert) ;
|
||||
}
|
||||
|
||||
$(equality-assert) : ;
|
||||
$(equality-assert) "" "" : "" "" ;
|
||||
$(not-equality-assert-i) : "" "" ;
|
||||
$(equality-assert) x : x ;
|
||||
$(not-equality-assert) : x ;
|
||||
$(not-equality-assert) "" : x ;
|
||||
$(not-equality-assert) "" "" : x ;
|
||||
$(not-equality-assert-i) x : x "" ;
|
||||
$(equality-assert) x "" : x "" ;
|
||||
$(not-equality-assert) x : "" x ;
|
||||
$(equality-assert) "" x : "" x ;
|
||||
|
||||
$(equality-assert) 1 2 3 : 1 2 3 ;
|
||||
$(not-equality-assert) 1 2 3 : 3 2 1 ;
|
||||
$(not-equality-assert) 1 2 3 : 1 5 3 ;
|
||||
$(not-equality-assert) 1 2 3 : 1 "" 3 ;
|
||||
$(not-equality-assert) 1 2 3 : 1 1 2 3 ;
|
||||
$(not-equality-assert) 1 2 3 : 1 2 2 3 ;
|
||||
$(not-equality-assert) 1 2 3 : 5 6 7 ;
|
||||
|
||||
# Extra variables used here just to make sure Boost Jam or Boost Build
|
||||
# do not handle lists with empty strings differently depending on
|
||||
# whether they are literals or stored in variables.
|
||||
|
||||
local empty = ;
|
||||
local empty-strings = "" "" ;
|
||||
local x-empty-strings = x "" "" ;
|
||||
local empty-strings-x = "" "" x ;
|
||||
|
||||
$(equality-assert) : $(empty) ;
|
||||
$(not-equality-assert-i) "" : $(empty) ;
|
||||
$(not-equality-assert-i) "" "" : $(empty) ;
|
||||
$(not-equality-assert-i) : $(empty-strings) ;
|
||||
$(not-equality-assert-i) "" : $(empty-strings) ;
|
||||
$(equality-assert) "" "" : $(empty-strings) ;
|
||||
$(equality-assert) $(empty) : $(empty) ;
|
||||
$(equality-assert) $(empty-strings) : $(empty-strings) ;
|
||||
$(not-equality-assert-i) $(empty) : $(empty-strings) ;
|
||||
$(equality-assert) $(x-empty-strings) : $(x-empty-strings) ;
|
||||
$(equality-assert) $(empty-strings-x) : $(empty-strings-x) ;
|
||||
$(not-equality-assert) $(empty-strings-x) : $(x-empty-strings) ;
|
||||
$(not-equality-assert-i) x : $(x-empty-strings) ;
|
||||
$(not-equality-assert) x : $(empty-strings-x) ;
|
||||
$(not-equality-assert-i) x : $(x-empty-strings) ;
|
||||
$(not-equality-assert-i) x "" : $(x-empty-strings) ;
|
||||
$(equality-assert) x "" "" : $(x-empty-strings) ;
|
||||
$(not-equality-assert) x : $(empty-strings-x) ;
|
||||
$(not-equality-assert) "" x : $(empty-strings-x) ;
|
||||
$(equality-assert) "" "" x : $(empty-strings-x) ;
|
||||
}
|
||||
|
||||
|
||||
# ---------------
|
||||
# Equality tests.
|
||||
# ---------------
|
||||
|
||||
run-equality-test equal : ignore-trailing-empty-strings ;
|
||||
run-equality-test exact-equal ;
|
||||
|
||||
|
||||
# -------------------------
|
||||
# assert.set-equal() tests.
|
||||
# -------------------------
|
||||
|
||||
Reference in New Issue
Block a user