Skip to content

Commit

Permalink
Showing 29 changed files with 930 additions and 156 deletions.
12 changes: 2 additions & 10 deletions ci.hocon
Original file line number Diff line number Diff line change
@@ -6,19 +6,11 @@ common: {
maven: ">=3.3.9"
mercurial: ">=3.2.4"
ruby: ">=2.1.0"
}

downloads: {
JAVA_HOME: {
name: oraclejdk,
version: "8u66",
platformspecific: true
}
"java/jdk": "==1.8.0/60"
}

environment: {
CI: "true",
PATH: "$JAVA_HOME/bin:$PATH"
CI: "true"
}

setup: [
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/ext/socket/RubyBasicSocket.java
Original file line number Diff line number Diff line change
@@ -216,11 +216,11 @@ public IRubyObject recv_nonblock(ThreadContext context, IRubyObject[] args) {

switch (argc) {
case 3:
str = args[3];
str = args[2];
case 2:
flags = args[2];
flags = args[1];
case 1:
length = args[1];
length = args[0];
}

boolean exception = ArgsUtil.extractKeywordArg(context, "exception", opts) != runtime.getFalse();
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/ext/socket/RubyUDPSocket.java
Original file line number Diff line number Diff line change
@@ -218,11 +218,11 @@ public IRubyObject recvfrom_nonblock(ThreadContext context, IRubyObject[] args)

switch (argc) {
case 3:
str = args[3];
str = args[2];
case 2:
flags = args[2];
flags = args[1];
case 1:
length = args[1];
length = args[0];
}

boolean exception = ArgsUtil.extractKeywordArg(context, "exception", opts) != runtime.getFalse();
Original file line number Diff line number Diff line change
@@ -44,8 +44,7 @@
exclude_tests.rb: |
failures = { KernelTest: [:test_silence_stream,
:test_quietly],
InflectorTest: [:test_titleize_mixture_to_title_case_13,
:test_titleize_mixture_to_title_case_14],
InflectorTest: [:test_titleize_mixture_to_title_case_14],
LoadPathsTest: [:test_uniq_load_paths],
LoggerTest: [:test_buffer_multibyte],
MultibyteCharsExtrasTest: [:test_titleize_should_be_unicode_aware,
@@ -55,8 +54,7 @@
:test_transliterate_should_work_with_custom_i18n_rules_and_uncomposed_utf8],
StringInflectionsTest: [:test_string_parameterized_no_separator,
:test_string_parameterized_normal,
:test_string_parameterized_underscore,
:test_titleize],
:test_string_parameterized_underscore],
TimeZoneTest: :test_map_srednekolymsk_to_tzinfo }
76 changes: 76 additions & 0 deletions lib/ruby/truffle/truffle/readline.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This
# code is released under a tri EPL/GPL/LGPL license. You can use it,
# redistribute it and/or modify it under the terms of the:
#
# Eclipse Public License version 1.0
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

Readline = Truffle::Readline

module Readline

HISTORY = Object.new
VERSION = 'JLine wrapper'

module_function

%i[
basic_quote_characters
basic_quote_characters=
completer_quote_characters
completer_quote_characters=
completer_word_break_characters
completer_word_break_characters=
completion_append_character
completion_append_character=
completion_case_fold
completion_case_fold=
completion_proc
completion_proc=
emacs_editing_mode
emacs_editing_mode?
filename_quote_characters
filename_quote_characters=
point=
pre_input_hook
pre_input_hook=
redisplay
set_screen_size
special_prefixes
special_prefixes=
vi_editing_mode
vi_editing_mode?
set_screen_size
].each do |method_name|
define_method(method_name) do
raise NotImplementedError.new("#{method_name}() function is unimplemented on this machine")
end
end

def input=(input)
# TODO (nirvdrum 20-May-16): This should do something functional.
nil
end

def output=(output)
# TODO (nirvdrum 20-May-16): This should do something functional.
nil
end

end

class << Readline::HISTORY

include Enumerable
include Truffle::ReadlineHistory

def empty?
size == 0
end

def to_s
'HISTORY'
end

end
9 changes: 9 additions & 0 deletions spec/ruby/core/string/gsub_spec.rb
Original file line number Diff line number Diff line change
@@ -43,6 +43,9 @@

str = "hello homely world. hah!"
str.gsub(/\Ah\S+\s*/, "huh? ").should == "huh? homely world. hah!"

str = "¿por qué?"
str.gsub(/([a-z\d]*)/, "*").should == "*¿** **é*?*"
end

it "ignores a block if supplied" do
@@ -583,6 +586,12 @@ def obj.to_s() "ok" end
a.should == "h*ll*"
end

it "modifies self in place with multi-byte characters and returns self" do
a = "¿por qué?"
a.gsub!(/([a-z\d]*)/, "*").should equal(a)
a.should == "*¿** **é*?*"
end

it "taints self if replacement is tainted" do
a = "hello"
a.gsub!(/./.taint, "foo").tainted?.should == false
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Readline.basic_quote_characters returns not nil
fails:Readline.basic_quote_characters= returns the passed string
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Readline.completer_quote_characters returns nil
fails:Readline.completer_quote_characters= returns the passed string
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Readline.completer_word_break_characters returns nil
fails:Readline.completer_word_break_characters= returns the passed string
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Readline.completion_append_character returns not nil
fails:Readline.completion_append_character= returns the first character of the passed string
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Readline.completion_case_fold returns nil
fails:Readline.completion_case_fold= returns the passed boolean
3 changes: 3 additions & 0 deletions spec/truffle/tags/library/readline/completion_proc_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fails:Readline.completion_proc returns nil
fails:Readline.completion_proc= returns the passed Proc
fails:Readline.completion_proc= returns an ArgumentError if not given an Proc or #call
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Readline.emacs_editing_mode returns nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:Readline.filename_quote_characters returns nil
fails:Readline.filename_quote_characters= returns the passed string
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Readline.vi_editing_mode returns nil
1 change: 1 addition & 0 deletions spec/truffle/truffle.mspec
Original file line number Diff line number Diff line change
@@ -124,6 +124,7 @@ class MSpecScript
MSpec.disable_feature :continuation_library
MSpec.disable_feature :fork
MSpec.enable_feature :encoding
MSpec.enable_feature :readline

set :files, get(:language) + get(:core) + get(:library) + get(:truffle)
end
Loading

0 comments on commit a62df65

Please sign in to comment.