mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-08 18:02:05 +03:00
fbcode_builder: getdeps: add platform type tuple helper
Summary: This will feed into the manifest context for system dependent manifest sections. This is essentially the same code borrowed from the watchman and eden getdeps.py. Reviewed By: simpkins Differential Revision: D14690997 fbshipit-source-id: 3d3ae146237a2cd49609aaa2bd0e785ebe21f02c
This commit is contained in:
committed by
Facebook Github Bot
parent
ade91cbac9
commit
bd620998c4
43
build/fbcode_builder/getdeps/test/platform_test.py
Normal file
43
build/fbcode_builder/getdeps/test/platform_test.py
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2019-present, Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the BSD-style license found in the
|
||||
# LICENSE file in the root directory of this source tree. An additional grant
|
||||
# of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import unittest
|
||||
|
||||
from ..platform import HostType
|
||||
|
||||
|
||||
class PlatformTest(unittest.TestCase):
|
||||
def test_create(self):
|
||||
p = HostType()
|
||||
self.assertNotEqual(p.ostype, None, msg="probed and returned something")
|
||||
|
||||
tuple_string = p.as_tuple_string()
|
||||
round_trip = HostType.from_tuple_string(tuple_string)
|
||||
self.assertEqual(round_trip, p)
|
||||
|
||||
def test_rendering_of_none(self):
|
||||
p = HostType(ostype="foo")
|
||||
self.assertEqual(p.as_tuple_string(), "foo-none-none")
|
||||
|
||||
def test_is_methods(self):
|
||||
p = HostType(ostype="windows")
|
||||
self.assertTrue(p.is_windows())
|
||||
self.assertFalse(p.is_darwin())
|
||||
self.assertFalse(p.is_linux())
|
||||
|
||||
p = HostType(ostype="darwin")
|
||||
self.assertFalse(p.is_windows())
|
||||
self.assertTrue(p.is_darwin())
|
||||
self.assertFalse(p.is_linux())
|
||||
|
||||
p = HostType(ostype="linux")
|
||||
self.assertFalse(p.is_windows())
|
||||
self.assertFalse(p.is_darwin())
|
||||
self.assertTrue(p.is_linux())
|
Reference in New Issue
Block a user