blob: 771babc0c094fc6a73e961b1ee38e81b457283b7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import sys
from build.plugins.tests import fake_ymake
sys.modules['ymake'] = fake_ymake
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']
|