5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Test that we can generate Visual Studio 8.0 project (.vcproj) and
29 solution (.sln) files that look correct.
36 test = TestSConsMSVS.TestSConsMSVS()
38 # Make the test infrastructure think we have this version of MSVS installed.
39 test._msvs_versions = ['8.0']
43 expected_slnfile = TestSConsMSVS.expected_slnfile_8_0
44 expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_8_0
45 SConscript_contents = TestSConsMSVS.SConscript_contents_8_0
49 test.write('SConstruct', SConscript_contents)
51 test.run(arguments="Test.vcproj")
53 test.must_exist(test.workpath('Test.vcproj'))
54 vcproj = test.read('Test.vcproj', 'r')
55 expect = test.msvs_substitute(expected_vcprojfile, '8.0', None, 'SConstruct')
56 # don't compare the pickled data
57 assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
59 test.must_exist(test.workpath('Test.sln'))
60 sln = test.read('Test.sln', 'r')
61 expect = test.msvs_substitute(expected_slnfile, '8.0', None, 'SConstruct')
62 # don't compare the pickled data
63 assert sln[:len(expect)] == expect, test.diff_substr(expect, sln)
65 test.run(arguments='-c .')
67 test.must_not_exist(test.workpath('Test.vcproj'))
68 test.must_not_exist(test.workpath('Test.sln'))
70 test.run(arguments='Test.vcproj')
72 test.must_exist(test.workpath('Test.vcproj'))
73 test.must_exist(test.workpath('Test.sln'))
75 test.run(arguments='-c Test.sln')
77 test.must_not_exist(test.workpath('Test.vcproj'))
78 test.must_not_exist(test.workpath('Test.sln'))
82 # Test that running SCons with $PYTHON_ROOT in the environment
83 # changes the .vcproj output as expected.
84 os.environ['PYTHON_ROOT'] = 'xyzzy'
85 python = os.path.join('$(PYTHON_ROOT)', os.path.split(TestSConsMSVS.python)[1])
87 test.run(arguments='Test.vcproj')
89 test.must_exist(test.workpath('Test.vcproj'))
90 vcproj = test.read('Test.vcproj', 'r')
91 expect = test.msvs_substitute(expected_vcprojfile, '8.0', None, 'SConstruct',
93 # don't compare the pickled data
94 assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
102 # indent-tabs-mode:nil
104 # vim: set expandtab tabstop=4 shiftwidth=4: