feature.enableIn(self.config)
self.assertIn('name', self.config.available_features)
+ def test_name_is_not_a_string_1(self):
+ feature = dsl.Feature(name=None)
+ assert feature.isSupported(self.config)
+ self.assertRaises(ValueError, lambda: feature.enableIn(self.config))
+
+ def test_name_is_not_a_string_2(self):
+ feature = dsl.Feature(name=lambda cfg: None)
+ assert feature.isSupported(self.config)
+ self.assertRaises(ValueError, lambda: feature.enableIn(self.config))
+
def test_adding_compile_flag(self):
feature = dsl.Feature(name='name', compileFlag='-foo')
origLinkFlags = copy.deepcopy(self.getSubstitution('%{link_flags}'))
config.substitutions = addTo(config.substitutions, '%{link_flags}', linkFlag)
name = self._name(config) if callable(self._name) else self._name
+ if not isinstance(name, str):
+ raise ValueError("Feature did not resolve to a name that's a string, got {}".format(name))
config.available_features.add(name)