Skip to content

Commit e6bbc18

Browse files
committed
Merge remote-tracking branch 'origin/master' into jruby
2 parents efce32b + d0721e3 commit e6bbc18

File tree

6 files changed

+39
-28
lines changed

6 files changed

+39
-28
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
/_yardoc/
44
/coverage/
55
/doc/
6+
/lib/
7+
/logs/
68
/pkg/
79
/spec/reports/
810
/tmp/

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ if RUBY_ENGINE == 'jruby'
1515
else
1616
require 'rake/extensiontask'
1717
extask = Rake::ExtensionTask.new(name) do |x|
18-
x.lib_dir << "/#{RUBY_VERSION}/#{x.platform}"
18+
x.lib_dir.sub!(%r[(?=/|\z)], "/#{RUBY_VERSION}/#{x.platform}")
1919
end
2020
end
2121

2222
Rake::TestTask.new(:test) do |t|
2323
if RUBY_ENGINE == "jruby"
2424
t.libs += ["ext/java/lib", "lib"]
2525
else
26-
t.libs << extask.lib_dir
26+
t.libs = ["lib/#{RUBY_VERSION}/#{extask.platform}"]
2727
end
2828
t.libs << "test/lib"
2929
t.ruby_opts << "-rhelper"

ext/io/wait/wait.c

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ wait_for_single_fd(rb_io_t *fptr, int events, struct timeval *tv)
7777
*
7878
* Returns number of bytes that can be read without blocking.
7979
* Returns zero if no information available.
80+
*
81+
* You must require 'io/wait' to use this method.
8082
*/
8183

8284
static VALUE
@@ -119,9 +121,12 @@ io_wait_event(VALUE io, int event, VALUE timeout)
119121

120122
/*
121123
* call-seq:
122-
* io.ready? -> true or false
124+
* io.ready? -> truthy or falsy
125+
*
126+
* Returns a truthy value if input available without blocking, or a
127+
* falsy value.
123128
*
124-
* Returns +true+ if input available without blocking, or +false+.
129+
* You must require 'io/wait' to use this method.
125130
*/
126131

127132
static VALUE
@@ -148,12 +153,14 @@ io_ready_p(VALUE io)
148153

149154
/*
150155
* call-seq:
151-
* io.wait_readable -> true or false
152-
* io.wait_readable(timeout) -> true or false
156+
* io.wait_readable -> truthy or falsy
157+
* io.wait_readable(timeout) -> truthy or falsy
158+
*
159+
* Waits until IO is readable and returns a truthy value, or a falsy
160+
* value when times out. Returns a truthy value immediately when
161+
* buffered data is available.
153162
*
154-
* Waits until IO is readable and returns +true+, or
155-
* +false+ when times out.
156-
* Returns +true+ immediately when buffered data is available.
163+
* You must require 'io/wait' to use this method.
157164
*/
158165

159166
static VALUE
@@ -188,11 +195,13 @@ io_wait_readable(int argc, VALUE *argv, VALUE io)
188195

189196
/*
190197
* call-seq:
191-
* io.wait_writable -> true or false
192-
* io.wait_writable(timeout) -> true or false
198+
* io.wait_writable -> truthy or falsy
199+
* io.wait_writable(timeout) -> truthy or falsy
193200
*
194-
* Waits until IO is writable and returns +true+ or
195-
* +false+ when times out.
201+
* Waits until IO is writable and returns a truthy value or a falsy
202+
* value when times out.
203+
*
204+
* You must require 'io/wait' to use this method.
196205
*/
197206
static VALUE
198207
io_wait_writable(int argc, VALUE *argv, VALUE io)
@@ -223,11 +232,13 @@ io_wait_writable(int argc, VALUE *argv, VALUE io)
223232
#ifdef HAVE_RB_IO_WAIT
224233
/*
225234
* call-seq:
226-
* io.wait_priority -> true or false
227-
* io.wait_priority(timeout) -> true or false
235+
* io.wait_priority -> truthy or falsy
236+
* io.wait_priority(timeout) -> truthy or falsy
237+
*
238+
* Waits until IO is priority and returns a truthy value or a falsy
239+
* value when times out.
228240
*
229-
* Waits until IO is priority and returns +true+ or
230-
* +false+ when times out.
241+
* You must require 'io/wait' to use this method.
231242
*/
232243
static VALUE
233244
io_wait_priority(int argc, VALUE *argv, VALUE io)
@@ -282,19 +293,21 @@ wait_mode_sym(VALUE mode)
282293

283294
/*
284295
* call-seq:
285-
* io.wait(events, timeout) -> event mask or false.
286-
* io.wait(timeout = nil, mode = :read) -> event mask or false.
296+
* io.wait(events, timeout) -> truthy or falsy
297+
* io.wait(timeout = nil, mode = :read) -> truthy or falsy.
287298
*
288299
* Waits until the IO becomes ready for the specified events and returns the
289-
* subset of events that become ready, or +false+ when times out.
300+
* subset of events that become ready, or a falsy value when times out.
290301
*
291302
* The events can be a bit mask of +IO::READABLE+, +IO::WRITABLE+ or
292303
* +IO::PRIORITY+.
293304
*
294-
* Returns +true+ immediately when buffered data is available.
305+
* Returns a truthy value immediately when buffered data is available.
295306
*
296307
* Optional parameter +mode+ is one of +:read+, +:write+, or
297308
* +:read_write+.
309+
*
310+
* You must require 'io/wait' to use this method.
298311
*/
299312

300313
static VALUE

test/io/wait/test_io_wait_uncommon.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def test_tty_wait
1313
end
1414

1515
def test_fifo_wait
16-
skip 'no mkfifo' unless File.respond_to?(:mkfifo) && IO.const_defined?(:NONBLOCK)
17-
skip 'known bogus error in JRuby 9.3.0.0 and earlier' if RUBY_ENGINE == 'jruby' && JRUBY_VERSION < '9.3.1.0'
16+
omit 'no mkfifo' unless File.respond_to?(:mkfifo) && IO.const_defined?(:NONBLOCK)
17+
omit 'known bogus error in JRuby 9.3.0.0 and earlier' if RUBY_ENGINE == 'jruby' && JRUBY_VERSION < '9.3.1.0'
1818

1919
require 'tmpdir'
2020
Dir.mktmpdir('rubytest-fifo') do |dir|

test/lib/core_assertions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def syntax_check(code, fname, line)
107107

108108
def assert_no_memory_leak(args, prepare, code, message=nil, limit: 2.0, rss: false, **opt)
109109
# TODO: consider choosing some appropriate limit for MJIT and stop skipping this once it does not randomly fail
110-
pend 'assert_no_memory_leak may consider MJIT memory usage as leak' if defined?(RubyVM::JIT) && RubyVM::JIT.enabled?
110+
pend 'assert_no_memory_leak may consider MJIT memory usage as leak' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
111111

112112
require_relative 'memory_status'
113113
raise Test::Unit::PendedError, "unsupported platform" unless defined?(Memory::Status)

test/lib/helper.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
require "test/unit"
22
require_relative "core_assertions"
33

4-
class Test::Unit::TestCase
5-
alias skip pend
6-
end
7-
84
Test::Unit::TestCase.include Test::Unit::CoreAssertions

0 commit comments

Comments
 (0)