Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd61f229 authored by Jeremy Meyer's avatar Jeremy Meyer
Browse files

Add a test to verify that flags in resource paths must be readonly

Test: this
Flag: EXEMPT adding a test
Change-Id: Idaefa542c03ab9ad7373ca4a1c53c98695a5b178
parent b281da20
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -169,4 +169,18 @@ TEST_F(FlaggedResourcesTest, EnabledXmlELementAttributeRemoved) {
  ASSERT_TRUE(output.contains("test.package.readWriteFlag"));
}

TEST_F(FlaggedResourcesTest, ReadWriteFlagInPathFails) {
  test::TestDiagnosticsImpl diag;
  const std::string compiled_files_dir = GetTestPath("compiled");
  ASSERT_FALSE(CompileFile(GetTestPath("res/values/flag(!test.package.rwFlag)/bools.xml"),
                           R"(<resources>
                                <bool name="bool1">false</bool>
                              </resources>)",
                           compiled_files_dir, &diag,
                           {"--feature-flags", "test.package.rwFlag=false"}));

  ASSERT_TRUE(diag.GetLog().contains(
      "Only read only flags may be used with resources: test.package.rwFlag"));
}

}  // namespace aapt