-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into truffle-head
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
- 9.1.2.0
- 9.1.1.0
- 9.1.0.0
- 9.0.5.0
- 9.0.4.0
- 9.0.3.0
- 9.0.1.0
- 9.0.0.0
- 9.0.0.0.rc2
- 9.0.0.0.rc1
Showing
219 changed files
with
4,859 additions
and
1,625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
core/src/main/java/org/jruby/internal/runtime/methods/InterpretedIRBodyMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package org.jruby.internal.runtime.methods; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.jruby.RubyModule; | ||
import org.jruby.ir.IRScope; | ||
import org.jruby.ir.interpreter.InterpreterContext; | ||
import org.jruby.ir.runtime.IRRuntimeHelpers; | ||
import org.jruby.runtime.Block; | ||
import org.jruby.runtime.ThreadContext; | ||
import org.jruby.runtime.Visibility; | ||
import org.jruby.runtime.builtin.IRubyObject; | ||
|
||
/** | ||
* Created by enebo on 2/6/15. | ||
*/ | ||
public class InterpretedIRBodyMethod extends InterpretedIRMethod { | ||
public InterpretedIRBodyMethod(IRScope method, RubyModule implementationClass) { | ||
super(method, Visibility.PUBLIC, implementationClass); | ||
|
||
this.box.callCount = -1; | ||
} | ||
|
||
@Override | ||
public List<String[]> getParameterList() { | ||
return new ArrayList<String[]>(); | ||
} | ||
|
||
@Override | ||
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) { | ||
return call(context, self, clazz, name, block); | ||
} | ||
|
||
@Override | ||
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, Block block) { | ||
if (IRRuntimeHelpers.isDebug()) doDebug(); | ||
|
||
InterpreterContext ic = ensureInstrsReady(); | ||
return ic.engine.interpret(context, self, ic, getImplementationClass().getMethodLocation(), name, block, null); | ||
} | ||
|
||
@Override | ||
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, Block block) { | ||
return call(context, self, clazz, name, block); | ||
} | ||
|
||
@Override | ||
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, IRubyObject arg1, Block block) { | ||
return call(context, self, clazz, name, block); | ||
} | ||
|
||
@Override | ||
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) { | ||
return call(context, self, clazz, name, block); | ||
} | ||
|
||
@Override | ||
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args) { | ||
return call(context, self, clazz, name, Block.NULL_BLOCK); | ||
} | ||
|
||
@Override | ||
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name) { | ||
return call(context, self, clazz, name, Block.NULL_BLOCK); | ||
} | ||
|
||
@Override | ||
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0) { | ||
return call(context, self, clazz, name, Block.NULL_BLOCK); | ||
} | ||
|
||
@Override | ||
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, IRubyObject arg1) { | ||
return call(context, self, clazz, name, Block.NULL_BLOCK); | ||
} | ||
|
||
@Override | ||
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { | ||
return call(context, self, clazz, name, Block.NULL_BLOCK); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
240 changes: 240 additions & 0 deletions
240
core/src/main/java/org/jruby/ir/interpreter/BodyInterpreterEngine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
package org.jruby.ir.interpreter; | ||
|
||
import org.jruby.RubyModule; | ||
import org.jruby.common.IRubyWarnings; | ||
import org.jruby.ir.IRScope; | ||
import org.jruby.ir.OpClass; | ||
import org.jruby.ir.Operation; | ||
import org.jruby.ir.instructions.CopyInstr; | ||
import org.jruby.ir.instructions.GetFieldInstr; | ||
import org.jruby.ir.instructions.Instr; | ||
import org.jruby.ir.instructions.JumpInstr; | ||
import org.jruby.ir.instructions.LineNumberInstr; | ||
import org.jruby.ir.instructions.NonlocalReturnInstr; | ||
import org.jruby.ir.instructions.ResultInstr; | ||
import org.jruby.ir.instructions.ReturnBase; | ||
import org.jruby.ir.instructions.RuntimeHelperCall; | ||
import org.jruby.ir.instructions.SearchConstInstr; | ||
import org.jruby.ir.instructions.TraceInstr; | ||
import org.jruby.ir.instructions.specialized.OneOperandArgNoBlockCallInstr; | ||
import org.jruby.ir.instructions.specialized.OneOperandArgNoBlockNoResultCallInstr; | ||
import org.jruby.ir.operands.Operand; | ||
import org.jruby.ir.operands.TemporaryFixnumVariable; | ||
import org.jruby.ir.operands.TemporaryFloatVariable; | ||
import org.jruby.ir.operands.Variable; | ||
import org.jruby.ir.runtime.IRRuntimeHelpers; | ||
import org.jruby.parser.StaticScope; | ||
import org.jruby.runtime.Block; | ||
import org.jruby.runtime.DynamicScope; | ||
import org.jruby.runtime.Helpers; | ||
import org.jruby.runtime.ThreadContext; | ||
import org.jruby.runtime.Visibility; | ||
import org.jruby.runtime.builtin.IRubyObject; | ||
import org.jruby.runtime.ivars.VariableAccessor; | ||
import org.jruby.runtime.opto.ConstantCache; | ||
|
||
/** | ||
* Created by enebo on 2/5/15. | ||
*/ | ||
public class BodyInterpreterEngine extends InterpreterEngine { | ||
@Override | ||
public IRubyObject interpret(ThreadContext context, IRubyObject self, InterpreterContext interpreterContext, RubyModule implClass, String name, Block block, Block.Type blockType) { | ||
Instr[] instrs = interpreterContext.getInstructions(); | ||
Object[] temp = interpreterContext.allocateTemporaryVariables(); | ||
int n = instrs.length; | ||
int ipc = 0; | ||
Object exception = null; | ||
|
||
StaticScope currScope = interpreterContext.getStaticScope(); | ||
DynamicScope currDynScope = context.getCurrentScope(); | ||
IRScope scope = currScope.getIRScope(); | ||
|
||
// Init profiling this scope | ||
boolean debug = IRRuntimeHelpers.isDebug(); | ||
|
||
// Enter the looooop! | ||
while (ipc < n) { | ||
Instr instr = instrs[ipc]; | ||
|
||
ipc++; | ||
|
||
Operation operation = instr.getOperation(); | ||
if (debug) { | ||
Interpreter.LOG.info("I: {}", instr); | ||
Interpreter.interpInstrsCount++; | ||
} | ||
|
||
try { | ||
switch (operation) { | ||
case RETURN: | ||
return (IRubyObject) retrieveOp(((ReturnBase) instr).getReturnValue(), context, self, currDynScope, currScope, temp); | ||
case NONLOCAL_RETURN: { | ||
NonlocalReturnInstr ri = (NonlocalReturnInstr)instr; | ||
IRubyObject rv = (IRubyObject)retrieveOp(ri.getReturnValue(), context, self, currDynScope, currScope, temp); | ||
return IRRuntimeHelpers.initiateNonLocalReturn(context, currDynScope, blockType, rv); | ||
} | ||
case LINE_NUM: | ||
context.setLine(((LineNumberInstr) instr).lineNumber); | ||
break; | ||
case RECV_SELF: | ||
break; | ||
case RECV_JRUBY_EXC: | ||
setResult(temp, currDynScope, ((ResultInstr) instr).getResult(), exception); | ||
break; | ||
case THROW: | ||
instr.interpret(context, currScope, currDynScope, self, temp); | ||
break; | ||
case PUSH_FRAME: | ||
context.preMethodFrameOnly(implClass, name, self, block); | ||
// Only the top-level script scope has PRIVATE visibility. | ||
// This is already handled as part of Interpreter.execute above. | ||
// Everything else is PUBLIC by default. | ||
context.setCurrentVisibility(Visibility.PUBLIC); | ||
break; | ||
case POP_FRAME: | ||
context.popFrame(); | ||
break; | ||
case PUSH_BINDING: | ||
// IMPORTANT: Preserve this update of currDynScope. | ||
// This affects execution of all instructions in this scope | ||
// which will now use the updated value of currDynScope. | ||
currDynScope = interpreterContext.newDynamicScope(context); | ||
context.pushScope(currDynScope); | ||
break; | ||
case POP_BINDING: | ||
context.popScope(); | ||
break; | ||
case LOAD_FRAME_CLOSURE: | ||
setResult(temp, currDynScope, instr, context.getFrameBlock()); | ||
break; | ||
case DEF_INST_METH: | ||
instr.interpret(context, currScope, currDynScope, self, temp); | ||
break; | ||
case PUT_CONST: | ||
instr.interpret(context, currScope, currDynScope, self, temp); | ||
break; | ||
case NORESULT_CALL_1O: { | ||
OneOperandArgNoBlockNoResultCallInstr call = (OneOperandArgNoBlockNoResultCallInstr) instr; | ||
IRubyObject r = (IRubyObject) retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp); | ||
IRubyObject o = (IRubyObject) call.getArg1().retrieve(context, self, currScope, currDynScope, temp); | ||
call.getCallSite().call(context, self, r, o); | ||
break; | ||
} | ||
case SEARCH_CONST: { | ||
SearchConstInstr sci = (SearchConstInstr) instr; | ||
ConstantCache cache = sci.getConstantCache(); | ||
Object result; | ||
if (!ConstantCache.isCached(cache)) { | ||
result = sci.cache(context, currScope, currDynScope, self, temp); | ||
} else { | ||
result = cache.value; | ||
} | ||
setResult(temp, currDynScope, sci.getResult(), result); | ||
break; | ||
} | ||
case PROCESS_MODULE_BODY: | ||
setResult(temp, currDynScope, ((ResultInstr) instr).getResult(), | ||
instr.interpret(context, currScope, currDynScope, self, temp)); | ||
break; | ||
case DEF_CLASS: | ||
setResult(temp, currDynScope, ((ResultInstr) instr).getResult(), | ||
instr.interpret(context, currScope, currDynScope, self, temp)); | ||
break; | ||
case INHERITANCE_SEARCH_CONST: | ||
setResult(temp, currDynScope, ((ResultInstr) instr).getResult(), | ||
instr.interpret(context, currScope, currDynScope, self, temp)); | ||
break; | ||
case DEF_MODULE: | ||
setResult(temp, currDynScope, ((ResultInstr) instr).getResult(), | ||
instr.interpret(context, currScope, currDynScope, self, temp)); | ||
break; | ||
case CALL_1O: { | ||
OneOperandArgNoBlockCallInstr call = (OneOperandArgNoBlockCallInstr) instr; | ||
IRubyObject r = (IRubyObject) retrieveOp(call.getReceiver(), context, self, currDynScope, currScope, temp); | ||
IRubyObject o = (IRubyObject) call.getArg1().retrieve(context, self, currScope, currDynScope, temp); | ||
setResult(temp, currDynScope, call.getResult(), call.getCallSite().call(context, self, r, o)); | ||
break; | ||
} | ||
case BNE: | ||
ipc = instr.interpretAndGetNewIPC(context, currDynScope, currScope, self, temp, ipc); | ||
break; | ||
case DEF_CLASS_METH: | ||
instr.interpret(context, currScope, currDynScope, self, temp); | ||
break; | ||
case LOAD_IMPLICIT_CLOSURE: | ||
setResult(temp, currDynScope, ((ResultInstr) instr).getResult(), block); | ||
break; | ||
case RECV_RUBY_EXC: // NO INTERP | ||
setResult(temp, currDynScope, ((ResultInstr) instr).getResult(), IRRuntimeHelpers.unwrapRubyException(exception)); | ||
break; | ||
case COPY: // NO INTERP | ||
setResult(temp, currDynScope, ((CopyInstr) instr).getResult(), | ||
retrieveOp(((CopyInstr) instr).getSource(), context, self, currDynScope, currScope, temp)); | ||
break; | ||
case JUMP: // NO INTERP | ||
ipc = ((JumpInstr)instr).getJumpTarget().getTargetPC(); | ||
break; | ||
case RUNTIME_HELPER: { // NO INTERP | ||
RuntimeHelperCall rhc = (RuntimeHelperCall)instr; | ||
setResult(temp, currDynScope, rhc.getResult(), | ||
rhc.callHelper(context, currScope, currDynScope, self, temp, blockType)); | ||
break; | ||
} | ||
case GET_FIELD: { // NO INTERP | ||
GetFieldInstr gfi = (GetFieldInstr)instr; | ||
IRubyObject object = (IRubyObject)gfi.getSource().retrieve(context, self, currScope, currDynScope, temp); | ||
VariableAccessor a = gfi.getAccessor(object); | ||
Object result = a == null ? null : (IRubyObject)a.get(object); | ||
if (result == null) { | ||
if (context.runtime.isVerbose()) { | ||
context.runtime.getWarnings().warning(IRubyWarnings.ID.IVAR_NOT_INITIALIZED, "instance variable " + gfi.getRef() + " not initialized"); | ||
} | ||
result = context.nil; | ||
} | ||
setResult(temp, currDynScope, gfi.getResult(), result); | ||
break; | ||
} | ||
case TRACE: { | ||
if (context.runtime.hasEventHooks()) { | ||
TraceInstr trace = (TraceInstr) instr; | ||
// FIXME: Try and statically generate END linenumber instead of hacking it. | ||
int linenumber = trace.getLinenumber() == -1 ? context.getLine()+1 : trace.getLinenumber(); | ||
|
||
context.trace(trace.getEvent(), trace.getName(), context.getFrameKlazz(), | ||
trace.getFilename(), linenumber); | ||
} | ||
break; | ||
} | ||
default: | ||
if (instr.getOperation().opClass == OpClass.BRANCH_OP) { | ||
ipc = instr.interpretAndGetNewIPC(context, currDynScope, currScope, self, temp, ipc); | ||
} else { | ||
Object result = instr.interpret(context, currScope, currDynScope, self, temp); | ||
|
||
if (instr instanceof ResultInstr) { | ||
setResult(temp, currDynScope, ((ResultInstr) instr).getResult(), result); | ||
} | ||
} | ||
} | ||
} catch (Throwable t) { | ||
ipc = instr.getRPC(); | ||
if (debug) { | ||
Interpreter.LOG.info("in : " + interpreterContext.getStaticScope().getIRScope() + ", caught Java throwable: " + t + "; excepting instr: " + instr); | ||
Interpreter.LOG.info("ipc for rescuer: " + ipc); | ||
} | ||
|
||
if (ipc == -1) { | ||
Helpers.throwException(t); | ||
} else { | ||
exception = t; | ||
} | ||
} | ||
} | ||
throw context.runtime.newRuntimeError("BUG: interpreter fell through to end unexpectedly"); | ||
} | ||
|
||
@Override | ||
public IRubyObject interpret(ThreadContext context, IRubyObject self, InterpreterContext interpreterContext, RubyModule implClass, String name, IRubyObject[] args, Block block, Block.Type blockType) { | ||
return interpret(context, self, interpreterContext, implClass, name, block, blockType); | ||
} | ||
} |
572 changes: 26 additions & 546 deletions
572
core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
612 changes: 612 additions & 0 deletions
612
core/src/main/java/org/jruby/ir/interpreter/InterpreterEngine.java
Large diffs are not rendered by default.
Oops, something went wrong.
1,076 changes: 1,076 additions & 0 deletions
1,076
core/src/main/java/org/jruby/ir/interpreter/SimpleMethodInterpreterEngine.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
core/src/test/java/org/jruby/embed/IsolatedScriptingContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.jruby.embed; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.fail; | ||
|
||
import java.net.URL; | ||
import java.net.URLClassLoader; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
public class IsolatedScriptingContainerTest { | ||
|
||
static ClassLoader cl; | ||
|
||
@BeforeClass | ||
public static void setupClassLoader() { | ||
cl = Thread.currentThread().getContextClassLoader(); | ||
// make sure we have classloader which does not find jruby | ||
ClassLoader c = new URLClassLoader( new URL[] {}, null ); | ||
try { | ||
c.loadClass( "org.jruby.embed.ScriptingContainer" ); | ||
fail( "this classloader shall not find jruby" ); | ||
} | ||
catch( ClassNotFoundException expected){} | ||
// set it as context classloader | ||
Thread.currentThread().setContextClassLoader( c ); | ||
} | ||
|
||
@AfterClass | ||
public static void restClassLoader() { | ||
Thread.currentThread().setContextClassLoader( cl ); | ||
} | ||
|
||
@Test | ||
public void testIsolatedScriptingContainer() throws Exception { | ||
// we do have an instance of "jruby" loaded via some other classloader | ||
//System.setProperty("jruby.debug.loadService", "true"); | ||
ScriptingContainer instance = new IsolatedScriptingContainer(); | ||
String result = instance.runScriptlet( "$LOAD_PATH" ).toString(); | ||
assertNotNull(result); | ||
|
||
assertEquals(instance.runScriptlet("JRuby.runtime.jruby_class_loader.parent" ), cl ); | ||
assertEquals(ScriptingContainer.class.getClassLoader(), cl); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# dummy to run IsolatedScriptingContainerTest | ||
module Gem | ||
class Specification | ||
def self.reset | ||
end | ||
def self.add_dir *args | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
. | ||
config.ru | ||
gems | ||
specifications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#-*- mode: ruby -*- | ||
|
||
# it is war-file | ||
packaging 'war' | ||
|
||
# get jruby dependencies | ||
properties( 'jruby.version' => '@project.version@', | ||
'jruby.plugins.version' => '1.0.7', | ||
'project.build.sourceEncoding' => 'utf-8', | ||
'public.dir' => '${basedir}/public' ) | ||
|
||
pom( 'org.jruby:jruby', '${jruby.version}' ) | ||
|
||
jar( 'org.jruby.rack:jruby-rack', '1.1.18', | ||
:exclusions => [ 'org.jruby:jruby-complete' ] ) | ||
|
||
|
||
# ruby-maven will dump an equivalent pom.xml | ||
properties[ 'tesla.dump.pom' ] = 'pom.xml' | ||
|
||
# a gem to be used | ||
gem 'flickraw', '0.9.7' | ||
|
||
repository( :url => 'http://rubygems-proxy.torquebox.org/releases', | ||
:id => 'rubygems-releases' ) | ||
|
||
jruby_plugin :gem, :includeRubygemsInResources => true, :includeLibDirectoryInResources => true, :jrubyVersion => '1.7.19' do | ||
execute_goal :initialize | ||
end | ||
|
||
# not really needed but for completeness: | ||
# pack the war with that ruby-like directory layout | ||
plugin( :war, '2.2', | ||
:warSourceDirectory => '${public.dir}' ) | ||
|
||
resource :directory => '${basedir}', :includes => [ 'config.ru', '.jrubydir' ] | ||
|
||
# start jetty for the tests | ||
plugin( 'org.eclipse.jetty:jetty-maven-plugin', '9.1.3.v20140225', | ||
:path => '/', | ||
:webAppSourceDirectory => '${public.dir}', | ||
:stopPort => 9999, | ||
:stopKey => 'foo' ) do | ||
execute_goal( 'start', :id => 'start jetty', :phase => 'pre-integration-test', :daemon => true ) | ||
execute_goal( 'stop', :id => 'stop jetty', :phase => 'post-integration-test' ) | ||
end | ||
|
||
# download files during the tests | ||
result = nil | ||
execute 'download', :phase => 'integration-test' do | ||
require 'open-uri' | ||
result = open( 'http://localhost:8080' ).string | ||
puts result | ||
end | ||
|
||
# verify the downloads | ||
execute 'check download', :phase => :verify do | ||
expected = 'hello world:' | ||
unless result.match( /^#{expected}/ ) | ||
raise "missed expected string in download: #{expected}" | ||
end | ||
expected = 'self: uri:classloader://config.ru' | ||
unless result.match( /#{expected}/ ) | ||
raise "missed expected string in download: #{expected}" | ||
end | ||
expected = 'PWD: uri:classloader://' | ||
unless result.match( /#{expected}/ ) | ||
raise "missed expected string in download: #{expected}" | ||
end | ||
expected = 'Gem.path: ."uri:classloader://",' | ||
unless result.match( /#{expected}/ ) | ||
raise "missed expected string in download: #{expected}" | ||
end | ||
# TODO get rid off this over normalization | ||
expected = 'uri:classloader:/gems/flickraw-0.9.7' | ||
unless result.match( /#{expected}/ ) | ||
raise "missed expected string in download: #{expected}" | ||
end | ||
end | ||
# vim: syntax=Ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#-*- mode: ruby -*- | ||
|
||
use Rack::ShowExceptions | ||
|
||
require 'hello_world' | ||
|
||
run lambda { |env| | ||
require 'flickraw' | ||
[ | ||
200, | ||
{ | ||
'Content-Type' => 'text/html', | ||
'Cache-Control' => 'public, max-age=86400' | ||
}, | ||
[ "self: #{__FILE__}\n", "PWD: #{Dir.pwd}\n", "Gem.path: #{Gem.path.inspect}\n", Gem.loaded_specs['flickraw'].gem_dir + "\n", HelloWorld.new + "\n" ] | ||
] | ||
} | ||
|
||
# vim: syntax=Ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'openssl' | ||
|
||
class HelloWorld < String | ||
def initialize | ||
super "hello world: #{OpenSSL::Random.random_bytes( 16 ).inspect}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>no_group_id_given</groupId> | ||
<artifactId>j2ee_jetty_rack</artifactId> | ||
<version>0.0.0</version> | ||
<packaging>war</packaging> | ||
<name>j2ee_jetty_rack</name> | ||
<properties> | ||
<jruby.version>@project.version@</jruby.version> | ||
<jruby.plugins.version>1.0.7</jruby.plugins.version> | ||
<tesla.dump.pom>pom.xml</tesla.dump.pom> | ||
<public.dir>${basedir}/public</public.dir> | ||
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding> | ||
<tesla.version>0.1.1</tesla.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jruby</groupId> | ||
<artifactId>jruby</artifactId> | ||
<version>${jruby.version}</version> | ||
<type>pom</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jruby.rack</groupId> | ||
<artifactId>jruby-rack</artifactId> | ||
<version>1.1.18</version> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>jruby-complete</artifactId> | ||
<groupId>org.jruby</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>rubygems</groupId> | ||
<artifactId>flickraw</artifactId> | ||
<version>0.9.7</version> | ||
<type>gem</type> | ||
</dependency> | ||
</dependencies> | ||
<repositories> | ||
<repository> | ||
<id>rubygems-releases</id> | ||
<url>http://rubygems-proxy.torquebox.org/releases</url> | ||
</repository> | ||
</repositories> | ||
<build> | ||
<resources> | ||
<resource> | ||
<directory>${basedir}</directory> | ||
<includes> | ||
<include>config.ru</include> | ||
<include>.jrubydir</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>de.saumya.mojo</groupId> | ||
<artifactId>gem-maven-plugin</artifactId> | ||
<version>${jruby.plugins.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>initialize</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<includeRubygemsInResources>true</includeRubygemsInResources> | ||
<includeLibDirectoryInResources>true</includeLibDirectoryInResources> | ||
<jrubyVersion>1.7.19</jrubyVersion> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>2.2</version> | ||
<configuration> | ||
<warSourceDirectory>${public.dir}</warSourceDirectory> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-maven-plugin</artifactId> | ||
<version>9.1.3.v20140225</version> | ||
<executions> | ||
<execution> | ||
<id>start jetty</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>start</goal> | ||
</goals> | ||
<configuration> | ||
<daemon>true</daemon> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>stop jetty</id> | ||
<phase>post-integration-test</phase> | ||
<goals> | ||
<goal>stop</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<path>/</path> | ||
<webAppSourceDirectory>${public.dir}</webAppSourceDirectory> | ||
<stopPort>9999</stopPort> | ||
<stopKey>foo</stopKey> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.tesla.polyglot</groupId> | ||
<artifactId>tesla-polyglot-maven-plugin</artifactId> | ||
<version>${tesla.version}</version> | ||
<executions> | ||
<execution> | ||
<id>download</id> | ||
<phase>integration-test</phase> | ||
<goals> | ||
<goal>execute</goal> | ||
</goals> | ||
<configuration> | ||
<taskId>download</taskId> | ||
<nativePom>Mavenfile</nativePom> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>check download</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>execute</goal> | ||
</goals> | ||
<configuration> | ||
<taskId>check download</taskId> | ||
<nativePom>Mavenfile</nativePom> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.tesla.polyglot</groupId> | ||
<artifactId>tesla-polyglot-ruby</artifactId> | ||
<version>${tesla.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
classes | ||
config.ru |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE web-app PUBLIC | ||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" | ||
"http://java.sun.com/dtd/web-app_2_3.dtd"> | ||
<web-app> | ||
<context-param> | ||
<param-name>jruby.rack.layout_class</param-name> | ||
<param-value>JRuby::Rack::ClassPathLayout</param-value> | ||
</context-param> | ||
|
||
<filter> | ||
<filter-name>RackFilter</filter-name> | ||
<filter-class>org.jruby.rack.RackFilter</filter-class> | ||
</filter> | ||
<filter-mapping> | ||
<filter-name>RackFilter</filter-name> | ||
<url-pattern>/*</url-pattern> | ||
</filter-mapping> | ||
|
||
<listener> | ||
<listener-class>org.jruby.rack.RackServletContextListener</listener-class> | ||
</listener> | ||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
. | ||
config.ru | ||
gems | ||
specifications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#-*- mode: ruby -*- | ||
|
||
# it is war-file | ||
packaging 'war' | ||
|
||
# get jruby dependencies | ||
properties( 'jruby.version' => '@project.version@', | ||
'jruby.home' => '../../../../../', | ||
'jruby.plugins.version' => '1.0.3', | ||
'project.build.sourceEncoding' => 'utf-8', | ||
'public.dir' => '${basedir}/public' ) | ||
|
||
pom( 'org.jruby:jruby', '${jruby.version}' ) | ||
|
||
jar( 'org.jruby.rack:jruby-rack', '1.1.18', | ||
:exclusions => [ 'org.jruby:jruby-complete' ] ) | ||
|
||
|
||
# ruby-maven will dump an equivalent pom.xml | ||
properties[ 'tesla.dump.pom' ] = 'pom.xml' | ||
|
||
# a gem to be used | ||
gem 'flickraw', '0.9.7' | ||
|
||
repository( :url => 'http://rubygems-proxy.torquebox.org/releases', | ||
:id => 'rubygems-releases' ) | ||
|
||
jruby_plugin :gem, :includeRubygemsInResources => true, :includeLibDirectoryInResources => true, :jrubyVersion => '1.7.19' do | ||
execute_goal :initialize | ||
end | ||
|
||
# not really needed but for completeness: | ||
# pack the war with that ruby-like directory layout | ||
plugin( :war, '2.2', | ||
:warSourceDirectory => '${public.dir}' ) | ||
|
||
resource :directory => '${basedir}', :includes => [ 'config.ru', '.jrubydir' ] | ||
|
||
# start tomcat for the tests | ||
plugin( 'org.codehaus.mojo:tomcat-maven-plugin', '1.1', | ||
:fork => true, :path => '/', | ||
:warSourceDirectory => '${public.dir}' ) do | ||
execute_goals( 'run', | ||
:id => 'run-tomcat', | ||
:phase => 'pre-integration-test' ) | ||
end | ||
|
||
# download files during the tests | ||
execute 'download', :phase => 'integration-test' do | ||
require 'open-uri' | ||
result = open( 'http://localhost:8080' ).string | ||
File.open( 'result', 'w' ) { |f| f.puts result } | ||
puts result | ||
end | ||
|
||
# verify the downloads | ||
execute 'check download', :phase => :verify do | ||
result = File.read( 'result' ) | ||
expected = 'hello world:' | ||
unless result.match( /^#{expected}/ ) | ||
raise "missed expected string in download: #{expected}" | ||
end | ||
expected = 'self: uri:classloader://config.ru' | ||
unless result.match( /#{expected}/ ) | ||
raise "missed expected string in download: #{expected}" | ||
end | ||
expected = 'PWD: uri:classloader://' | ||
unless result.match( /#{expected}/ ) | ||
raise "missed expected string in download: #{expected}" | ||
end | ||
expected = 'Gem.path: ."uri:classloader://",' | ||
unless result.match( /#{expected}/ ) | ||
raise "missed expected string in download: #{expected}" | ||
end | ||
# TODO get rid off this over normalization | ||
#expected = 'uri:classloader:/gems/flickraw-0.9.7' | ||
# TODO find out why travis find the gem on filesystem | ||
expected = 'target/classes/gems/flickraw-0.9.7' | ||
unless result.match( /#{expected}/ ) | ||
raise "missed expected string in download: #{expected}" | ||
end | ||
end | ||
# vim: syntax=Ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#-*- mode: ruby -*- | ||
|
||
use Rack::ShowExceptions | ||
|
||
require 'hello_world' | ||
|
||
run lambda { |env| | ||
require 'flickraw' | ||
[ | ||
200, | ||
{ | ||
'Content-Type' => 'text/html', | ||
'Cache-Control' => 'public, max-age=86400' | ||
}, | ||
[ "self: #{__FILE__}\n", "PWD: #{Dir.pwd}\n", "Gem.path: #{Gem.path.inspect}\n","Gem::Specification.dirs: #{Gem::Specification.dirs.inspect}\n", Gem.loaded_specs['flickraw'].gem_dir + "\n", HelloWorld.new + "\n" ] | ||
] | ||
} | ||
|
||
# vim: syntax=Ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'openssl' | ||
|
||
class HelloWorld < String | ||
def initialize | ||
super "hello world: #{OpenSSL::Random.random_bytes( 16 ).inspect}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>no_group_id_given</groupId> | ||
<artifactId>j2ee_tomcat_rack</artifactId> | ||
<version>0.0.0</version> | ||
<packaging>war</packaging> | ||
<name>j2ee_tomcat_rack</name> | ||
<properties> | ||
<jruby.home>../../../../../</jruby.home> | ||
<jruby.version>@project.version@</jruby.version> | ||
<jruby.plugins.version>1.0.3</jruby.plugins.version> | ||
<tesla.dump.pom>pom.xml</tesla.dump.pom> | ||
<public.dir>${basedir}/public</public.dir> | ||
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding> | ||
<tesla.version>0.1.1</tesla.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jruby</groupId> | ||
<artifactId>jruby</artifactId> | ||
<version>${jruby.version}</version> | ||
<type>pom</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jruby.rack</groupId> | ||
<artifactId>jruby-rack</artifactId> | ||
<version>1.1.18</version> | ||
<exclusions> | ||
<exclusion> | ||
<artifactId>jruby-complete</artifactId> | ||
<groupId>org.jruby</groupId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>rubygems</groupId> | ||
<artifactId>flickraw</artifactId> | ||
<version>0.9.7</version> | ||
<type>gem</type> | ||
</dependency> | ||
</dependencies> | ||
<repositories> | ||
<repository> | ||
<id>rubygems-releases</id> | ||
<url>http://rubygems-proxy.torquebox.org/releases</url> | ||
</repository> | ||
</repositories> | ||
<build> | ||
<resources> | ||
<resource> | ||
<directory>${basedir}</directory> | ||
<includes> | ||
<include>config.ru</include> | ||
<include>.jrubydir</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>de.saumya.mojo</groupId> | ||
<artifactId>gem-maven-plugin</artifactId> | ||
<version>${jruby.plugins.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>initialize</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<includeRubygemsInResources>true</includeRubygemsInResources> | ||
<includeLibDirectoryInResources>true</includeLibDirectoryInResources> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>2.2</version> | ||
<configuration> | ||
<warSourceDirectory>${public.dir}</warSourceDirectory> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>tomcat-maven-plugin</artifactId> | ||
<version>1.1</version> | ||
<executions> | ||
<execution> | ||
<id>run-tomcat</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<fork>true</fork> | ||
<path>/</path> | ||
<warSourceDirectory>${public.dir}</warSourceDirectory> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.tesla.polyglot</groupId> | ||
<artifactId>tesla-polyglot-maven-plugin</artifactId> | ||
<version>${tesla.version}</version> | ||
<executions> | ||
<execution> | ||
<id>download</id> | ||
<phase>integration-test</phase> | ||
<goals> | ||
<goal>execute</goal> | ||
</goals> | ||
<configuration> | ||
<taskId>download</taskId> | ||
<nativePom>Mavenfile</nativePom> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>check download</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>execute</goal> | ||
</goals> | ||
<configuration> | ||
<taskId>check download</taskId> | ||
<nativePom>Mavenfile</nativePom> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.tesla.polyglot</groupId> | ||
<artifactId>tesla-polyglot-ruby</artifactId> | ||
<version>${tesla.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
2 changes: 2 additions & 0 deletions
2
maven/jruby/src/it/j2ee_tomcat_rack/public/WEB-INF/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
classes | ||
config.ru |
22 changes: 22 additions & 0 deletions
22
maven/jruby/src/it/j2ee_tomcat_rack/public/WEB-INF/web.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE web-app PUBLIC | ||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" | ||
"http://java.sun.com/dtd/web-app_2_3.dtd"> | ||
<web-app> | ||
<context-param> | ||
<param-name>jruby.rack.layout_class</param-name> | ||
<param-value>JRuby::Rack::ClassPathLayout</param-value> | ||
</context-param> | ||
|
||
<filter> | ||
<filter-name>RackFilter</filter-name> | ||
<filter-class>org.jruby.rack.RackFilter</filter-class> | ||
</filter> | ||
<filter-mapping> | ||
<filter-name>RackFilter</filter-name> | ||
<url-pattern>/*</url-pattern> | ||
</filter-mapping> | ||
|
||
<listener> | ||
<listener-class>org.jruby.rack.RackServletContextListener</listener-class> | ||
</listener> | ||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,311 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>no_group_id_given</groupId> | ||
<artifactId>runnable</artifactId> | ||
<version>0.0.0</version> | ||
<name>runnable</name> | ||
<properties> | ||
<tesla.dump.readOnly>true</tesla.dump.readOnly> | ||
<jruby.version>@project.version@</jruby.version> | ||
<jruby.plugins.version>1.0.8</jruby.plugins.version> | ||
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding> | ||
<tesla.dump.pom>pom.xml</tesla.dump.pom> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>rubygems</groupId> | ||
<artifactId>bundler</artifactId> | ||
<version>1.7.7</version> | ||
<type>gem</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jruby</groupId> | ||
<artifactId>jruby</artifactId> | ||
<version>${jruby.version}</version> | ||
<type>pom</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>de.saumya.mojo</groupId> | ||
<artifactId>jruby-mains</artifactId> | ||
<version>0.1.0</version> | ||
</dependency> | ||
</dependencies> | ||
<repositories> | ||
<repository> | ||
<id>rubygems-releases</id> | ||
<url>http://rubygems-proxy.torquebox.org/releases</url> | ||
</repository> | ||
</repositories> | ||
<build> | ||
<directory>pkg</directory> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.4</version> | ||
<executions> | ||
<execution> | ||
<phase>prepare-package</phase> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<outputDirectory>.</outputDirectory> | ||
<finalName>runnable</finalName> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>2.4</version> | ||
<configuration> | ||
<filesets> | ||
<fileset> | ||
<directory>.</directory> | ||
<includes> | ||
<include>runnable.jar</include> | ||
<include>*/**/*.jar</include> | ||
</includes> | ||
</fileset> | ||
</filesets> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>de.saumya.mojo</groupId> | ||
<artifactId>gem-maven-plugin</artifactId> | ||
<version>${jruby.plugins.version}</version> | ||
<executions> | ||
<execution> | ||
<id>install gems</id> | ||
<goals> | ||
<goal>initialize</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<goals> | ||
<goal>generate-resources</goal> | ||
<goal>process-resources</goal> | ||
</goals> | ||
<configuration> | ||
<includeBinStubs>true</includeBinStubs> | ||
<includeRubyResources> | ||
<includeRubyResource>config.ru</includeRubyResource> | ||
<includeRubyResource>*file</includeRubyResource> | ||
<includeRubyResource>*file.lock</includeRubyResource> | ||
<includeRubyResource>.jbundler/classpath.rb</includeRubyResource> | ||
<includeRubyResource>lib/**</includeRubyResource> | ||
<includeRubyResource>app/**</includeRubyResource> | ||
<includeRubyResource>config/**</includeRubyResource> | ||
<includeRubyResource>vendor/**</includeRubyResource> | ||
<includeRubyResource>spec/**</includeRubyResource> | ||
</includeRubyResources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<jrubyVersion>1.7.19</jrubyVersion> | ||
<includeRubygemsInResources>true</includeRubygemsInResources> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy jar dependencies</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>copy</goal> | ||
</goals> | ||
<configuration> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>org.bouncycastle</groupId> | ||
<artifactId>bcpkix-jdk15on</artifactId> | ||
<type>jar</type> | ||
<version>1.49</version> | ||
<classifier /> | ||
<outputDirectory>${project.build.outputDirectory}/org/bouncycastle/bcpkix-jdk15on/1.49</outputDirectory> | ||
</artifactItem> | ||
<artifactItem> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<type>jar</type> | ||
<version>1.6.4</version> | ||
<classifier /> | ||
<outputDirectory>${project.build.outputDirectory}/org/slf4j/slf4j-simple/1.6.4</outputDirectory> | ||
</artifactItem> | ||
<artifactItem> | ||
<groupId>org.bouncycastle</groupId> | ||
<artifactId>bcprov-jdk15on</artifactId> | ||
<type>jar</type> | ||
<version>1.49</version> | ||
<classifier /> | ||
<outputDirectory>${project.build.outputDirectory}/org/bouncycastle/bcprov-jdk15on/1.49</outputDirectory> | ||
</artifactItem> | ||
<artifactItem> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<type>jar</type> | ||
<version>1.6.4</version> | ||
<classifier /> | ||
<outputDirectory>${project.build.outputDirectory}/org/slf4j/slf4j-api/1.6.4</outputDirectory> | ||
</artifactItem> | ||
</artifactItems> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>pack</id> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<artifactSet> | ||
<excludes> | ||
<exclude>rubygems:*</exclude> | ||
</excludes> | ||
</artifactSet> | ||
<transformers> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||
<mainClass>de.saumya.mojo.mains.JarMain</mainClass> | ||
</transformer> | ||
</transformers> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.2</version> | ||
<executions> | ||
<execution> | ||
<id>rake -T</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<arguments> | ||
<argument>-jar</argument> | ||
<argument>runnable.jar</argument> | ||
<argument>-S</argument> | ||
<argument>rake</argument> | ||
<argument>-T</argument> | ||
</arguments> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>rspec</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<arguments> | ||
<argument>-jar</argument> | ||
<argument>runnable.jar</argument> | ||
<argument>-S</argument> | ||
<argument>rspec</argument> | ||
</arguments> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<executable>java</executable> | ||
<environmentVariables> | ||
<PATH>${basedir}</PATH> | ||
<HOME>${basedir}</HOME> | ||
<GEM_PATH>${basedir}</GEM_PATH> | ||
<GEM_HOME>${basedir}</GEM_HOME> | ||
</environmentVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<profiles> | ||
<profile> | ||
<id>gemfile</id> | ||
<activation> | ||
<file> | ||
<missing>Gemfile.lock</missing> | ||
</file> | ||
</activation> | ||
<dependencies> | ||
<dependency> | ||
<groupId>rubygems</groupId> | ||
<artifactId>rspec</artifactId> | ||
<version>[2.14,2.99999]</version> | ||
<type>gem</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>rubygems</groupId> | ||
<artifactId>rake</artifactId> | ||
<version>[10.3,10.99999]</version> | ||
<type>gem</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>rubygems</groupId> | ||
<artifactId>jbundler</artifactId> | ||
<version>0.7.1</version> | ||
<type>gem</type> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
<profile> | ||
<id>gemfile_lock</id> | ||
<activation> | ||
<file> | ||
<exists>Gemfile.lock</exists> | ||
</file> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>de.saumya.mojo</groupId> | ||
<artifactId>gem-maven-plugin</artifactId> | ||
<version>${jruby.plugins.version}</version> | ||
<executions> | ||
<execution> | ||
<id>install gem sets for compile</id> | ||
<phase>initialize</phase> | ||
<goals> | ||
<goal>sets</goal> | ||
</goals> | ||
<configuration> | ||
<scope>compile</scope> | ||
<gems> | ||
<rspec>2.99.0</rspec> | ||
<rspec-core>2.99.2</rspec-core> | ||
<rspec-expectations>2.99.2</rspec-expectations> | ||
<diff-lcs>1.2.5</diff-lcs> | ||
<rspec-mocks>2.99.2</rspec-mocks> | ||
<rake>10.3.2</rake> | ||
<jbundler>0.7.1</jbundler> | ||
<jar-dependencies>0.1.7</jar-dependencies> | ||
<maven-tools>1.0.7</maven-tools> | ||
<virtus>1.0.3</virtus> | ||
<axiom-types>0.1.1</axiom-types> | ||
<descendants_tracker>0.0.4</descendants_tracker> | ||
<thread_safe>0.3.4</thread_safe> | ||
<ice_nine>0.11.0</ice_nine> | ||
<coercible>1.0.0</coercible> | ||
<equalizer>0.0.9</equalizer> | ||
<ruby-maven>3.1.1.0.8</ruby-maven> | ||
<ruby-maven-libs>3.1.1</ruby-maven-libs> | ||
</gems> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
spec/regression/GH-2182_struct_inspect_has_ascii_encoding_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- encoding: utf-8 -*- | ||
|
||
# https://github.com/jruby/jruby/issues/2182 | ||
if RUBY_VERSION > '1.9' | ||
describe 'Struct#inspect' do | ||
it 'returns correct value' do | ||
s1 = Struct.new(:aa).new("ΆἅἇἈ") | ||
s1.inspect.should == "#<struct aa=\"ΆἅἇἈ\">" | ||
s1.inspect.encoding.should == Encoding::UTF_8 | ||
|
||
s2 = Struct.new(:a, :b).new("ΆἅἇἈ", "abc") | ||
s2.inspect.should == "#<struct a=\"ΆἅἇἈ\", b=\"abc\">" | ||
s2.inspect.encoding.should == Encoding::UTF_8 | ||
|
||
s3 = Struct.new(:b).new("abc") | ||
s3.inspect.should == "#<struct b=\"abc\">" | ||
s3.inspect.encoding.should == Encoding::ASCII_8BIT | ||
|
||
s4 = Struct.new(:"ΆἅἇἈ").new("aa") | ||
s4.inspect.should == "#<struct ΆἅἇἈ=\"aa\">" | ||
s4.inspect.encoding.should == Encoding::UTF_8 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,3 @@ | |
expect(r1).to eq(r2) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,4 @@ | ||
fails:String#each_line splits using default newline separator when none is specified | ||
fails:String#each_line splits self using the supplied record separator and passes each substring to the block | ||
fails:String#each_line taints substrings that are passed to the block if self is tainted | ||
fails:String#each_line passes self as a whole to the block if the separator is nil | ||
fails:String#each_line yields paragraphs (broken by 2 or more successive newlines) when passed '' | ||
fails:String#each_line uses $/ as the separator when none is given | ||
fails:String#each_line yields subclass instances for subclasses | ||
fails:String#each_line returns self | ||
fails:String#each_line tries to convert the separator to a string using to_str | ||
fails:String#each_line does not care if the string is modified while substituting | ||
fails:String#each_line raises a TypeError when the separator can't be converted to a string | ||
fails:String#each_line accepts a string separator | ||
fails:String#each_line raises a TypeError when the separator is a symbol | ||
fails:String#each_line returns an enumerator when no block given |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
fails:The super keyword calls the correct method when the method visibility is modified | ||
fails:The super keyword supers up appropriate name even if used for multiple method names | ||
fails:The super keyword passes along modified rest args when they weren't originally empty | ||
fails:The super keyword passes along modified rest args when they were originally empty | ||
fails:The super keyword raises a RuntimeError when called with implicit arguments from a method defined with define_method | ||
fails:The super keyword invokes methods from a chain of anonymous modules | ||
fails:The super keyword calls method_missing when a superclass method is not found | ||
fails:The super keyword sees the included version of a module a method is alias from |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fails:ERB#filename raises an exception if there are errors processing content | ||
fails:ERB#filename uses '(erb)' as filename when filename is not set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:ERB.new forget local variables defined previous one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fails:ERB#result is able to h() or u() if ERB::Util is included |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fails:ERB#run print the result of compiled ruby code | ||
fails:ERB#run is able to h() or u() if ERB::Util is included | ||
fails:ERB#run use TOPLEVEL_BINDING if binding is not passed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fails:ERB::Util.h escape (& < > " ') to (& < > " ') | ||
fails:ERB::Util.h not escape characters except (& < > " ') | ||
fails:ERB::Util.h return empty string when argument is nil | ||
fails:ERB::Util.h returns string when argument is number | ||
fails:ERB::Util.h returns string when argument is boolean |
5 changes: 5 additions & 0 deletions
5
spec/truffle/tags/rubysl/rubysl-erb/spec/util/html_escape_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fails:ERB::Util.html_escape escape (& < > " ') to (& < > " ') | ||
fails:ERB::Util.html_escape not escape characters except (& < > " ') | ||
fails:ERB::Util.html_escape return empty string when argument is nil | ||
fails:ERB::Util.html_escape returns string when argument is number | ||
fails:ERB::Util.html_escape returns string when argument is boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fails:ERB::Util.u encode characters | ||
fails:ERB::Util.u encode unicode string | ||
fails:ERB::Util.u returns empty string when argument is nil | ||
fails:ERB::Util.u returns string when argument is number | ||
fails:ERB::Util.u returns string when argument is boolean |
5 changes: 5 additions & 0 deletions
5
spec/truffle/tags/rubysl/rubysl-erb/spec/util/url_encode_tags.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fails:ERB::Util.url_encode encode characters | ||
fails:ERB::Util.url_encode encode unicode string | ||
fails:ERB::Util.url_encode returns empty string when argument is nil | ||
fails:ERB::Util.url_encode returns string when argument is number | ||
fails:ERB::Util.url_encode returns string when argument is boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,35 @@ | ||
# encoding: UTF-8 | ||
require 'test/unit' | ||
require 'java' | ||
|
||
class TestPrimitiveToJava < Test::Unit::TestCase | ||
|
||
def setup; super; require 'java' end | ||
|
||
def test_primitive_conversion | ||
t = Time.now | ||
date = t.to_java(java.util.Date) | ||
|
||
assert_equal(t.to_i, date.time / 1000, "Ruby time #{t} not converted to java date correctly: #{date}") | ||
end | ||
|
||
def test_char_conversion | ||
str = 'a' | ||
char = str.to_java(:char) | ||
assert_instance_of Java::JavaLang::Character, char | ||
|
||
str = ' ' | ||
char = str.to_java(Java::char) | ||
assert_equal 32, char.charValue | ||
|
||
str = '0' | ||
char = str.to_java(java.lang.Character) | ||
assert_equal 48.to_java(:char), char | ||
|
||
assert_equal 228, 'ä'.to_java(:char).charValue unless RUBY_VERSION.index('1.8') == 0 | ||
|
||
assert_raises(ArgumentError) { ''.to_java(:char) } | ||
assert_raises(ArgumentError) { 'už'.to_java('java.lang.Character') } | ||
'už'[1].to_java('java.lang.Character') unless RUBY_VERSION.index('1.8') == 0 | ||
end | ||
|
||
end |
Oops, something went wrong.