OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 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. |
| 6 |
| 7 """ Unit tests for the ninja.py file. """ |
| 8 |
| 9 import gyp.generator.ninja as ninja |
| 10 import unittest |
| 11 import StringIO |
| 12 import TestCommon |
| 13 |
| 14 |
| 15 class TestPrefixesAndSuffixes(unittest.TestCase): |
| 16 def test_BinaryNamesWindows(self): |
| 17 writer = ninja.NinjaWriter('wee', '.', '.', 'ninja.build', 'win') |
| 18 spec = { 'target_name': 'wee' } |
| 19 self.assertTrue(writer.ComputeOutputFileName(spec, 'executable'). |
| 20 endswith('.exe')) |
| 21 self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). |
| 22 endswith('.dll')) |
| 23 self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). |
| 24 endswith('.lib')) |
| 25 |
| 26 def test_BinaryNamesLinux(self): |
| 27 writer = ninja.NinjaWriter('wee', '.', '.', 'ninja.build', 'linux') |
| 28 spec = { |
| 29 'target_name': 'wee' |
| 30 } |
| 31 self.assertTrue('.' not in writer.ComputeOutputFileName(spec, 'executable')) |
| 32 self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). |
| 33 startswith('lib')) |
| 34 self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). |
| 35 startswith('lib')) |
| 36 self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). |
| 37 endswith('.so')) |
| 38 self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). |
| 39 endswith('.a')) |
| 40 |
| 41 if __name__ == '__main__': |
| 42 unittest.main() |
OLD | NEW |