Exercise string concatenation in ReplaceMessages unit tests.
@@ -65,6 +65,15 @@ public final class ReplaceMessagesTest extends CompilerTestCase {
"/** @desc d */\n var MSG_A='Hi\\nthere'");
}
+ @Test
+ public void testReplaceSimpleMessageDefinedWithAdd() {
+ registerMessage(new JsMessage.Builder("MSG_A").appendStringPart("Hi\nthere").build());
+
+ test(
+ "/** @desc d */\n var MSG_A = goog.getMsg('abcd' + 'efgh');",
+ "/** @desc d */\n var MSG_A='Hi\\nthere'");
+ }
+
@Test
public void testMissingAlternateMessage() {
test(
@@ -424,6 +433,13 @@ public final class ReplaceMessagesTest extends CompilerTestCase {
+ "with placeholders.");
}
+ @Test
+ public void testLegacyStyleNoPlaceholdersVarSyntaxConcat() {
+ registerMessage(new JsMessage.Builder("MSG_A").appendStringPart("Hi\nthere").build());
+ style = Style.LEGACY;
+ test("var MSG_A = 'abc' + 'def';", "var MSG_A='Hi\\nthere'");
+ }
+
@Test
public void testLegacyStyleNoPlaceholdersVarSyntax() {
registerMessage(new JsMessage.Builder("MSG_A").appendStringPart("Hi\nthere").build());
