Esempio n. 1
0
  @Test
  public void testBuildInCall() {

    final class Make {
      String make(String in, String args) {
        if (Length.len(args) == 0) {
          args = "123";
        }
        return String.format("%1$s(%2$s)", in, args);
      }
    }
    final Make make = new Make();

    final Set<String> strings = StatementParserBase.buildIns(ScriptWriterHelper.buildIns());
    // the `print` statement itself is not detected as isPrint...remove it from iteration
    strings.remove("print");
    strings.remove("printf");
    final int length = Length.len(strings);
    final String[] array = new String[length * 3];
    int i = 0;
    for (String s : strings) {
      array[i++] = make.make(s, "someValue()");
      array[i++] = make.make(s, null);
      array[i++] = make.make(s, "new String[] { null }");
    }

    check(new StatementExecution(null, true), array);
  }
Esempio n. 2
0
 String make(String in, String args) {
   if (Length.len(args) == 0) {
     args = "123";
   }
   return String.format("%1$s(%2$s)", in, args);
 }