3 # Copyright (c) 2012 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 """ Unit tests for the ninja.py file. """
9 import gyp.generator.ninja as ninja
16 class TestPrefixesAndSuffixes(unittest.TestCase):
17 def test_BinaryNamesWindows(self):
18 # These cannot run on non-Windows as they require a VS installation to
19 # correctly handle variable expansion.
20 if sys.platform.startswith('win'):
21 writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'build.ninja', '.',
23 spec = { 'target_name': 'wee' }
24 self.assertTrue(writer.ComputeOutputFileName(spec, 'executable').
26 self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library').
28 self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library').
31 def test_BinaryNamesLinux(self):
32 writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'build.ninja', '.',
33 'build.ninja', 'linux')
34 spec = { 'target_name': 'wee' }
35 self.assertTrue('.' not in writer.ComputeOutputFileName(spec,
37 self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library').
39 self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library').
41 self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library').
43 self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library').
46 if __name__ == '__main__':