No new attributes in declare-styleables when format is not provided
AAPT does not allow for attributes declared in declare-styleables
that do not have a format to create new attribute resources. AAPT2
does and should not.
Bug: 131100106
Test: aapt2_tests
Change-Id: Id00884dc9ed939672df90f670a7915d4b6d232c1
diff --git a/tools/aapt2/ResourceParser_test.cpp b/tools/aapt2/ResourceParser_test.cpp
index 7c8b6d0..464225f 100644
--- a/tools/aapt2/ResourceParser_test.cpp
+++ b/tools/aapt2/ResourceParser_test.cpp
@@ -341,7 +341,7 @@
std::string input = R"(
<attr name="foo" />
<declare-styleable name="bar">
- <attr name="baz" />
+ <attr name="baz" format="reference"/>
</declare-styleable>)";
ASSERT_TRUE(TestParse(input, watch_config));
@@ -589,8 +589,7 @@
EXPECT_THAT(result.value().entry->visibility.level, Eq(Visibility::Level::kPublic));
Attribute* attr = test::GetValue<Attribute>(&table_, "attr/bar");
- ASSERT_THAT(attr, NotNull());
- EXPECT_TRUE(attr->IsWeak());
+ ASSERT_THAT(attr, IsNull());
attr = test::GetValue<Attribute>(&table_, "attr/bat");
ASSERT_THAT(attr, NotNull());