mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
* Common code extracted to Python directories. * Read ~/.scons file for scons environment defaults. * Override scons settings with shell environment variables. * New "tags" for debug, nodebug, optimize, nooptimize builds. * Universal platform detection. * Default value of environment variables set through prefix dictionaries. * Check for correct Boost value and fail otherwise. * Extract git describe --tags into a preprocesor variable, -DTIP_BRANCH * More colors - blue for unchanged defaults, green for changed defaults, red for error. * Contain unit tests for non-obvious stuff. * Check to see that boost libraries have been built. * Right now, we accept both .dylib and .a versions but it'd be easy to enforce .a only.
57 lines
1.5 KiB
Python
57 lines
1.5 KiB
Python
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
|
|
from unittest import TestCase
|
|
|
|
from beast.util import Dict
|
|
|
|
DICT = {
|
|
'': {
|
|
'foo': 'foo-default',
|
|
'bar': 'bar-default',
|
|
},
|
|
|
|
'Darwin': {
|
|
'foo': 'foo-darwin',
|
|
'baz': 'baz-darwin',
|
|
},
|
|
|
|
'Darwin.10.8': {
|
|
'foo': 'foo-darwin-10.8',
|
|
'bing': 'bing-darwin-10.8',
|
|
},
|
|
}
|
|
|
|
class test_Dict(TestCase):
|
|
def computeMapValue(self, config, key):
|
|
return Dict.compose(*Dict.get_items_with_prefix(config, DICT))[key]
|
|
|
|
def assertMapValue(self, config, key, result):
|
|
self.assertEquals(self.computeMapValue(config, key), result)
|
|
|
|
def testDefault1(self):
|
|
self.assertMapValue('', 'foo', 'foo-default')
|
|
|
|
def testDefault2(self):
|
|
self.assertMapValue('Darwin.10.8', 'bar', 'bar-default')
|
|
|
|
def testPrefix1(self):
|
|
self.assertMapValue('Darwin', 'foo', 'foo-darwin')
|
|
|
|
def testPrefix2(self):
|
|
self.assertMapValue('Darwin.10.8', 'foo', 'foo-darwin-10.8')
|
|
|
|
def testPrefix3(self):
|
|
self.assertMapValue('Darwin', 'baz', 'baz-darwin')
|
|
|
|
def testPrefix4(self):
|
|
self.assertMapValue('Darwin.10.8', 'bing', 'bing-darwin-10.8')
|
|
|
|
def testFailure1(self):
|
|
self.assertRaises(KeyError, self.computeMapValue, '', 'baz')
|
|
|
|
def testFailure2(self):
|
|
self.assertRaises(KeyError, self.computeMapValue, '', 'bing')
|
|
|
|
def testFailure2(self):
|
|
self.assertRaises(KeyError, self.computeMapValue, 'Darwin', 'bing')
|