summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceParser_test.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-06-02 16:32:37 -0700
committerAdam Lesinski <adamlesinski@google.com>2017-06-06 20:02:38 +0000
commitb9f0548341f98a64a87fa35ef5f58d1daf973ca7 (patch)
treeb18439dee3ec04c180e2934a0d5d6c574ee37be4 /tools/aapt2/ResourceParser_test.cpp
parent63c5c9462a0175143791d7a5491a67a1a645cab4 (diff)
AAPT2: Do not interpret %n as a format specifier in string resources
%n is a special value marking a platform independent newline and is not to be considered a format argument. Bug: 37132275 Test: make aapt2_tests Change-Id: I806521e44afe20004344dee9f18ecee6cc7086ea
Diffstat (limited to 'tools/aapt2/ResourceParser_test.cpp')
-rw-r--r--tools/aapt2/ResourceParser_test.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/aapt2/ResourceParser_test.cpp b/tools/aapt2/ResourceParser_test.cpp
index 5352ca8679b3..c6382b177f42 100644
--- a/tools/aapt2/ResourceParser_test.cpp
+++ b/tools/aapt2/ResourceParser_test.cpp
@@ -843,4 +843,9 @@ TEST_F(ResourceParserTest, ParseElementWithNoValue) {
EXPECT_THAT(*str->value, Eq(""));
}
+TEST_F(ResourceParserTest, ParsePlatformIndependentNewline) {
+ std::string input = R"(<string name="foo">%1$s %n %2$s</string>)";
+ ASSERT_TRUE(TestParse(input));
+}
+
} // namespace aapt