Package com.google.template.soy.data

Examples of com.google.template.soy.data.SoyData



  public void testComputeForTofu() {

    KeysFunction keysFunction = new KeysFunction();
    SoyData map = new SoyMapData("boo", "bar", "foo", 2, "goo", new SoyMapData("moo", 4));
    SoyData result = keysFunction.computeForTofu(ImmutableList.of(map));

    assertTrue(result instanceof SoyListData);
    SoyListData resultAsList = (SoyListData) result;
    assertEquals(3, resultAsList.length());
View Full Code Here


          SharedRestrictedTestUtils.BIDI_GLOBAL_DIR_FOR_ISRTL_CODE_SNIPPET_PROVIDER);


  public void testComputeForTofu() {

    SoyData text = StringData.EMPTY_STRING;
    assertEquals(StringData.EMPTY_STRING,
                 BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_LTR.computeForTofu(ImmutableList.of(text)));
    assertEquals(StringData.EMPTY_STRING,
                 BIDI_MARK_AFTER_FUNCTION_FOR_STATIC_RTL.computeForTofu(ImmutableList.of(text)));
View Full Code Here

          SharedRestrictedTestUtils.BIDI_GLOBAL_DIR_FOR_ISRTL_CODE_SNIPPET_PROVIDER);


  public void testComputeForTofu() {

    SoyData text = StringData.EMPTY_STRING;
    assertEquals(
        UnsafeSanitizedContentOrdainer.ordainAsSafe(
            "", SanitizedContent.ContentKind.ATTRIBUTES),
        BIDI_DIR_ATTR_FUNCTION_FOR_STATIC_LTR.computeForTofu(ImmutableList.of(text)));
    assertEquals(
View Full Code Here

  public void testComputeForTofu() {

    BidiTextDirFunction bidiTextDirFunction = new BidiTextDirFunction();

    SoyData text = StringData.EMPTY_STRING;
    assertEquals(IntegerData.ZERO,
                 bidiTextDirFunction.computeForTofu(ImmutableList.of(text)));
    assertEquals(IntegerData.ZERO,
                 bidiTextDirFunction.computeForTofu(ImmutableList.of(text)));
View Full Code Here

  public void testComputeForTofu() {

    RandomIntFunction randomIntFunction = new RandomIntFunction();

    SoyData arg = IntegerData.ONE;
    assertEquals(IntegerData.ZERO,
                 randomIntFunction.computeForTofu(ImmutableList.of(arg)));

    arg = IntegerData.forValue(3);
    Set<Integer> seenResults = Sets.newHashSetWithExpectedSize(3);
View Full Code Here

*/
public class StrContainsFunctionTest extends TestCase {


  public void testComputeForTofu_containsString() {
    SoyData arg0 = StringData.forValue("foobarfoo");
    SoyData arg1 = StringData.forValue("bar");

    StrContainsFunction f = new StrContainsFunction();
    assertEquals(BooleanData.TRUE, f.computeForTofu(ImmutableList.of(arg0, arg1)));
  }
View Full Code Here

    assertEquals(BooleanData.TRUE, f.computeForTofu(ImmutableList.of(arg0, arg1)));
  }


  public void testComputeForTofu_doesNotContainString() {
    SoyData arg0 = StringData.forValue("foobarfoo");
    SoyData arg1 = StringData.forValue("baz");

    StrContainsFunction f = new StrContainsFunction();
    assertEquals(BooleanData.FALSE, f.computeForTofu(ImmutableList.of(arg0, arg1)));
  }
View Full Code Here

  public void testComputeForTofu() {

    MinFunction minFunction = new MinFunction();

    SoyData float0 = FloatData.forValue(7.5);
    SoyData float1 = FloatData.forValue(7.777);
    assertEquals(FloatData.forValue(7.5),
                 minFunction.computeForTofu(ImmutableList.of(float0, float1)));

    SoyData integer0 = IntegerData.forValue(-7);
    SoyData integer1 = IntegerData.forValue(-8);
    assertEquals(IntegerData.forValue(-8),
                 minFunction.computeForTofu(ImmutableList.of(integer0, integer1)));
  }
View Full Code Here

  public void testComputeForTofu() {

    RoundFunction roundFunction = new RoundFunction();

    SoyData float0 = FloatData.forValue(9753.141592653590);
    assertEquals(IntegerData.forValue(9753),
                 roundFunction.computeForTofu(ImmutableList.<SoyData>of(float0)));

    SoyData numDigitsAfterPt = IntegerData.ZERO;
    assertEquals(IntegerData.forValue(9753),
                 roundFunction.computeForTofu(ImmutableList.of(float0, numDigitsAfterPt)));

    numDigitsAfterPt = IntegerData.forValue(4);
    assertEquals(FloatData.forValue(9753.1416),
View Full Code Here

TOP

Related Classes of com.google.template.soy.data.SoyData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.