Source

SCons / test / option--H.py

Diff from to

test/option--H.py

 
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
-import TestSCons
+import copy
 import string
 import sys
 
+import TestSCons
+
 test = TestSCons.TestSCons()
 
 test.write('SConstruct', "")
 test.fail_test(string.find(test.stdout(), '-H, --help-options') == -1)
 test.fail_test(string.find(test.stdout(), '--debug=TYPE') == -1)
 
+# Validate that the help output lists the options in case-insensitive
+# alphabetical order.
+lines = string.split(test.stdout(), '\n')
+lines = filter(lambda x: x[:3] == '  -', lines)
+lines = map(lambda x: x[3:], lines)
+lines = map(lambda x: x[0] == '-' and x[1:] or x, lines)
+options = map(lambda x: string.split(x)[0], lines)
+options = map(lambda x: x[-1] == ',' and x[:-1] or x, options)
+lowered = map(lambda x: string.lower(x), options)
+sorted = copy.copy(lowered)
+sorted.sort()
+test.fail_test(lowered != sorted)
+
 test.pass_test()