示例#1
0
    def test_post_process_tag__fields(self):
        """Test ``post_process_tag`` with a number of ``field`` variables.

        Test function with an sample tag from a Java file. This in turn tests
        the supporting functions.
        """
        tag = {
            'symbol': 'getSum',
            'filename': '.\\a_folder\\DemoClass.java',
            'ex_command': '/^\tprivate int getSum(int a, int b) {$/',
            'type': 'm',
            'fields': 'class:DemoClass\tfile:'}

        expected_output = {
            'symbol': 'getSum',
            'filename': '.\\a_folder\\DemoClass.java',
            'tag_path': ('.\\a_folder\\DemoClass.java', 'DemoClass', 'getSum'),
            'ex_command': '\tprivate int getSum(int a, int b) {',
            'type': 'm',
            'fields': 'class:DemoClass\tfile:',
            'field_keys': ['class', 'file'],
            'class': 'DemoClass',
            'file': ''}

        result = ctags.post_process_tag(tag)

        self.assertEqual(result, expected_output)
示例#2
0
    def test_post_process_tag__fields(self):
        """Test ``post_process_tag`` with a number of ``field`` variables.

        Test function with an sample tag from a Java file. This in turn tests
        the supporting functions.
        """
        tag = {
            'symbol': 'getSum',
            'filename': '.\\a_folder\\DemoClass.java',
            'ex_command': '/^\tprivate int getSum(int a, int b) {$/',
            'type': 'm',
            'fields': 'class:DemoClass\tfile:'}

        expected_output = {
            'symbol': 'getSum',
            'filename': '.\\a_folder\\DemoClass.java',
            'tag_path': ('.\\a_folder\\DemoClass.java', 'DemoClass', 'getSum'),
            'ex_command': '\tprivate int getSum(int a, int b) {',
            'type': 'm',
            'fields': 'class:DemoClass\tfile:',
            'field_keys': ['class', 'file'],
            'class': 'DemoClass',
            'file': ''}

        result = ctags.post_process_tag(tag)

        self.assertEqual(result, expected_output)
示例#3
0
    def test_post_process_tag__regex_no_fields(self):
        """Test ``post_process_tag`` with a regex ``excmd`` variable.

        Test function with an sample tag from a Python file. This in turn tests
        the supporting functions.
        """
        tag = {
            'symbol': 'acme_function',
            'filename': '.\\a_folder\\a_script.py',
            'ex_command': '/^def acme_function(tag):$/',
            'type': 'f',
            'fields': None
        }

        expected_output = {
            'symbol': 'acme_function',
            'filename': '.\\a_folder\\a_script.py',
            'tag_path': ('.\\a_folder\\a_script.py', 'acme_function'),
            'ex_command': 'def acme_function(tag):',
            'type': 'f',
            'fields': None
        }

        result = ctags.post_process_tag(tag)

        self.assertEqual(result, expected_output)
示例#4
0
    def test_post_process_tag__regex_no_fields(self):
        """
        Test ``post_process_tag`` with a regex ``excmd`` variable.

        Test function with an sample tag from a Python file. This in turn tests
        the supporting functions.
        """
        tag = {
            'symbol': 'acme_function',
            'filename': '.\\a_folder\\a_script.py',
            'ex_command': '/^def acme_function(tag):$/',
            'type': 'f',
            'fields': None}

        expected_output = {
            'symbol': 'acme_function',
            'filename': '.\\a_folder\\a_script.py',
            'tag_path': ('.\\a_folder\\a_script.py', 'acme_function'),
            'ex_command': 'def acme_function(tag):',
            'type': 'f',
            'fields': None}

        result = ctags.post_process_tag(tag)

        self.assertEqual(result, expected_output)
示例#5
0
    def test_post_process_tag__fields(self):
        """Test ``post_process_tag`` with a number of ``field`` variables.

        Test function with an sample tag from a Java file. This in turn tests
        the supporting functions.
        """
        tag = {
            "symbol": "getSum",
            "filename": ".\\a_folder\\DemoClass.java",
            "ex_command": "/^\tprivate int getSum(int a, int b) {$/",
            "type": "m",
            "fields": "class:DemoClass\tfile:",
        }

        expected_output = {
            "symbol": "getSum",
            "filename": ".\\a_folder\\DemoClass.java",
            "tag_path": (".\\a_folder\\DemoClass.java", "DemoClass", "getSum"),
            "ex_command": "\tprivate int getSum(int a, int b) {",
            "type": "m",
            "fields": "class:DemoClass\tfile:",
            "field_keys": ["class", "file"],
            "class": "DemoClass",
            "file": "",
        }

        result = ctags.post_process_tag(tag)

        self.assertEqual(result, expected_output)
示例#6
0
    def test_post_process_tag__regex_no_fields(self):
        """Test ``post_process_tag`` with a regex ``excmd`` variable.

        Test function with an sample tag from a Python file. This in turn tests
        the supporting functions.
        """
        tag = {
            "symbol": "acme_function",
            "filename": ".\\a_folder\\a_script.py",
            "ex_command": "/^def acme_function(tag):$/",
            "type": "f",
            "fields": None,
        }

        expected_output = {
            "symbol": "acme_function",
            "filename": ".\\a_folder\\a_script.py",
            "tag_path": (".\\a_folder\\a_script.py", "acme_function"),
            "ex_command": "def acme_function(tag):",
            "type": "f",
            "fields": None,
        }

        result = ctags.post_process_tag(tag)

        self.assertEqual(result, expected_output)