def requirements_update_test(self):
        block_name = BlockName("user/block")
        text = "[requirements]\n # My comment\n"
        config = BiiConfig(text)
        self.assertEqual(config.dumps(), None)

        version = BlockVersion(block_name.default_block(), 0)
        config.requirements = BlockVersionTable([version])
        dumped = config.dumps()
        self.assertEqual(dumped, "[requirements]\n\t user/block: 0\n\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config2 = BiiConfig(dumped)
        self.assertEqual(config2.requirements, config.requirements)

        block_name2 = BlockName("auser2/block2")
        version2 = BlockVersion(block_name2.default_block(), 2)
        config.requirements = BlockVersionTable([version, version2])
        dumped = config.dumps()
        self.assertEqual(dumped, "[requirements]\n"
                                 "\t auser2/block2: 2\n\t user/block: 0\n\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config3 = BiiConfig(dumped)
        self.assertEqual(config3.requirements, config.requirements)
Example #2
0
    def requirements_update_test(self):
        block_name = BlockName("user/block")
        text = "[requirements]\n # My comment\n"
        config = BiiConfig(text)
        self.assertEqual(config.dumps(), None)

        version = BlockVersion(block_name.default_block(), 0)
        config.requirements = BlockVersionTable([version])
        dumped = config.dumps()
        self.assertEqual(dumped, "[requirements]\n\t user/block: 0\n\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config2 = BiiConfig(dumped)
        self.assertEqual(config2.requirements, config.requirements)

        block_name2 = BlockName("auser2/block2")
        version2 = BlockVersion(block_name2.default_block(), 2)
        config.requirements = BlockVersionTable([version, version2])
        dumped = config.dumps()
        self.assertEqual(
            dumped, "[requirements]\n"
            "\t auser2/block2: 2\n\t user/block: 0\n\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config3 = BiiConfig(dumped)
        self.assertEqual(config3.requirements, config.requirements)
 def general_load_test(self):
     block_name = BlockName("user/block")
     version = BlockVersion(block_name.default_block(), 0)
     config = BiiConfig(general)
     self.assertEqual(config.parent, version)
     v1 = BlockVersion.loads("user2/depblock2(track): 3 @tag")
     v2 = BlockVersion.loads("user/depblock1(master): 3")
     self.assertEqual(config.requirements, BlockVersionTable([v1, v2]))
     self.assert_bii_equal(config.mains, [EntryPointConfiguration("main.cpp", False),
                                          EntryPointConfiguration("main2.cpp", True),
                                          ])
     self.assert_bii_equal(config.tests, ["test.cpp", "test1.cpp"])
     self.assertEqual(config.paths, ["/", "include"])
Example #4
0
 def general_load_test(self):
     block_name = BlockName("user/block")
     version = BlockVersion(block_name.default_block(), 0)
     config = BiiConfig(general)
     self.assertEqual(config.parent, version)
     v1 = BlockVersion.loads("user2/depblock2(track): 3 @tag")
     v2 = BlockVersion.loads("user/depblock1(master): 3")
     self.assertEqual(config.requirements, BlockVersionTable([v1, v2]))
     self.assert_bii_equal(config.mains, [
         EntryPointConfiguration("main.cpp", False),
         EntryPointConfiguration("main2.cpp", True),
     ])
     self.assert_bii_equal(config.tests, ["test.cpp", "test1.cpp"])
     self.assertEqual(config.paths, ["/", "include"])
    def parent_test(self):
        block_name = BlockName("user/block")
        version = BlockVersion(block_name.default_block(), 0)
        for text in (parent1, parent2):
            config = BiiConfig(text)
            self.assertEqual(config.parent, version)
            self.assertEqual(None, config.dumps())

        config = BiiConfig(parent3)
        self.assertEqual(config.parent, None)
        self.assertEqual(None, config.dumps())

        version = BlockVersion.loads("user/block(track): -1")
        config = BiiConfig(parent4)
        self.assertEqual(config.parent, version)
        self.assertEqual(None, config.dumps())
Example #6
0
    def parent_test(self):
        block_name = BlockName("user/block")
        version = BlockVersion(block_name.default_block(), 0)
        for text in (parent1, parent2):
            config = BiiConfig(text)
            self.assertEqual(config.parent, version)
            self.assertEqual(None, config.dumps())

        config = BiiConfig(parent3)
        self.assertEqual(config.parent, None)
        self.assertEqual(None, config.dumps())

        version = BlockVersion.loads("user/block(track): -1")
        config = BiiConfig(parent4)
        self.assertEqual(config.parent, version)
        self.assertEqual(None, config.dumps())
    def parent_update_test(self):
        block_name = BlockName("user/block")
        text = "[parent]\n # My comment\n"
        config = BiiConfig(text)
        self.assertEqual(config.dumps(), None)

        version = BlockVersion(block_name.default_block(), 0)
        config.parent = version
        dumped = config.dumps()
        self.assertEqual(dumped, "[parent]\n\tuser/block: 0\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config2 = BiiConfig(dumped)
        self.assertEqual(config2.parent, config.parent)

        version2 = BlockVersion.loads("user/block(track): 2")
        config.parent = version2
        dumped = config.dumps()
        self.assertEqual(dumped, "[parent]\n\tuser/block(track): 2\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config3 = BiiConfig(dumped)
        self.assertEqual(config3.parent, config.parent)
Example #8
0
    def parent_update_test(self):
        block_name = BlockName("user/block")
        text = "[parent]\n # My comment\n"
        config = BiiConfig(text)
        self.assertEqual(config.dumps(), None)

        version = BlockVersion(block_name.default_block(), 0)
        config.parent = version
        dumped = config.dumps()
        self.assertEqual(dumped, "[parent]\n\tuser/block: 0\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config2 = BiiConfig(dumped)
        self.assertEqual(config2.parent, config.parent)

        version2 = BlockVersion.loads("user/block(track): 2")
        config.parent = version2
        dumped = config.dumps()
        self.assertEqual(dumped, "[parent]\n\tuser/block(track): 2\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config3 = BiiConfig(dumped)
        self.assertEqual(config3.parent, config.parent)