def testReturnsSetOfHeadersFromFileContent(self): file_content = """ # Some comments if (is_android) { import("//a/b/c.gni") import("//d/e/f.gni") } source_set("foo") { sources = ["foo.h"] deps = [":bar"] } rtc_static_library("bar") { sources = [ "bar.h", "bar.cc", ] deps = [":bar"] } source_set("baz_foo") { sources = ["baz/foo.h"] } """ target_abs_path = _GetPath('a', 'b') self.assertEqual( set([ _GetPath('a', 'b', 'foo.h'), _GetPath('a', 'b', 'bar.h'), _GetPath('a', 'b', 'baz', 'foo.h'), ]), check_orphan_headers.GetHeadersInBuildGnFileSources( file_content, target_abs_path))
def testEmptyFileReturnsEmptySet(self): self.assertEqual( set([]), check_orphan_headers.GetHeadersInBuildGnFileSources('', '/a/b'))