diff options
| author | Steven Knight <knight@baldmt.com> | 2004-04-03 06:23:15 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2004-04-03 06:23:15 (GMT) |
| commit | 30d6dfd79594a041ebbeaf8e77ca8407488f202e (patch) | |
| tree | 80c8e99d84d5ff5c1fbbc02a3b1538cd6e87d5bd /src/engine/SCons/ActionTests.py | |
| parent | a4262fb3471ddc34f8fe3a7f6589b66ed98bfb4e (diff) | |
| download | SCons-30d6dfd79594a041ebbeaf8e77ca8407488f202e.zip SCons-30d6dfd79594a041ebbeaf8e77ca8407488f202e.tar.gz SCons-30d6dfd79594a041ebbeaf8e77ca8407488f202e.tar.bz2 | |
Make the new --debug=presub option work for LazyCommandGenerators. (Gary Oberbrunner)
Diffstat (limited to 'src/engine/SCons/ActionTests.py')
| -rw-r--r-- | src/engine/SCons/ActionTests.py | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index e81af0f..5672dac 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -291,10 +291,11 @@ class ActionBaseTestCase(unittest.TestCase): try: a = SCons.Action.Action("x") + env = Environment() sio = StringIO.StringIO() sys.stdout = sio - a.presub("xyzzy") + a.presub("xyzzy", env) s = sio.getvalue() assert s == "", s @@ -302,10 +303,58 @@ class ActionBaseTestCase(unittest.TestCase): sio = StringIO.StringIO() sys.stdout = sio - a.presub("foobar") + a.presub("foobar", env) s = sio.getvalue() assert s == "Building foobar with action(s):\n x\n", s + a = SCons.Action.Action(["y", "z"]) + + sio = StringIO.StringIO() + sys.stdout = sio + a.presub("foobar", env) + s = sio.getvalue() + assert s == "Building foobar with action(s):\n y\n z\n", s + + def func(): + pass + a = SCons.Action.Action(func) + + sio = StringIO.StringIO() + sys.stdout = sio + a.presub("foobar", env) + s = sio.getvalue() + assert s == "Building foobar with action(s):\n func(env, target, source)\n", s + + def gen(target, source, env, for_signature): + return 'generat' + env.get('GEN', 'or') + a = SCons.Action.Action(SCons.Action.CommandGenerator(gen)) + + sio = StringIO.StringIO() + sys.stdout = sio + a.presub("foobar", env) + s = sio.getvalue() + assert s == "Building foobar with action(s):\n generator\n", s + + sio = StringIO.StringIO() + sys.stdout = sio + a.presub("foobar", Environment(GEN = 'ed')) + s = sio.getvalue() + assert s == "Building foobar with action(s):\n generated\n", s + + a = SCons.Action.Action("$ACT") + + sio = StringIO.StringIO() + sys.stdout = sio + a.presub("foobar", env) + s = sio.getvalue() + assert s == "Building foobar with action(s):\n \n", s + + sio = StringIO.StringIO() + sys.stdout = sio + a.presub("foobar", Environment(ACT = 'expanded action')) + s = sio.getvalue() + assert s == "Building foobar with action(s):\n expanded action\n", s + finally: SCons.Action.print_actions_presub = save_print_actions_presub sys.stdout = save_stdout |
