diff options
author | 2019-02-28 12:42:22 +0100 | |
---|---|---|
committer | 2019-02-28 12:46:23 +0100 | |
commit | d9871b14df27308d2ca159bf7f4f516ec54e2d98 (patch) | |
tree | 6ef068f7303dbd20a28784e66e43d135ad8ce787 /tools/apilint | |
parent | 80545ef56d378ad4875dd82c8cfbf40f46aec4a6 (diff) |
Apilint: properly parse packages with numbers
Test: python apilint_tests.py
Change-Id: Ib0ad635e3994bbcbfecefddbd4899c3551ab65cf
Diffstat (limited to 'tools/apilint')
-rw-r--r-- | tools/apilint/apilint.py | 2 | ||||
-rw-r--r-- | tools/apilint/apilint_test.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/tools/apilint/apilint.py b/tools/apilint/apilint.py index 295e3de544ee..643d377c11b6 100644 --- a/tools/apilint/apilint.py +++ b/tools/apilint/apilint.py @@ -224,7 +224,7 @@ class Class(): class Package(): - NAME = re.compile("package(?: .*)? ([A-Za-z.]+)") + NAME = re.compile("package(?: .*)? ([A-Za-z0-9.]+)") def __init__(self, line, raw, blame): self.line = line diff --git a/tools/apilint/apilint_test.py b/tools/apilint/apilint_test.py index f34492d644ce..5cb43db0b00d 100644 --- a/tools/apilint/apilint_test.py +++ b/tools/apilint/apilint_test.py @@ -242,6 +242,10 @@ class V2ParserTests(unittest.TestCase): cls = self._cls("class Class {") return apilint.Field(cls, 1, raw, '', sig_format=2) + def test_parse_package(self): + pkg = apilint.Package(999, "package wifi.p2p {", None) + self.assertEquals("wifi.p2p", pkg.name) + def test_class(self): cls = self._cls("@Deprecated @IntRange(from=1, to=2) public static abstract class Some.Name extends Super<Class> implements Interface<Class> {") self.assertTrue('deprecated' in cls.split) |