Package com.google.template.soy.javasrc.restricted

Examples of com.google.template.soy.javasrc.restricted.JavaExpr



  public void testComputeForJavaSrc() {

    assertEquals(
        new JavaExpr(
            "com.google.template.soy.data.restricted.StringData.forValue(\"right\")",
            StringData.class, Integer.MAX_VALUE),
        BIDI_END_EDGE_FUNCTION_FOR_STATIC_LTR.computeForJavaSrc(ImmutableList.<JavaExpr>of()));
    assertEquals(
        new JavaExpr(
            "com.google.template.soy.data.restricted.StringData.forValue(\"left\")",
            StringData.class, Integer.MAX_VALUE),
        BIDI_END_EDGE_FUNCTION_FOR_STATIC_RTL.computeForJavaSrc(ImmutableList.<JavaExpr>of()));
    assertEquals(
        new JavaExpr(
            "com.google.template.soy.data.restricted.StringData.forValue(" +
                "com.google.template.soy.internal.i18n.SoyBidiUtils.getBidiFormatter(" +
                "IS_RTL?-1:1).endEdge())",
            StringData.class, Integer.MAX_VALUE),
        BIDI_END_EDGE_FUNCTION_FOR_ISRTL_CODE_SNIPPET.computeForJavaSrc(
View Full Code Here



  public void testComputeForJavaSrc() {

    IsNonnullFunction isNonnullFunction = new IsNonnullFunction();
    JavaExpr expr = new JavaExpr("JAVA_CODE", FloatData.class, Integer.MAX_VALUE);
    assertEquals(
        new JavaExpr(
            "com.google.template.soy.javasrc.codedeps.SoyUtils.$$isNonnull(JAVA_CODE)",
            BooleanData.class, Integer.MAX_VALUE),
        isNonnullFunction.computeForJavaSrc(ImmutableList.of(expr)));
  }
View Full Code Here


  public void testComputeForJavaSrc() {

    RandomIntFunction randomIntFunction = new RandomIntFunction();
    JavaExpr argExpr = new JavaExpr("JAVA_CODE", SoyData.class, Integer.MAX_VALUE);
    assertEquals(
        new JavaExpr(
            "com.google.template.soy.data.restricted.IntegerData.forValue(" +
                "(int) Math.floor(Math.random() * JAVA_CODE.integerValue()))",
            IntegerData.class, Integer.MAX_VALUE),
        randomIntFunction.computeForJavaSrc(ImmutableList.of(argExpr)));
  }
View Full Code Here


  public void testComputeForJavaSrc() {

    StrContainsFunction f = new StrContainsFunction();
    JavaExpr arg0 = new JavaExpr("A", StringData.class, Integer.MAX_VALUE);
    JavaExpr arg1 = new JavaExpr("B", StringData.class, Integer.MAX_VALUE);
    assertEquals(
        new JavaExpr(
            "com.google.template.soy.data.restricted.BooleanData.forValue((A).contains(B))",
            BooleanData.class, Integer.MAX_VALUE),
        f.computeForJavaSrc(ImmutableList.of(arg0, arg1)));
  }
View Full Code Here

  public void testComputeForJavaSrc() {

    MinFunction minFunction = new MinFunction();

    JavaExpr expr0 = new JavaExpr("JAVA_CODE_0", IntegerData.class, Integer.MAX_VALUE);
    JavaExpr expr1 = new JavaExpr("JAVA_CODE_1", IntegerData.class, Integer.MAX_VALUE);
    assertEquals(
        new JavaExpr(
            "com.google.template.soy.data.restricted.IntegerData.forValue(" +
                "Math.min(JAVA_CODE_0.integerValue(), JAVA_CODE_1.integerValue()))",
            IntegerData.class, Integer.MAX_VALUE),
        minFunction.computeForJavaSrc(ImmutableList.of(expr0, expr1)));

    expr0 = new JavaExpr("JAVA_CODE_0", FloatData.class, Integer.MAX_VALUE);
    expr1 = new JavaExpr("JAVA_CODE_1", FloatData.class, Integer.MAX_VALUE);
    assertEquals(
        new JavaExpr(
            "com.google.template.soy.data.restricted.FloatData.forValue(" +
                "Math.min(JAVA_CODE_0.floatValue(), JAVA_CODE_1.floatValue()))",
            FloatData.class, Integer.MAX_VALUE),
        minFunction.computeForJavaSrc(ImmutableList.of(expr0, expr1)));

    expr0 = new JavaExpr("JAVA_CODE_0", IntegerData.class, Integer.MAX_VALUE);
    expr1 = new JavaExpr("JAVA_CODE_1", FloatData.class, Integer.MAX_VALUE);
    assertEquals(
        new JavaExpr(
            "com.google.template.soy.data.restricted.FloatData.forValue(" +
                "Math.min(JAVA_CODE_0.floatValue(), JAVA_CODE_1.floatValue()))",
            FloatData.class, Integer.MAX_VALUE),
        minFunction.computeForJavaSrc(ImmutableList.of(expr0, expr1)));

    expr0 = new JavaExpr("JAVA_CODE_0", NumberData.class, Integer.MAX_VALUE);
    expr1 = new JavaExpr("JAVA_CODE_1", SoyData.class, Integer.MAX_VALUE);
    assertEquals(
        new JavaExpr(
            "com.google.template.soy.javasrc.codedeps.SoyUtils.$$min(" +
                "JAVA_CODE_0," +
                " (com.google.template.soy.data.restricted.NumberData) JAVA_CODE_1)",
            NumberData.class, Integer.MAX_VALUE),
        minFunction.computeForJavaSrc(ImmutableList.of(expr0, expr1)));
View Full Code Here

TOP

Related Classes of com.google.template.soy.javasrc.restricted.JavaExpr

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.