Exemple #1
0
    def test_invalid_attributes(self):
        try:
            _find_attributes(
                """\


// vunit: invalid
            """,
                file_name="file.vhd",
            )
        except RuntimeError as exc:
            self.assertEqual(str(exc), "Invalid attribute 'invalid' in file.vhd line 3")
        else:
            assert False, "RuntimeError not raised"
Exemple #2
0
    def test_find_user_attributes(self):
        code = """
// vunit: .foo
// vunit: .foo-bar
        """
        attributes = _find_attributes(code, file_name="file.vhd")

        self.assertEqual(
            attributes,
            [
                Attribute(".foo", None, _code_file_location(code, ".foo", "file.vhd")),
                Attribute(".foo-bar", None, _code_file_location(code, ".foo-bar", "file.vhd")),
            ],
        )
Exemple #3
0
    def test_find_legacy_pragma(self):
        code = """
// vunit_pragma run_all_in_same_sim
// vunit_pragma fail_on_warning
        """
        attributes = _find_attributes(code, file_name="file.vhd")

        self.assertEqual(
            attributes,
            [
                LegacyAttribute(
                    "run_all_in_same_sim",
                    None,
                    _code_file_location(code, "run_all_in_same_sim", "file.vhd"),
                ),
                LegacyAttribute(
                    "fail_on_warning",
                    None,
                    _code_file_location(code, "fail_on_warning", "file.vhd"),
                ),
            ],
        )