Exemplo n.º 1
0
 def test_find_all_include_defs_when_they_exist(self):
     all_include_defs = build_file.from_content(
         'include_defs("//foo/DEFS")').find_all_include_defs()
     self.assertEqual(["//foo/DEFS"],
                      list(
                          map(lambda include: include.get_location(),
                              all_include_defs)))
Exemplo n.º 2
0
 def test_find_all_include_defs_when_they_exist(self):
     all_include_defs = build_file.from_content(
         'include_defs("//foo/DEFS")').find_all_include_defs()
     self.assertEqual(["//foo/DEFS"],
                      list(
                          map(lambda include: include.get_location(),
                              all_include_defs)))
Exemplo n.º 3
0
    def test_find_only_include_defs_when_they_exist(self):
        content = """
include_defs("//foo/DEFS")
foo("bar")
        """
        all_include_defs = build_file.from_content(content).find_all_include_defs()
        self.assertEqual(
            ["//foo/DEFS"],
            list(map(lambda include: include.get_location(), all_include_defs)),
        )
Exemplo n.º 4
0
    def test_find_only_include_defs_when_they_exist(self):
        content = """
include_defs("//foo/DEFS")
foo("bar")
        """
        all_include_defs = build_file.from_content(content).find_all_include_defs()
        self.assertEqual(
            ["//foo/DEFS"],
            list(map(lambda include: include.get_location(), all_include_defs)),
        )
Exemplo n.º 5
0
    def test_find_function_calls_by_name(self):
        content = """
foo('bar')
bar('foo')
foo('baz')
        """
        foo_calls = build_file.from_content(
            content)._find_all_function_calls_by_name("foo")
        self.assertEqual(2, len(foo_calls))
        for call in foo_calls:
            self.assertEqual("foo", call.func.id)
Exemplo n.º 6
0
    def test_find_function_calls_by_name(self):
        content = """
foo('bar')
bar('foo')
foo('baz')
        """
        foo_calls = build_file.from_content(
            content)._find_all_function_calls_by_name('foo')
        self.assertEqual(2, len(foo_calls))
        for call in foo_calls:
            self.assertEqual('foo', call.func.id)
Exemplo n.º 7
0
    def test_find_used_symbols(self):
        content = """
foo = BAR
bar('foo')
def func():
  pass
"""
        self.assertEqual(
            ['BAR', 'bar'],
            list(
                map(lambda n: n.id,
                    build_file.from_content(content)._find_used_symbols())))
Exemplo n.º 8
0
    def test_find_used_symbols(self):
        content = """
foo = BAR
bar('foo')
def func():
  pass
"""
        self.assertEqual(
            ['BAR', 'bar'],
            list(
                map(lambda n: n.id,
                    build_file.from_content(content)._find_used_symbols())))
Exemplo n.º 9
0
    def test_find_exported_symbols(self):
        content = """
foo = BAR
bar('foo')
def func():
  pass
class Clazz:
  def foo():
    pass
"""
        self.assertEqual(
            ['foo', 'func', 'Clazz'],
            build_file.from_content(content).find_exported_symbols())
Exemplo n.º 10
0
    def test_find_exported_symbols(self):
        content = """
foo = BAR
bar('foo')
def func():
  pass
class Clazz:
  def foo():
    pass
"""
        self.assertEqual(
            ['foo', 'func', 'Clazz'],
            build_file.from_content(content).find_exported_symbols())
Exemplo n.º 11
0
 def test_find_all_include_defs_when_no_includes(self):
     self.assertEqual([], build_file.from_content("").find_all_include_defs())
Exemplo n.º 12
0
 def test_find_all_include_defs_when_no_includes(self):
     self.assertEqual([], build_file.from_content("").find_all_include_defs())