diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-06-21 07:55:15 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-06-21 07:55:15 +0200 |
commit | f7e5d2b46b03cc4bc09c38f7e0873378bb9c3b78 (patch) | |
tree | 583fe67e23e2e7f8737b77d1834633086283c393 /src/engine/SCons/Platform/PlatformTests.py | |
parent | a2795b63dd02ecddd8a0109dcc1b64108f68eace (diff) |
Imported Upstream version 2.3.5upstream/2.3.5
Diffstat (limited to 'src/engine/SCons/Platform/PlatformTests.py')
-rw-r--r-- | src/engine/SCons/Platform/PlatformTests.py | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/engine/SCons/Platform/PlatformTests.py b/src/engine/SCons/Platform/PlatformTests.py index 69128b2..da7adac 100644 --- a/src/engine/SCons/Platform/PlatformTests.py +++ b/src/engine/SCons/Platform/PlatformTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Platform/PlatformTests.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Platform/PlatformTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import SCons.compat @@ -156,6 +156,37 @@ class TempFileMungeTestCase(unittest.TestCase): SCons.Action.print_actions = old_actions assert cmd != defined_cmd, cmd + def test_tempfilecreation_once(self): + # Init class with cmd, such that the fully expanded + # string reads "a test command line". + # Note, how we're using a command string here that is + # actually longer than the substituted one. This is to ensure + # that the TempFileMunge class internally really takes the + # length of the expanded string into account. + defined_cmd = "a $VERY $OVERSIMPLIFIED line" + t = SCons.Platform.TempFileMunge(defined_cmd) + env = SCons.Environment.SubstitutionEnvironment(tools=[]) + # Setting the line length high enough... + env['VERY'] = 'test' + env['OVERSIMPLIFIED'] = 'command' + expanded_cmd = env.subst(defined_cmd) + env['MAXLINELENGTH'] = len(expanded_cmd)-1 + # Disable printing of actions... + old_actions = SCons.Action.print_actions + SCons.Action.print_actions = 0 + # Create an instance of object derived class to allow setattrb + class Node(object) : + class Attrs(object): + pass + def __init__(self): + self.attributes = self.Attrs() + target = [Node()] + cmd = t(target, None, env, 0) + # ...and restoring its setting. + SCons.Action.print_actions = old_actions + assert cmd != defined_cmd, cmd + assert cmd == getattr(target[0].attributes, 'tempfile_cmdlist', None) + if __name__ == "__main__": suite = unittest.TestSuite() |