diff options
Diffstat (limited to 'morphlib/morph2_tests.py')
-rw-r--r-- | morphlib/morph2_tests.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py index 1a0b4822..9de23e56 100644 --- a/morphlib/morph2_tests.py +++ b/morphlib/morph2_tests.py @@ -344,3 +344,38 @@ class MorphologyTests(unittest.TestCase): dummy = Morphology(self.stratum_text) output_dict = dummy._apply_changes(live_dict, original_dict) self.assertEqual(original_dict, output_dict) + + def test_uses_morphology_commands_when_given(self): + m = Morphology(''' + { + 'name': 'foo', + 'kind': 'chunk', + 'build-system': 'dummy', + 'build-commands': ['build-it'] + } + ''') + cmds = m.get_commands('build-commands') + self.assertEqual(cmds, ['build-it']) + + def test_uses_build_system_commands_when_morphology_doesnt(self): + m = Morphology(''' + { + 'name': 'foo', + 'kind': 'chunk', + 'build-system': 'dummy', + } + ''') + cmds = m.get_commands('build-commands') + self.assertEqual(cmds, ['echo dummy build']) + + def test_uses_morphology_commands_when_morphology_has_empty_list(self): + m = Morphology(''' + { + 'name': 'foo', + 'kind': 'chunk', + 'build-system': 'dummy', + 'build-commands': [] + } + ''') + cmds = m.get_commands('build-commands') + self.assertEqual(cmds, []) |