summaryrefslogtreecommitdiffstats
path: root/test/SCONSFLAGS.py
blob: 3ae3a79827f59220705de8d2d6418b9c09cfb1ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python

__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

import TestCmd
import TestSCons
import os
import string

test = TestSCons.TestSCons(match = TestCmd.match_re)

wpath = test.workpath()

test.write('SConstruct', r"""
Help("Help text.\n")
""")

expect = "Help text.\n\nUse scons -H for help about command-line options.\n"

os.environ['SCONSFLAGS'] = ''

test.run(arguments = '-h', stdout = expect)

os.environ['SCONSFLAGS'] = '-h'

test.run(stdout = expect)

test.run(arguments = "-H")

test.fail_test(string.find(test.stdout(), 'Help text.') >= 0)
test.fail_test(string.find(test.stdout(), '-H, --help-options') == -1)

os.environ['SCONSFLAGS'] = '-Z'

test.run(arguments = "-H", stderr = r"""
SCons warning: SCONSFLAGS option -Z not recognized
File "[^"]*", line \d+, in \S+
""")

test.fail_test(string.find(test.stdout(), '-H, --help-options') == -1)

test.pass_test()