blob: 7f3267a55e6a5fbe8c5672a74a2286646f9962a0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
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']
|