示例#1
0
  /** Test of getProgram method, of class Jsr223JRubyEngineFactory. */
  @Test
  public void testGetProgram() {
    logger1.info("getProgram");
    String[] statements = {"1.upto(7) {|i| print i, \" \"}", "hh = {\"p\" => 3.14, \"e\" => 2.22}"};
    System.setProperty("org.jruby.embed.localcontext.scope", "singlethread");
    JRubyEngineFactory instance = new JRubyEngineFactory();
    String expResult = "1.upto(7) {|i| print i, \" \"}\nhh = {\"p\" => 3.14, \"e\" => 2.22}\n";
    String result = instance.getProgram(statements);
    assertEquals(expResult, result);

    instance = null;
  }