Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4cdc6e92849f
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c89c87c30728
Choose a head ref
  • 3 commits
  • 7 files changed
  • 1 contributor

Commits on Apr 9, 2015

  1. Copy the full SHA
    4d71f56 View commit details
  2. [Truffle] Implement STDOUT.tty?

    * Allows MSpec to use the spinner StringFormatter
    * Less RubySpec exclusions
    eregon committed Apr 9, 2015
    Copy the full SHA
    49f15af View commit details
  3. [Truffle] Add tag for CI.

    eregon committed Apr 9, 2015
    Copy the full SHA
    c89c87c View commit details
1 change: 1 addition & 0 deletions spec/truffle/tags/core/filetest/sticky_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
fails:FileTest.sticky? accepts an object that has a #to_path method
fails:FileTest.sticky? returns false if the file dies not exist
fails:FileTest.sticky? returns true if the named file has the sticky bit, otherwise false
1 change: 1 addition & 0 deletions spec/truffle/tags/core/kernel/autoload_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fails:Kernel.autoload sets the autoload constant in Object's constant table
fails:Kernel.autoload calls #to_path on non-String filenames
fails(locale problem on CI):Kernel#autoload when Object is frozen raises a RuntimeError before defining the constant
slow:Kernel#autoload when Object is frozen raises a RuntimeError before defining the constant
7 changes: 0 additions & 7 deletions spec/truffle/truffle.mspec
Original file line number Diff line number Diff line change
@@ -20,13 +20,6 @@ class MSpecScript
# require 'socket'
"^spec/ruby/core/file/socket_spec.rb",

# FileTest in describe
"^spec/ruby/core/filetest",

# STDOUT.tty?
"^spec/ruby/core/io/tty_spec.rb",
"^spec/ruby/core/io/isatty_spec.rb",

# require 'fcntl'
"^spec/ruby/core/io/reopen_spec.rb",

Original file line number Diff line number Diff line change
@@ -252,7 +252,7 @@ public static void join(StringBuilder builder, Object[] parts) {
}
}

@CoreMethod(names = "open", onSingleton = true, needsBlock = true, required = 2)
@CoreMethod(names = "open", onSingleton = true, needsBlock = true, required = 1, optional = 1)
public abstract static class OpenNode extends YieldingCoreMethodNode {

public OpenNode(RubyContext context, SourceSection sourceSection) {
@@ -263,6 +263,16 @@ public OpenNode(OpenNode prev) {
super(prev);
}

@Specialization
public Object open(RubyString fileName, UndefinedPlaceholder mode, UndefinedPlaceholder block) {
return open(fileName, getContext().makeString("r"), block);
}

@Specialization
public Object open(VirtualFrame frame, RubyString fileName, UndefinedPlaceholder mode, RubyProc block) {
return open(frame, fileName, getContext().makeString("r"), block);
}

@Specialization
public Object open(RubyString fileName, RubyString mode, UndefinedPlaceholder block) {
notDesignedForCompilation();
29 changes: 29 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/IONodes.java
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@
import java.io.BufferedReader;
import java.io.EOFException;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -227,4 +228,32 @@ private void write(PrintStream stream, byte[] bytes, int offset, int length) thr

}

@CoreMethod(names = { "tty?", "isatty" })
public abstract static class IsATTYNode extends CoreMethodNode {

public IsATTYNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public IsATTYNode(IsATTYNode prev) {
super(prev);
}

@Specialization
public boolean isatty(Object self) {
notDesignedForCompilation();

Object stdout = getContext().getCoreLibrary().getObjectClass().getConstants().get("STDOUT").getValue();
if (self != stdout) {
throw new UnsupportedOperationException("Only STDOUT.tty? supported");
}

// TODO (eregon 8-Apr-15) get the actual fd
final FileDescriptor fd = FileDescriptor.out;

return getContext().getRuntime().getPosix().isatty(fd);
}

}

}
Original file line number Diff line number Diff line change
@@ -227,11 +227,12 @@ public CoreLibrary(RubyContext context) {
defineClass(errnoModule, systemCallErrorClass, "EACCES");
edomClass = defineClass(errnoModule, systemCallErrorClass, "EDOM");
defineClass(errnoModule, systemCallErrorClass, "EEXIST");
einvalClass = defineClass(errnoModule, systemCallErrorClass, "EINVAL");
enoentClass = defineClass(errnoModule, systemCallErrorClass, "ENOENT");
enotemptyClass = defineClass(errnoModule, systemCallErrorClass, "ENOTEMPTY");
defineClass(errnoModule, systemCallErrorClass, "ENXIO");
defineClass(errnoModule, systemCallErrorClass, "EPERM");
defineClass(errnoModule, systemCallErrorClass, "EXDEV");
einvalClass = defineClass(errnoModule, systemCallErrorClass, "EINVAL");

// ScriptError
RubyClass scriptErrorClass = defineClass(exceptionClass, "ScriptError");
@@ -273,6 +274,7 @@ public CoreLibrary(RubyContext context) {
encodingClass = defineClass("Encoding", new RubyEncoding.EncodingAllocator());
falseClass = defineClass("FalseClass");
fiberClass = defineClass("Fiber", new RubyFiber.FiberAllocator());
defineModule("FileTest");
hashClass = defineClass("Hash", new RubyHash.HashAllocator());
matchDataClass = defineClass("MatchData");
methodClass = defineClass("Method");
Original file line number Diff line number Diff line change
@@ -165,8 +165,10 @@ public static void format(RubyContext context, PrintStream stream, String format
longValue = (int) value;
} else if (value instanceof Long) {
longValue = (long) value;
} else if (value instanceof Double) {
longValue = (long) (double) value;
} else {
throw new UnsupportedOperationException();
throw new UnsupportedOperationException(value.getClass().getName());
}

stream.printf(formatBuilder.toString(), longValue);