mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 01:12:13 +00:00
Updated the generators_test.py Boost Build test to explicitly check some conditions that were before only listed in test code comments but never explicitly tested.
[SVN r78970]
This commit is contained in:
@@ -6,6 +6,17 @@
|
||||
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import BoostBuild
|
||||
import re
|
||||
|
||||
def match_count_is(lines, pattern, expected):
|
||||
count = 0
|
||||
for x in lines:
|
||||
if re.search(pattern, x):
|
||||
count += 1
|
||||
if count > expected:
|
||||
return False
|
||||
return count == expected
|
||||
|
||||
|
||||
t = BoostBuild.Tester()
|
||||
t.set_tree("generators-test")
|
||||
@@ -21,4 +32,17 @@ t.expect_addition("lib/bin/$toolset/debug/" * BoostBuild.List("c.my_obj "
|
||||
"auxilliary.my_lib"))
|
||||
t.expect_nothing_more()
|
||||
|
||||
t.expect_content_line("bin/$toolset/debug/obj_1.my_obj", "Sources: 'z.cpp'")
|
||||
t.expect_content_line("bin/$toolset/debug/obj_2.my_obj", "Sources: 'z.cpp'")
|
||||
t.expect_content_line("bin/$toolset/debug/a.my_obj", "Sources: 'a.cpp'")
|
||||
|
||||
lines = t.stdout().splitlines()
|
||||
source_lines = [x for x in lines if re.match("^ Sources: '", x)]
|
||||
if not match_count_is(source_lines, "'z.cpp'", 2):
|
||||
BoostBuild.annotation("failure", "z.cpp must be compiled exactly twice.")
|
||||
t.fail_test(1)
|
||||
if not match_count_is(source_lines, "'a.cpp'", 1):
|
||||
BoostBuild.annotation("failure", "a.cpp must be compiled exactly once.")
|
||||
t.fail_test(1)
|
||||
|
||||
t.cleanup()
|
||||
|
||||
Reference in New Issue
Block a user