Skip to content

Commit

Permalink
Showing 17 changed files with 50 additions and 54 deletions.
8 changes: 4 additions & 4 deletions lib/ruby/stdlib/bigdecimal/ludcmp.rb
Original file line number Diff line number Diff line change
@@ -76,13 +76,13 @@ def lusolve(a,b,ps,zero=0.0)
end
x <<= b[ps[i]] - dot
end
(n-1).downto(0) do |i|
(n-1).downto(0) do |i2|
dot = zero
psin = ps[i]*n
for j in (i+1)...n do
psin = ps[i2]*n
for j in (i2+1)...n do
dot = a[psin+j].mult(x[j],prec) + dot
end
x[i] = (x[i]-dot).div(a[psin+i],prec)
x[i2] = (x[i2]-dot).div(a[psin+i2],prec)
end
x
end
8 changes: 4 additions & 4 deletions lib/ruby/stdlib/jruby/compiler.rb
Original file line number Diff line number Diff line change
@@ -52,8 +52,8 @@ def compile_argv(argv)
options[:target] = tgt
end

opts.on("-J OPTION", "Pass OPTION to javac for javac compiles") do |opts|
options[:javac_options] << opts
opts.on("-J OPTION", "Pass OPTION to javac for javac compiles") do |o|
options[:javac_options] << o
end

#opts.on("-5"," --jdk5", "Generate JDK 5 classes (version 49)") do |x|
@@ -287,8 +287,8 @@ def compile_files_with_options(filenames, options = default_options)

if File.directory?(filename)
puts "Compiling **/*.rb in '#{File.expand_path(filename)}'..." if options[:verbose]
Dir.glob(File.join(filename, "/**/*.rb")).each do |filename|
errors += compile_proc[filename]
Dir.glob(File.join(filename, "/**/*.rb")).each do |f|
errors += compile_proc[f]
end
else
if filename.end_with?('.java')
2 changes: 1 addition & 1 deletion test/jruby/test_array.rb
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ def test_shared_ary_slice
def test_map
methods = %w{map map! collect collect!}
methods.each { |method|
assert_no_match /Enumerable/, [].method(method).to_s
assert_no_match(/Enumerable/, [].method(method).to_s)
}
end
end
8 changes: 4 additions & 4 deletions test/jruby/test_backtraces.rb
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ def test_native_java_backtrace2
constructor = sample_class.constructor(Java::int)
constructor.new_instance 0
begin
constructor.new_instance -1
constructor.new_instance(-1)
fail 'did no raise exception'
rescue NativeException => ex
assert_equal 'java.lang.IllegalStateException: param == -1', ex.message
@@ -323,7 +323,7 @@ def test_throwing_runnable_backtrace # GH-3177
begin
throwing.doRun( (i += 1) > 0 )
rescue java.lang.Exception
assert e = $!.backtrace.find { |e| e.index('org.jruby.RubyFixnum.times') }
assert e = $!.backtrace.find { |e2| e2.index('org.jruby.RubyFixnum.times') }
assert_equal fixnum_times_, e[ 0...fixnum_times_.size ]
backtrace = $!.backtrace.dup
raise
@@ -336,7 +336,7 @@ def test_throwing_runnable_backtrace # GH-3177
rescue java.lang.Exception
# puts $!.backtrace
# second rewriting of the same exception :
assert e = $!.backtrace.find { |e| e.index('org.jruby.RubyFixnum.times') }
assert e = $!.backtrace.find { |e2| e2.index('org.jruby.RubyFixnum.times') }
assert_equal fixnum_times_, e[ 0...fixnum_times_.size ]
# NOTE back-trace gets duplicate .rb calls - seems not necessary to fix?!
# assert_equal backtrace, $!.backtrace # expect the same back-trace
@@ -367,7 +367,7 @@ def assert_exception_backtrace(expectations, exception)
line.strip!

# if line starts with +nnn, we prepend the current file and offset
if line.match /^\+(\d+)(:.*)/
if line.match(/^\+(\d+)(:.*)/)
flunk("@offset is not defined in the test case") unless @offset ||= nil
# For JRuby, we soften this requirement, since native calls will
# show their actual .java file and line, rather than the caller.
6 changes: 3 additions & 3 deletions test/jruby/test_big_decimal.rb
Original file line number Diff line number Diff line change
@@ -368,12 +368,12 @@ def infinite?; false end

def test_subclass
a = BigDeci.new 1.to_s
assert_equal -1, a.abs
assert_equal(-1, a.abs)
assert_equal false, a.infinite?

a = BigDeci.new '-100'
assert_equal -5, a.div(20)
assert_equal -100, a.abs
assert_equal(-5, a.div(20))
assert_equal(-100, a.abs)

assert a.inspect.index('#<BigDecimal:')
assert_equal '-0.1E3', a.to_s
8 changes: 4 additions & 4 deletions test/jruby/test_caller.rb
Original file line number Diff line number Diff line change
@@ -4,11 +4,11 @@ class TestCaller < Test::Unit::TestCase

def test_normal_caller
trace0 = caller(0)
assert_match /test\/jruby\/test_caller\.rb\:6\:in `test_normal_caller'/, trace0.first
assert_match(/test\/jruby\/test_caller\.rb\:6\:in `test_normal_caller'/, trace0.first)
assert(trace0.length > 1, "caller(0) is not > 1: #{trace0.inspect}")

trace = caller
assert_not_match /test\/jruby\/test_caller\.rb\:16\:in `test_normal_caller'/, trace[0]
assert_not_match(/test\/jruby\/test_caller\.rb\:16\:in `test_normal_caller'/, trace[0])
assert_equal trace0[1..-1], trace
end

@@ -22,8 +22,8 @@ def test_evaled_caller_has_full_trace
# simple test, make sure the trace is more than one entry
assert(trace.length > 1, "caller(0) is not > 1: #{trace.inspect}")

assert_match /test\/jruby\/test_caller\.rb\:\d\d\:in `eval'/, trace[1]
assert_match /test\/jruby\/test_caller\.rb\:\d\d\:in `foo0'/, trace[2]
assert_match(/test\/jruby\/test_caller\.rb\:\d\d\:in `eval'/, trace[1])
assert_match(/test\/jruby\/test_caller\.rb\:\d\d\:in `foo0'/, trace[2])
end

def test_jitted_caller_excludes_abstractscript
2 changes: 1 addition & 1 deletion test/jruby/test_class.rb
Original file line number Diff line number Diff line change
@@ -285,7 +285,7 @@ def test_eval_class_as_module_should_raise_type_exception
class Foo
def self.action(name, &block)
define_method(name) {
instance_eval &block
instance_eval(&block)
}
end

2 changes: 0 additions & 2 deletions test/jruby/test_cvars_in_odd_scopes.rb
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
# JRUBY-3714: ActiveMessaging poller stops silently with JRuby 1.3.0RC1 and RC2.
class TestCvarsInOddScopes < Test::Unit::TestCase
def test_lambda_in_eigenclass
$result
Class.new do
@@running = true
class << self
@@ -17,7 +16,6 @@ class << self
end

def test_proc_in_eigenclass
$result
Class.new do
@@running = true
class << self
8 changes: 4 additions & 4 deletions test/jruby/test_file.rb
Original file line number Diff line number Diff line change
@@ -792,12 +792,12 @@ def test_file_truncated_after_changing_directory
Dir.mkdir(subdir)
Dir.chdir(subdir) { |dir|
begin
file = File.open("__dummy_file.txt", "wb") { |file|
file.write("dummy text")
file
}
file = File.open("__dummy_file.txt", "wb")
file.write("dummy text")
file.close
assert_nothing_raised { File.truncate(file.path, 0) }
ensure
file.close rescue nil
File.unlink(file.path)
end
}
2 changes: 0 additions & 2 deletions test/jruby/test_ifaddr.rb
Original file line number Diff line number Diff line change
@@ -4,8 +4,6 @@
require 'test/jruby/test_helper'
require 'ipaddr'

WINDOWS = RbConfig::CONFIG['host_os'] =~ /Windows|mswin/

class IfaddrTest < Test::Unit::TestCase
include TestHelper

2 changes: 1 addition & 1 deletion test/jruby/test_java_extension.rb
Original file line number Diff line number Diff line change
@@ -284,7 +284,7 @@ def test_ruby_block_duck_typed_as_runnable_last_argument

def test_ruby_block_with_args_as_interface
file = java.io.File.new(".")
listing = file.list {|file,str| !!(str =~ /\./) }
listing = file.list {|_,str| !!(str =~ /\./) }
assert listing.size >= 0
end

2 changes: 1 addition & 1 deletion test/jruby/test_kernel.rb
Original file line number Diff line number Diff line change
@@ -780,7 +780,7 @@ def test_exec_rubyopt
ENV['RUBYOPT'] = "-v"
result = `bin/jruby -e "a=1"`
assert_equal 0, $?.exitstatus
assert_match /ruby/i, result
assert_match(/ruby/i, result)
ensure
ENV['RUBYOPT'] = old
end
2 changes: 1 addition & 1 deletion test/jruby/test_no_stack_trace_stomp.rb
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ def test_good_stack_trace
begin
rescue_an_error
rescue RuntimeError => e
assert_match /`raise_an_error'/, e.backtrace[0]
assert_match(/`raise_an_error'/, e.backtrace[0])
end
end
end
4 changes: 2 additions & 2 deletions test/jruby/test_process.rb
Original file line number Diff line number Diff line change
@@ -25,8 +25,8 @@ def test_process_status_to_i
end

def test_process_status_to_s
assert_match /exit 1/, @first_status.to_s
assert_match /exit 2/, @second_status.to_s
assert_match(/exit 1/, @first_status.to_s)
assert_match(/exit 2/, @second_status.to_s)
end

def test_process_status_exitstatus
8 changes: 4 additions & 4 deletions test/jruby/test_socket.rb
Original file line number Diff line number Diff line change
@@ -145,8 +145,8 @@ def test_raises_socket_error_on_out_of_range_port
# SocketError(<getaddrinfo: Servname not supported for ai_socktype>)

error = defined?(JRUBY_VERSION) ? SocketError : Errno::ECONNREFUSED
[ 2**16, 2**16 + 1, 2**17, 2**30 - 1 ].each do |port|
assert_raises(error) { TCPSocket.new('localhost', port) }
[ 2**16, 2**16 + 1, 2**17, 2**30 - 1 ].each do |p|
assert_raises(error) { TCPSocket.new('localhost', p) }
end
end

@@ -570,9 +570,9 @@ def test_server_close_interrupts_pending_accepts

# JRUBY-2874
def test_raises_socket_error_on_out_of_range_port
[-2**16, -2**8, -2, -1, 2**16, 2**16 + 1, 2**17, 2**30 -1].each do |port|
[-2**16, -2**8, -2, -1, 2**16, 2**16 + 1, 2**17, 2**30 - 1].each do |p|
assert_raises(SocketError) do
TCPServer.new('localhost', port)
TCPServer.new('localhost', p)
end
end
end
28 changes: 14 additions & 14 deletions test/jruby/test_thread.rb
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ def test_joining_itself
e = error
end
assert(! e.nil?)
assert_match /thread [0-9a-z]+ tried to join itself/, e.message
assert_match(/thread [0-9a-z]+ tried to join itself/, e.message)
end

def test_raise
@@ -344,39 +344,39 @@ def test_sleep_wakeup_interlacing

def test_inspect_and_to_s
t = Thread.new {}.join
assert_match /#<Thread:0x[0-9a-z]+>/, t.to_s
assert_match(/#<Thread:0x[0-9a-z]+>/, t.to_s)
# TODO we do not have file/line right :
# MRI: #<Thread:0x000000014b0e28@test/jruby/test_thread.rb:346 dead>
#assert_match /#<Thread:0x[0-9a-z]+@test\/jruby\/test_thread\.rb\:346 \w+>/, t.inspect
assert_match /#<Thread:0x[0-9a-z]+(@.*\.rb\:\d+)? \w+>/, t.inspect
#assert_match(/#<Thread:0x[0-9a-z]+@test\/jruby\/test_thread\.rb\:346 \w+>/, t.inspect)
assert_match(/#<Thread:0x[0-9a-z]+(@.*\.rb\:\d+)? \w+>/, t.inspect)

assert_nil t.name

t = Thread.new {}.join
t.name = 'universal'
assert_match /#<Thread:0x[0-9a-z]+>/, t.to_s
assert_match /#<Thread:0x[0-9a-z]+@universal(@.*\.rb\:\d+)? \w+>/, t.inspect
assert_match(/#<Thread:0x[0-9a-z]+>/, t.to_s)
assert_match(/#<Thread:0x[0-9a-z]+@universal(@.*\.rb\:\d+)? \w+>/, t.inspect)
end

def test_thread_name
Thread.new do
assert_match /\#\<Thread\:0x\h+(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect
assert_match(/\#\<Thread\:0x\h+(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect)
# TODO? currently in JIT file comes as "" and line as 0
assert_match /Ruby\-\d+\-Thread\-\d+\:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current) if defined? JRUBY_VERSION
assert_match(/Ruby\-\d+\-Thread\-\d+\:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current)) if defined? JRUBY_VERSION
end.join

Thread.new do
Thread.current.name = 'foo'
assert_match /\#\<Thread\:0x\h+@foo(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect
assert_match /Ruby\-\d+\-Thread\-\d+\@foo:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current) if defined? JRUBY_VERSION
assert_match(/\#\<Thread\:0x\h+@foo(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect)
assert_match(/Ruby\-\d+\-Thread\-\d+\@foo:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current)) if defined? JRUBY_VERSION

Thread.current.name = 'bar'
assert_match /\#\<Thread\:0x\h+@bar(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect
assert_match /Ruby\-\d+\-Thread\-\d+\@bar:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current) if defined? JRUBY_VERSION
assert_match(/\#\<Thread\:0x\h+@bar(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect)
assert_match(/Ruby\-\d+\-Thread\-\d+\@bar:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current)) if defined? JRUBY_VERSION

Thread.current.name = nil
assert_match /\#\<Thread\:0x\h+(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect
assert_match /Ruby\-\d+\-Thread\-\d+\:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current) if defined? JRUBY_VERSION
assert_match(/\#\<Thread\:0x\h+(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect)
assert_match(/Ruby\-\d+\-Thread\-\d+\:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current)) if defined? JRUBY_VERSION
end.join


4 changes: 2 additions & 2 deletions test/jruby/test_time_nil_ops.rb
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ def test_plus
def test_times
t = Time.now
begin
t * ()
_ = t * ()
fail "bleh"
rescue NoMethodError=>x
assert x
@@ -29,7 +29,7 @@ def test_times
def test_div
t = Time.now
begin
t / ()
_ = t / ()
fail "bleh"
rescue NoMethodError=>x
assert x

0 comments on commit 0905a7c

Please sign in to comment.