Index: pylib/gyp/common_test.py |
diff --git a/pylib/gyp/common_test.py b/pylib/gyp/common_test.py |
index aabaf344b057f720ff0ae55d6fcd30b2717f128a..dac29692b8640765cb7680d4cb95a94e51734a5f 100755 |
--- a/pylib/gyp/common_test.py |
+++ b/pylib/gyp/common_test.py |
@@ -8,6 +8,7 @@ |
import gyp.common |
import unittest |
+import sys |
class TestTopologicallySorted(unittest.TestCase): |
@@ -40,5 +41,31 @@ class TestTopologicallySorted(unittest.TestCase): |
graph.keys(), GetEdge) |
+class TestGetFlavor(unittest.TestCase): |
+ """Test that gyp.common.GetFlavor works as intended""" |
+ original_platform = '' |
+ |
+ def setUp(self): |
+ self.original_platform = sys.platform |
+ |
+ def tearDown(self): |
+ sys.platform = self.original_platform |
+ |
+ def assertFlavor(self, expected, argument, param): |
+ sys.platform = argument |
+ self.assertEqual(expected, gyp.common.GetFlavor(param)) |
+ |
+ def test_platform_default(self): |
+ self.assertFlavor('freebsd', 'freebsd9' , {}) |
+ self.assertFlavor('freebsd', 'freebsd10', {}) |
+ self.assertFlavor('solaris', 'sunos5' , {}); |
+ self.assertFlavor('solaris', 'sunos' , {}); |
+ self.assertFlavor('linux' , 'linux2' , {}); |
+ self.assertFlavor('linux' , 'linux3' , {}); |
+ |
+ def test_param(self): |
+ self.assertFlavor('foobar', 'linux2' , {'flavor': 'foobar'}) |
+ |
+ |
if __name__ == '__main__': |
unittest.main() |