def test_actions_can_be_a_callable(self): feature = dsl.Feature(name='name', actions=lambda cfg: (self.assertIs(self.config, cfg), [dsl.AddCompileFlag('-std=c++03')])[1]) for a in feature.getActions(self.config): a.applyTo(self.config) self.assertIn('-std=c++03', self.getSubstitution('%{compile_flags}'))
def test_adding_action(self): feature = dsl.Feature(name='name', actions=[dsl.AddCompileFlag('-std=c++03')]) origLinkFlags = copy.deepcopy(self.getSubstitution('%{link_flags}')) for a in feature.getActions(self.config): a.applyTo(self.config) self.assertIn('name', self.config.available_features) self.assertIn('-std=c++03', self.getSubstitution('%{compile_flags}')) self.assertEqual(origLinkFlags, self.getSubstitution('%{link_flags}'))