summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Platform/PlatformTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Platform/PlatformTests.py')
-rw-r--r--src/engine/SCons/Platform/PlatformTests.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/engine/SCons/Platform/PlatformTests.py b/src/engine/SCons/Platform/PlatformTests.py
index 417fad5..1a36f7a 100644
--- a/src/engine/SCons/Platform/PlatformTests.py
+++ b/src/engine/SCons/Platform/PlatformTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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 rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Platform/PlatformTests.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
import SCons.compat
@@ -187,11 +187,29 @@ class TempFileMungeTestCase(unittest.TestCase):
assert cmd != defined_cmd, cmd
assert cmd == getattr(target[0].attributes, 'tempfile_cmdlist', None)
+class PlatformEscapeTestCase(unittest.TestCase):
+ def test_posix_escape(self):
+ """ Check that paths with parens are escaped properly
+ """
+ import SCons.Platform.posix
+
+ test_string = "/my (really) great code/main.cpp"
+ output = SCons.Platform.posix.escape(test_string)
+
+ # We expect the escape function to wrap the string
+ # in quotes, but not escape any internal characters
+ # in the test_string. (Parens doesn't require shell
+ # escaping if their quoted)
+ assert output[1:-1] == test_string
+
+
if __name__ == "__main__":
suite = unittest.TestSuite()
tclasses = [ PlatformTestCase,
- TempFileMungeTestCase ]
+ TempFileMungeTestCase,
+ PlatformEscapeTestCase,
+ ]
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))