use of com.google.template.soy.msgs.restricted.SoyMsgPlaceholderPart in project closure-templates by google.
the class SoyMsgIdComputerTest method testKnownMsgIds.
@Test
public void testKnownMsgIds() {
// Important: Do not change these hard-coded values. Changes to the algorithm will break
// backwards compatibility.
assertThat(SoyMsgIdComputer.computeMsgId(HELLO_WORLD_MSG_PARTS, null, null)).isEqualTo(3022994926184248873L);
assertThat(SoyMsgIdComputer.computeMsgId(HELLO_WORLD_MSG_PARTS, null, "text/html")).isEqualTo(3022994926184248873L);
assertThat(SoyMsgIdComputer.computeMsgId(HELLO_NAME_MSG_PARTS, null, null)).isEqualTo(6936162475751860807L);
assertThat(SoyMsgIdComputer.computeMsgId(HELLO_NAME_MSG_PARTS, null, "text/html")).isEqualTo(6936162475751860807L);
assertThat(SoyMsgIdComputer.computeMsgId(PLURAL_MSG_PARTS, null, null)).isEqualTo(947930983556630648L);
assertThat(SoyMsgIdComputer.computeMsgIdUsingBracedPhs(PLURAL_MSG_PARTS, null, null)).isEqualTo(1429579464553183506L);
ImmutableList<SoyMsgPart> archiveMsgParts = ImmutableList.<SoyMsgPart>of(SoyMsgRawTextPart.of("Archive"));
assertThat(SoyMsgIdComputer.computeMsgId(archiveMsgParts, "noun", null)).isEqualTo(7224011416745566687L);
assertThat(SoyMsgIdComputer.computeMsgId(archiveMsgParts, "verb", null)).isEqualTo(4826315192146469447L);
ImmutableList<SoyMsgPart> unicodeMsgParts = ImmutableList.of(new SoyMsgPlaceholderPart("\u2222\uEEEE", /* placeholderExample= */
null), SoyMsgRawTextPart.of("\u9EC4\u607A"));
assertThat(SoyMsgIdComputer.computeMsgId(unicodeMsgParts, null, null)).isEqualTo(7971596007260280311L);
assertThat(SoyMsgIdComputer.computeMsgId(unicodeMsgParts, null, "application/javascript")).isEqualTo(5109146044343713753L);
}
Aggregations