summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2016-04-03 03:51:55 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2016-04-03 03:51:55 (GMT)
commitaf54b28d29b7c1474ba0c35c47783b67709f2702 (patch)
treebfbcdc6f39820247a39fe6b98232e75e70c222cf /test
parentb0511d03a4939ca9dfd42e14fc39dfced6c5527c (diff)
downloadSCons-af54b28d29b7c1474ba0c35c47783b67709f2702.zip
SCons-af54b28d29b7c1474ba0c35c47783b67709f2702.tar.gz
SCons-af54b28d29b7c1474ba0c35c47783b67709f2702.tar.bz2
fix issues with bad characters and got it working on macosx
Diffstat (limited to 'test')
-rw-r--r--test/file-names.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/test/file-names.py b/test/file-names.py
index 2311f38..d9f9c63 100644
--- a/test/file-names.py
+++ b/test/file-names.py
@@ -69,6 +69,13 @@ if sys.platform == 'win32':
return c in ' .'
commandString = "copy $SOURCE $TARGET"
else:
+ invalid_chars = set(invalid_chars)
+ invalid_chars.add(chr(10))
+ invalid_chars.add(chr(13))
+ invalid_chars.add(chr(92)) # forward slash (dirsep)
+ invalid_chars.add(chr(96)) # backtick
+
+
def bad_char(c):
return c in invalid_chars
def invalid_leading_char(c):
@@ -80,13 +87,16 @@ else:
goodChars = [ chr(c) for c in range(1, 128) if not bad_char(chr(c)) ]
+def get_filename(ftype,c):
+ return ftype+"%d"%ord(c[-1])+c+ftype
+
for c in goodChars:
- test.write("in" + c + "in", contents(c))
+ test.write(get_filename("in",c), contents(c))
def create_command(a, b, c):
a = ('', 'out')[a]
b = ('', 'out')[b]
- return 'env.Command("' + a + c + b + '", "in' + c + 'in", "' + commandString + '")'
+ return 'env.Command("' + a + get_filename('',c) + b + '", "'+get_filename("in",c)+ '","' + commandString + '")'
sconstruct = [ 'import sys', 'env = Environment()' ]
for c in goodChars:
@@ -94,7 +104,7 @@ for c in goodChars:
c = '$$'
if c == '"':
c = r'\"'
- infile = "in" + c + "in"
+ infile = get_filename("in",c)
if not invalid_leading_char(c):
sconstruct.append(create_command(False, True, c))
sconstruct.append(create_command(True, True, c))
@@ -105,11 +115,14 @@ test.write('SConstruct', '\n'.join(sconstruct))
test.run(arguments = '.')
for c in goodChars:
+# print "Checking %d "%ord(c)
+
+ c_str = ("%d"%ord(c[-1]))+c
if not invalid_leading_char(c):
- test.fail_test(test.read(c + "out") != contents(c))
- test.fail_test(test.read("out" + c + "out") != contents(c))
+ test.fail_test(test.read(c_str + "out") != contents(c))
+ test.fail_test(test.read("out" + c_str + "out") != contents(c))
if not invalid_trailing_char(c):
- test.fail_test(test.read("out" + c) != contents(c))
+ test.fail_test(test.read("out" + c_str) != contents(c))
test.pass_test()