class TestTargetsAndDependencies(TestCase): @classmethod def setUp(self): self.m = MakefileCloth() self.block = 'test-block' def test_target_invalid_dict_target(self): with self.assertRaises(MalformedContent): self.m.target({'a': 'string'}, block='test') def test_target_invalid_num_target(self): with self.assertRaises(MalformedContent): self.m.target(1, block='test') def test_target_invalid_dict_dep(self): with self.assertRaises(MalformedContent): self.m.target('a', {'a': 'string'}, block='test') def test_target_invalid_num_dep(self): with self.assertRaises(MalformedContent): self.m.target('a', 1, block='test') def test_target_single_no_dep(self): target = 'a' result = ['a:'] self.m.target(target, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_single_with_dep(self): target = 'a' dep = 'b' result = ['a:b'] self.m.target(target, dep, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_single_no_dep(self): target = 'a' result = ['a:'] self.m.target(target, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_single_with_dep(self): target = 'a' dep = 'b' result = ['a:b'] self.m.target(target, dep, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_multi_no_dep(self): target = ['a', 'b' ] result = ['a b:'] self.m.target(target, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_multi_with_dep(self): target = ['a', 'b' ] dep = 'c' result = ['a b:c'] self.m.target(target, dep, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_multi_with_multi_dep(self): target = ['a', 'b' ] dep = ['c', 'd' ] result = ['a b:c d'] self.m.target(target, dep, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_single_with_multi_dep(self): target = 'a' dep = ['b', 'c'] result = ['a:b c'] self.m.target(target, dep, block=self.block) self.assertEqual(self.m.get_block(self.block), result)
class TestTargetsAndDependencies(TestCase): @classmethod def setUp(self): self.m = MakefileCloth() self.block = 'test-block' def test_target_invalid_dict_target(self): with self.assertRaises(MalformedContent): self.m.target({'a': 'string'}, block='test') def test_target_invalid_num_target(self): with self.assertRaises(MalformedContent): self.m.target(1, block='test') def test_target_invalid_dict_dep(self): with self.assertRaises(MalformedContent): self.m.target('a', {'a': 'string'}, block='test') def test_target_invalid_num_dep(self): with self.assertRaises(MalformedContent): self.m.target('a', 1, block='test') def test_target_single_no_dep(self): target = 'a' result = ['a:'] self.m.target(target, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_single_with_dep(self): target = 'a' dep = 'b' result = ['a:b'] self.m.target(target, dep, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_single_no_dep(self): target = 'a' result = ['a:'] self.m.target(target, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_single_with_dep(self): target = 'a' dep = 'b' result = ['a:b'] self.m.target(target, dep, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_multi_no_dep(self): target = ['a', 'b'] result = ['a b:'] self.m.target(target, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_multi_with_dep(self): target = ['a', 'b'] dep = 'c' result = ['a b:c'] self.m.target(target, dep, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_multi_with_multi_dep(self): target = ['a', 'b'] dep = ['c', 'd'] result = ['a b:c d'] self.m.target(target, dep, block=self.block) self.assertEqual(self.m.get_block(self.block), result) def test_target_single_with_multi_dep(self): target = 'a' dep = ['b', 'c'] result = ['a:b c'] self.m.target(target, dep, block=self.block) self.assertEqual(self.m.get_block(self.block), result)