Ejemplo n.º 1
0
    def setUp(self):
        self.r = Rule()
        self.name = 'rulenametest'
        self.description = 'this is message text'
        self.command = ['cat foo | grep']
        self.depfile = 'output.d'

        self.example_rule = {
            'name': self.name,
            'description': self.description,
            'command': self.command,
            'depfile': self.depfile
        }
Ejemplo n.º 2
0
    def setUp(self):
        self.r = Rule()
        self.name = 'rulenametest'
        self.description = 'this is message text'
        self.command = ['cat foo | grep']
        self.depfile = 'output.d'

        self.example_rule = { 'name' : self.name,
                              'description': self.description,
                              'command': self.command,
                              'depfile': self.depfile }
Ejemplo n.º 3
0
    def setUp(self):
        self.rdb = RuleCloth()
        self.rule_name = 'ccompile'
        self.example_rule = {
            'name': self.rule_name,
            'description': 'compile $file',
            'command': ['cc $in']
        }

        self.rule_obj = Rule(self.rule_name)
        self.rule_obj._rule = self.example_rule
Ejemplo n.º 4
0
class TestRuleCommand(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.command = ['cat foo | grep']

    def test_command_helper(self):
        self.r.command(self.command)
        self.assertEqual(self.command, self.r._rule['command'])

    def test_default_command_state(self):
        self.assertEqual(self.r.command(), None)

    def test_cmd_command_alias(self):
        self.assertEqual(self.r.cmd, self.r.command)

    def test_command_return_value(self):
        self.assertTrue(self.r.command(self.command))

    def test_command_string(self):
        cmd = 'a string'
        self.assertEqual(self.r.command(cmd), cmd)
Ejemplo n.º 5
0
class TestRuleCommand(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.command = ['cat foo | grep']

    def test_command_helper(self):
        self.r.command(self.command)
        self.assertEqual(self.command , self.r._rule['command'])

    def test_default_command_state(self):
        self.assertEqual(self.r.command(), None)

    def test_cmd_command_alias(self):
        self.assertEqual(self.r.cmd, self.r.command)

    def test_command_return_value(self):
        self.assertTrue(self.r.command(self.command))

    def test_command_string(self):
        cmd = 'a string'
        self.assertEqual(self.r.command(cmd), cmd)
Ejemplo n.º 6
0
class TestRuleDepFile(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.depfile = 'output.d'

    def test_depfile_return_value(self):
        self.assertTrue(self.r.depfile(self.depfile))

    def test_depfile_helper(self):
        self.r.depfile(self.depfile)
        self.assertEqual(self.depfile, self.r._rule['depfile'])

    def test_default_depfile_state(self):
        with self.assertRaises(KeyError):
            self.r.depfile()

    def test_depfile_return_helper(self):
        self.r.depfile(self.depfile)
        self.assertEqual(self.depfile, self.r.depfile())
Ejemplo n.º 7
0
class TestRuleDepFile(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.depfile = 'output.d'

    def test_depfile_return_value(self):
        self.assertTrue(self.r.depfile(self.depfile))
 
    def test_depfile_helper(self):
        self.r.depfile(self.depfile)
        self.assertEqual(self.depfile , self.r._rule['depfile'])

    def test_default_depfile_state(self):
        with self.assertRaises(KeyError):
            self.r.depfile()

    def test_depfile_return_helper(self):
        self.r.depfile(self.depfile)
        self.assertEqual(self.depfile , self.r.depfile())
Ejemplo n.º 8
0
class TestRuleRestat(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()

    def test_restat_return_value(self):
        self.assertTrue(self.r.restat())

    def test_restat_exists(self):
        self.r.restat()
        self.assertTrue(self.r.restat())

    def test_rule_without_name(self):
        with self.assertRaises(InvalidRule):
            self.r.rule()
Ejemplo n.º 9
0
class TestRuleRestat(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()

    def test_restat_return_value(self):
        self.assertTrue(self.r.restat())

    def test_restat_exists(self):
        self.r.restat()
        self.assertTrue(self.r.restat())

    def test_rule_without_name(self):
        with self.assertRaises(InvalidRule):
            self.r.rule()
Ejemplo n.º 10
0
class TestRuleName(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.name = 'rulenametest'

    def test_default_name(self):
        self.assertEqual(self.r._rule['name'], None)

    def test_name_requirement(self):
        with self.assertRaises(InvalidRule):
            self.r.name()

    def test_add_name_helper(self):
        self.r.name(self.name)
        self.assertEqual(self.name, self.r._rule['name'])

    def test_return_name_helper(self):
        self.r.name(self.name)
        self.assertEqual(self.r.name(), self.name)

    def test_name_return_value(self):
        self.assertTrue(self.r.name(self.name))
Ejemplo n.º 11
0
class TestRuleName(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.name = 'rulenametest'

    def test_default_name(self):
        self.assertEqual(self.r._rule['name'], None)

    def test_name_requirement(self):
        with self.assertRaises(InvalidRule):
            self.r.name()
    
    def test_add_name_helper(self):
        self.r.name(self.name)
        self.assertEqual(self.name, self.r._rule['name'])

    def test_return_name_helper(self):
        self.r.name(self.name)
        self.assertEqual(self.r.name(), self.name)

    def test_name_return_value(self):
        self.assertTrue(self.r.name(self.name))
Ejemplo n.º 12
0
class TestRuleDescription(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.description = 'this is message text'

    def test_description_return_value(self):
        self.assertTrue(self.r.description(self.description))
 
    def test_msg_description_alias(self):
        self.assertEqual(self.r.msg, self.r.description)

    def test_description_helper(self):
        self.r.description(self.description)
        self.assertEqual(self.description , self.r._rule['description'])

    def test_description_return_helper(self):
        self.r.description(self.description)
        self.assertEqual(self.description , self.r.description())
Ejemplo n.º 13
0
class TestRuleDescription(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.description = 'this is message text'

    def test_description_return_value(self):
        self.assertTrue(self.r.description(self.description))

    def test_msg_description_alias(self):
        self.assertEqual(self.r.msg, self.r.description)

    def test_description_helper(self):
        self.r.description(self.description)
        self.assertEqual(self.description, self.r._rule['description'])

    def test_description_return_helper(self):
        self.r.description(self.description)
        self.assertEqual(self.description, self.r.description())
Ejemplo n.º 14
0
 def setUp(self):
     self.r = Rule()
     self.command = ['cat foo | grep']
Ejemplo n.º 15
0
 def setUp(self):
     self.r = Rule()
     self.depfile = 'output.d'
Ejemplo n.º 16
0
 def setUp(self):
     self.r = Rule()
     self.command = ['cat foo | grep']
Ejemplo n.º 17
0
 def setUp(self):
     self.r = Rule()
Ejemplo n.º 18
0
 def setUp(self):
     self.r = Rule()
     self.name = 'rulenametest'
Ejemplo n.º 19
0
class TestRule(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.name = 'rulenametest'
        self.description = 'this is message text'
        self.command = ['cat foo | grep']
        self.depfile = 'output.d'

        self.example_rule = { 'name' : self.name,
                              'description': self.description,
                              'command': self.command,
                              'depfile': self.depfile }
             
    def test_rule_return(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        rule = self.r.rule()

        self.assertEqual(type(rule), type(self.example_rule))

    def test_rule_has_keys(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        self.r.depfile(self.depfile)
        rule = self.r.rule()

        self.assertEqual(rule.keys(), self.example_rule.keys())
Ejemplo n.º 20
0
class TestRule(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.name = 'rulenametest'
        self.description = 'this is message text'
        self.command = ['cat foo | grep']
        self.depfile = 'output.d'

        self.example_rule = {
            'name': self.name,
            'description': self.description,
            'command': self.command,
            'depfile': self.depfile
        }

    def test_rule_return(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        rule = self.r.rule()

        self.assertEqual(type(rule), type(self.example_rule))

    def test_rule_has_keys(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        self.r.depfile(self.depfile)
        rule = self.r.rule()

        self.assertEqual(rule.keys(), self.example_rule.keys())
Ejemplo n.º 21
0
 def setUp(self):
     self.r = Rule()
Ejemplo n.º 22
0
 def setUp(self):
     self.r = Rule()
     self.name = 'rulenametest'
Ejemplo n.º 23
0
 def setUp(self):
     self.r = Rule()
     self.depfile = 'output.d'
Ejemplo n.º 24
0
 def setUp(self):
     self.r = Rule()
     self.description = 'this is message text'
Ejemplo n.º 25
0
 def setUp(self):
     self.r = Rule()
     self.description = 'this is message text'