aboutsummaryrefslogtreecommitdiffstats
path: root/build/plugins/tests/test_code_generator.py
blob: a675d9068c92855417bbc75f321b3bfd4a630f15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from build.plugins import code_generator


def test_include_parser():
    template_file = """
        @ from 'util/namespace.macro' import namespace, change_namespace, close_namespaces
        @ import 'market/tools/code_generator/templates/serialization/json.macro' as json
        @ import 'market/tools/code_generator/templates/serialization/request_parameters.macro' as rp
        #include <sss/abcdefg.h>
        #include<fff/asd>
        #include "hhh/quququ.h"
        """

    includes, induced = code_generator.CodeGeneratorTemplateParser.parse_includes(template_file.split('\n'))
    assert includes == ['util/namespace.macro', 'market/tools/code_generator/templates/serialization/json.macro', 'market/tools/code_generator/templates/serialization/request_parameters.macro']
    assert induced == ['sss/abcdefg.h', 'fff/asd', 'hhh/quququ.h']