AAPT2: Read config from disk
Implement the todo left from last change to read the contents of the
configuration file from disk. Since this is an operation that may fail
the API was changed to take return a Maybe to indicate errors reading
the file.
Test: unit test for error condition
Test: ran aapt2 optimize with the new code path wired in
Change-Id: I93d532b4a57af9520231225eee4fc5f2b1a046b9
diff --git a/tools/aapt2/configuration/ConfigurationParser_test.cpp b/tools/aapt2/configuration/ConfigurationParser_test.cpp
index 72a97b2..8421ee3 100644
--- a/tools/aapt2/configuration/ConfigurationParser_test.cpp
+++ b/tools/aapt2/configuration/ConfigurationParser_test.cpp
@@ -130,6 +130,11 @@
StdErrDiagnostics diag_;
};
+TEST_F(ConfigurationParserTest, ForPath_NoFile) {
+ auto result = ConfigurationParser::ForPath("./does_not_exist.xml");
+ EXPECT_FALSE(result);
+}
+
TEST_F(ConfigurationParserTest, ValidateFile) {
auto parser = ConfigurationParser::ForContents(kValidConfig).WithDiagnostics(&diag_);
auto result = parser.Parse();