From 35a6629761e0959239ab0e9bb608db46b97b6bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Sat, 16 Jun 2012 02:45:09 +0000 Subject: [PATCH] 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] --- v2/test/generators_test.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/v2/test/generators_test.py b/v2/test/generators_test.py index ce734da84..0f3f1daed 100644 --- a/v2/test/generators_test.py +++ b/v2/test/generators_test.py @@ -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()