def test_collect_includes_with_conditional_block(self):
     node = pre_ast.ConditionalBlock(
         conditional_expression='some_expression',
         content=[pre_ast.Include("33", "<")],
     )
     actual = self.include_collector.collect_includes(node)
     self.assertEqual(actual, [pre_ast.Include("33", "<")])
Beispiel #2
0
 def test_resolve_with_inlcude_and_path_not_exists(self):
     node = pre_ast.Include(
         path='some_path',
         quotes_type='some_quotes_type',
         absolute_path='path_4',
     )
     self.include_linking_visitor.resolve(node, self.files)
     self.assertIsNone(node.content)
 def test_collect_includes_with_include(self):
     node = pre_ast.Include(
         path='some_path',
         quotes_type='some_qutes_type',
     )
     actual = self.include_collector.collect_includes(node)
     expected = [node]
     self.assertEqual(actual, expected)
 def test_parse_include_with_double_quotes(self):
     source = '#include "some/path/to/file_2.h"'
     actual = self.parser.parse(source)
     expected = pre_ast.CompositeBlock(
         [pre_ast.Include(
             path='some/path/to/file_2.h',
             quotes_type='"',
         )])
     self.assertASTEqual(actual, expected)
 def test_parse_include_with_angle_brackets(self):
     source = '# include <some/path/to/file_1.h>'
     actual = self.parser.parse(source)
     expected = pre_ast.CompositeBlock(content=[
         pre_ast.Include(
             path='some/path/to/file_1.h',
             quotes_type="<",
         )
     ])
     self.assertASTEqual(actual, expected)
Beispiel #6
0
 def _process_include(self, rest_of_line):
     # Strip quotes
     path = rest_of_line[1:-1]
     quote = rest_of_line[0]
     self.current_node.content.append(
         pre_ast.Include(path=path, quotes_type=quote))