Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80088 - trunk/tools/build/v2/test
From: jurko.gospodnetic_at_[hidden]
Date: 2012-08-20 06:08:31


Author: jurko
Date: 2012-08-20 06:08:28 EDT (Mon, 20 Aug 2012)
New Revision: 80088
URL: http://svn.boost.org/trac/boost/changeset/80088

Log:
Internal Boost Build testing framework cleanup - expecting output/content lines now correctly interprets requests with lines given as a container of strings.

Given strings represent expected continuous line sequences (separated by \n) and extra lines are allowed between content represented by different successive strings. For example, lines = ['foo\nbar', 'baz'] would match:
  aaa
  foo
  bar
  bbb
  baz
  ccc
but would not match:
  aaa
  foo
  xxx
  bar
  bbb
  baz
  ccc

Added a description comment for the related Tester.__expect_lines() implementation function.
Text files modified:
   trunk/tools/build/v2/test/BoostBuild.py | 27 ++++++++++++++++++++++++---
   1 files changed, 24 insertions(+), 3 deletions(-)

Modified: trunk/tools/build/v2/test/BoostBuild.py
==============================================================================
--- trunk/tools/build/v2/test/BoostBuild.py (original)
+++ trunk/tools/build/v2/test/BoostBuild.py 2012-08-20 06:08:28 EDT (Mon, 20 Aug 2012)
@@ -889,6 +889,28 @@
             self.__wait_for_time_change(path, touch=True, last_build_time=True)
 
     def __expect_lines(self, data, lines, expected):
+ """
+ Checks whether the given data contains the given lines.
+
+ Data may be specified as a single string containing text lines
+ separated by newline characters.
+
+ Lines may be specified in any of the following forms:
+ * Single string containing text lines separated by newlines - the
+ given lines are searched for in the given data without any extra
+ data lines between them.
+ * Container of strings containing text lines separated by newlines
+ - the given lines are searched for in the given data with extra
+ data lines allowed between lines belonging to different strings.
+ * Container of strings containing text lines separated by newlines
+ and containers containing strings - the same as above with the
+ internal containers containing strings being interpreted as if
+ all their content was joined together into a single string
+ separated by newlines.
+
+ A newline at the end of any multi-line lines string is interpreted as
+ an expected extra trailig empty line.
+ """
         # str.splitlines() trims at most one trailing newline while we want the
         # trailing newline to indicate that there should be an extra empty line
         # at the end.
@@ -905,9 +927,8 @@
             expanded = []
             for x in lines:
                 if x.__class__ is str:
- expanded.extend(splitlines(x))
- else:
- expanded.append(x)
+ x = splitlines(x)
+ expanded.append(x)
             lines = expanded
 
         if _contains_lines(data, lines) != bool(expected):


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk