Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78669 - trunk/tools/build/v2/test
From: jurko.gospodnetic_at_[hidden]
Date: 2012-05-26 19:27:34


Author: jurko
Date: 2012-05-26 19:27:33 EDT (Sat, 26 May 2012)
New Revision: 78669
URL: http://svn.boost.org/trac/boost/changeset/78669

Log:
Added a new Boost Build unit test exercising the SPLIT_BY_CHARACTERS built-in rule.
Added:
   trunk/tools/build/v2/test/builtin_split_by_characters.py (contents, props changed)
Text files modified:
   trunk/tools/build/v2/test/test_all.py | 1 +
   1 files changed, 1 insertions(+), 0 deletions(-)

Added: trunk/tools/build/v2/test/builtin_split_by_characters.py
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/builtin_split_by_characters.py 2012-05-26 19:27:33 EDT (Sat, 26 May 2012)
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+
+# Copyright 2012. Jurko Gospodnetic
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+# This tests the SPLIT_BY_CHARACTERS rule.
+
+import BoostBuild
+
+def test_invalid(params, expected_error_line):
+ t = BoostBuild.Tester(pass_toolset=0)
+ t.write("file.jam", "SPLIT_BY_CHARACTERS %s ;\n" % params)
+ t.run_build_system("-ffile.jam", status=1)
+ t.expect_output_line("[*] %s" % expected_error_line)
+ t.cleanup()
+
+def test_valid():
+ t = BoostBuild.Tester(pass_toolset=0)
+ t.write("jamroot.jam",
+"""import assert ;
+
+assert.result FooBarBaz : SPLIT_BY_CHARACTERS FooBarBaz : "" ;
+assert.result FooBarBaz : SPLIT_BY_CHARACTERS FooBarBaz : x ;
+assert.result FooBa Baz : SPLIT_BY_CHARACTERS FooBarBaz : r ;
+assert.result FooBa Baz : SPLIT_BY_CHARACTERS FooBarBaz : rr ;
+assert.result FooBa Baz : SPLIT_BY_CHARACTERS FooBarBaz : rrr ;
+assert.result FooB rB z : SPLIT_BY_CHARACTERS FooBarBaz : a ;
+assert.result FooB B z : SPLIT_BY_CHARACTERS FooBarBaz : ar ;
+assert.result ooBarBaz : SPLIT_BY_CHARACTERS FooBarBaz : F ;
+assert.result FooBarBa : SPLIT_BY_CHARACTERS FooBarBaz : z ;
+assert.result ooBarBa : SPLIT_BY_CHARACTERS FooBarBaz : Fz ;
+assert.result F B rB z : SPLIT_BY_CHARACTERS FooBarBaz : oa ;
+assert.result Alib b : SPLIT_BY_CHARACTERS Alibaba : oa ;
+assert.result libaba : SPLIT_BY_CHARACTERS Alibaba : oA ;
+assert.result : SPLIT_BY_CHARACTERS FooBarBaz : FooBarBaz ;
+assert.result : SPLIT_BY_CHARACTERS FooBarBaz : FoBarz ;
+
+# Questionable results - should they return an empty string or an empty list?
+assert.result : SPLIT_BY_CHARACTERS "" : "" ;
+assert.result : SPLIT_BY_CHARACTERS "" : x ;
+assert.result : SPLIT_BY_CHARACTERS "" : r ;
+assert.result : SPLIT_BY_CHARACTERS "" : rr ;
+assert.result : SPLIT_BY_CHARACTERS "" : rrr ;
+assert.result : SPLIT_BY_CHARACTERS "" : oa ;
+""")
+ t.run_build_system()
+ t.cleanup()
+
+test_invalid("", "missing argument string")
+test_invalid("Foo", "missing argument delimiters")
+test_invalid(": Bar", "missing argument string")
+test_invalid("a : b : c", "extra argument c")
+test_invalid("a b : c", "extra argument b")
+test_invalid("a : b c", "extra argument c")
+test_valid()

Modified: trunk/tools/build/v2/test/test_all.py
==============================================================================
--- trunk/tools/build/v2/test/test_all.py (original)
+++ trunk/tools/build/v2/test/test_all.py 2012-05-26 19:27:33 EDT (Sat, 26 May 2012)
@@ -132,6 +132,7 @@
           "build_no",
           "builtin_echo",
           "builtin_exit",
+ "builtin_split_by_characters",
           "c_file",
           "chain",
           "clean",


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