コード例 #1
0
 def test_load(self):
     src = textwrap.dedent("""\
   load("//foo/bar:bar.bzl", "foo_library")
   load("//foo/bar:baz.bzl", "foo_test", orig_foo_binary = "foo_binary")
   """)
     expected = [
         load_extractor.LoadSymbol('//foo/bar:bar.bzl', 'foo_library',
                                   None),
         load_extractor.LoadSymbol('//foo/bar:baz.bzl', 'foo_test', None),
         load_extractor.LoadSymbol('//foo/bar:baz.bzl', 'foo_binary',
                                   'orig_foo_binary'),
     ]
     self.check_symbols(src, expected)
コード例 #2
0
    def test_loads(self):
        src = textwrap.dedent("""\
        load("//foo/bar:bar.bzl", "foo_library")
        load("//foo/bar:baz.bzl", "foo_test", orig_foo_binary = "foo_binary")

        _references_foo_library = foo_library
        _references_orig_foo_binary = orig_foo_binary
        """)
        load_symbols = [
            load_extractor.LoadSymbol('//foo/bar:bar.bzl', 'foo_library',
                                      None),
            load_extractor.LoadSymbol('//foo/bar:baz.bzl', 'foo_test', None),
            load_extractor.LoadSymbol('//foo/bar:baz.bzl', 'foo_binary',
                                      'orig_foo_binary'),
        ]
        expected = ""
        self.check_protos(src, expected, load_symbols)
コード例 #3
0
 def test_create_stubs(self):
     stubs = {
         'foo': 'bar',
         'bar': 'baz',
     }
     load_symbols = [
         load_extractor.LoadSymbol('//foo:bar.bzl', 'bar_library', None),
         load_extractor.LoadSymbol('//foo:bar.bzl', 'foo_bar_binary',
                                   'bar_binary'),
     ]
     expected = {
         'foo': 'bar',
         'bar': 'baz',
         'bar_library': '',
         'bar_binary': '',
     }
     self.assertEqual(expected,
                      rule_extractor.create_stubs(stubs, load_symbols))