當前位置: 首頁>>代碼示例>>Java>>正文


Java StringData.EMPTY_STRING屬性代碼示例

本文整理匯總了Java中com.google.template.soy.data.restricted.StringData.EMPTY_STRING屬性的典型用法代碼示例。如果您正苦於以下問題:Java StringData.EMPTY_STRING屬性的具體用法?Java StringData.EMPTY_STRING怎麽用?Java StringData.EMPTY_STRING使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.template.soy.data.restricted.StringData的用法示例。


在下文中一共展示了StringData.EMPTY_STRING屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testComputeForJava

@Test
public void testComputeForJava() {
  BidiTextDirFunction bidiTextDirFunction = new BidiTextDirFunction();

  SoyValue text = StringData.EMPTY_STRING;
  assertThat(bidiTextDirFunction.computeForJava(ImmutableList.of(text)))
      .isEqualTo(IntegerData.ZERO);
  text = StringData.forValue("a");
  assertThat(bidiTextDirFunction.computeForJava(ImmutableList.of(text)))
      .isEqualTo(IntegerData.ONE);
  text = StringData.forValue("\u05E0");
  assertThat(bidiTextDirFunction.computeForJava(ImmutableList.of(text)))
      .isEqualTo(IntegerData.MINUS_ONE);

  text = SanitizedContents.unsanitizedText("a");
  assertThat(bidiTextDirFunction.computeForJava(ImmutableList.of(text)))
      .isEqualTo(IntegerData.ONE);
  text = SanitizedContents.unsanitizedText("a", Dir.LTR);
  assertThat(bidiTextDirFunction.computeForJava(ImmutableList.of(text)))
      .isEqualTo(IntegerData.ONE);
  text = SanitizedContents.unsanitizedText("a", Dir.RTL);
  assertThat(bidiTextDirFunction.computeForJava(ImmutableList.of(text)))
      .isEqualTo(IntegerData.MINUS_ONE);
  text = SanitizedContents.unsanitizedText("a", Dir.NEUTRAL);
  assertThat(bidiTextDirFunction.computeForJava(ImmutableList.of(text)))
      .isEqualTo(IntegerData.ZERO);
}
 
開發者ID:google,項目名稱:closure-templates,代碼行數:27,代碼來源:BidiTextDirFunctionTest.java

示例2: testComputeForJava

@Test
public void testComputeForJava() {
  SoyValue text = StringData.EMPTY_STRING;

  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "", SanitizedContent.ContentKind.ATTRIBUTES));
  text = StringData.forValue("a");
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "", SanitizedContent.ContentKind.ATTRIBUTES));
  text = StringData.forValue("\u05E0");
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "dir=\"rtl\"", SanitizedContent.ContentKind.ATTRIBUTES));

  text = SanitizedContents.unsanitizedText("\u05E0");
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "dir=\"rtl\"", SanitizedContent.ContentKind.ATTRIBUTES));
  text = SanitizedContents.unsanitizedText("\u05E0", Dir.RTL);
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "dir=\"rtl\"", SanitizedContent.ContentKind.ATTRIBUTES));
  text = SanitizedContents.unsanitizedText("\u05E0", Dir.LTR);
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "", SanitizedContent.ContentKind.ATTRIBUTES));
  text = SanitizedContents.unsanitizedText("\u05E0", Dir.NEUTRAL);
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "", SanitizedContent.ContentKind.ATTRIBUTES));

  text = StringData.EMPTY_STRING;
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "", SanitizedContent.ContentKind.ATTRIBUTES));
  text = StringData.forValue("\u05E0");
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "", SanitizedContent.ContentKind.ATTRIBUTES));
  text = StringData.forValue("a");
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "dir=\"ltr\"", SanitizedContent.ContentKind.ATTRIBUTES));

  text = SanitizedContents.unsanitizedText("a");
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "dir=\"ltr\"", SanitizedContent.ContentKind.ATTRIBUTES));
  text = SanitizedContents.unsanitizedText("a", Dir.LTR);
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "dir=\"ltr\"", SanitizedContent.ContentKind.ATTRIBUTES));
  text = SanitizedContents.unsanitizedText("a", Dir.RTL);
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "", SanitizedContent.ContentKind.ATTRIBUTES));
  text = SanitizedContents.unsanitizedText("a", Dir.NEUTRAL);
  assertThat(BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(
          UnsafeSanitizedContentOrdainer.ordainAsSafe(
              "", SanitizedContent.ContentKind.ATTRIBUTES));
}
 
開發者ID:google,項目名稱:closure-templates,代碼行數:77,代碼來源:BidiDirAttrFunctionTest.java

示例3: testComputeForJava

@Test
public void testComputeForJava() {
  SoyValue text = StringData.EMPTY_STRING;
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.EMPTY_STRING);
  text = StringData.forValue("a");
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.EMPTY_STRING);
  text = StringData.forValue("\u05E0");
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200E"));

  text = SanitizedContents.unsanitizedText("a");
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.EMPTY_STRING);
  text = SanitizedContents.unsanitizedText("a", Dir.LTR);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.EMPTY_STRING);
  text = SanitizedContents.unsanitizedText("a", Dir.NEUTRAL);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.EMPTY_STRING);
  text = SanitizedContents.unsanitizedText("a", Dir.RTL);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200E"));
  text = SanitizedContents.unsanitizedText("\u05E0");
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200E"));
  text = SanitizedContents.unsanitizedText("\u05E0", Dir.RTL);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200E"));
  text = SanitizedContents.unsanitizedText("\u05E0", Dir.NEUTRAL);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200E"));
  text = SanitizedContents.unsanitizedText("\u05E0", Dir.LTR);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200E"));

  text = StringData.EMPTY_STRING;
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.EMPTY_STRING);
  text = StringData.forValue("\u05E0");
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.EMPTY_STRING);
  text = StringData.forValue("a");
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200F"));

  text = SanitizedContents.unsanitizedText("\u05E0");
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.EMPTY_STRING);
  text = SanitizedContents.unsanitizedText("\u05E0", Dir.RTL);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.EMPTY_STRING);
  text = SanitizedContents.unsanitizedText("\u05E0", Dir.NEUTRAL);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.EMPTY_STRING);
  text = SanitizedContents.unsanitizedText("\u05E0", Dir.LTR);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200F"));
  text = SanitizedContents.unsanitizedText("a");
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200F"));
  text = SanitizedContents.unsanitizedText("a", Dir.LTR);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200F"));
  text = SanitizedContents.unsanitizedText("a", Dir.NEUTRAL);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200F"));
  text = SanitizedContents.unsanitizedText("a", Dir.RTL);
  assertThat(BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForJava(ImmutableList.of(text)))
      .isEqualTo(StringData.forValue("\u200F"));
}
 
開發者ID:google,項目名稱:closure-templates,代碼行數:72,代碼來源:BidiMarkAfterFunctionTest.java


注:本文中的com.google.template.soy.data.restricted.StringData.EMPTY_STRING屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。