Commit graph

16449 commits

Author SHA1 Message Date
eileencodes
cbc7c1c061 Add cvar overtaken tests
While working on another project we noticed that there were no tests for
the cvar overtaken exception when using classes. This change adds a test
for cvar overtaken with classes and moves the cvar overtaken test for
modules into the new file.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-03-10 09:40:00 -08:00
Yusuke Endoh
d10b535806 test/ruby/test_string.rb: make GitHub syntax-highlight correctly
It looks like GitHub syntax-highlighting does not support an empty
heredoc. This change adds a newline to make GitHub can handle the syntax
appropriately.

https://bugs.ruby-lang.org/issues/17662
2021-03-08 17:04:27 +09:00
Aditya Prakash
7de349bb49 [rubygems/rubygems] Remote test to check require
This test was triggering require of `rubygems/core_ext/tcpsocket_init`
which overrides TCPSocket.initialize globally. Requires don't get
reset between test runs and it was making other test unreliable.

Fixes timeout of test on ruby master

fdfe5c9691
2021-03-08 13:47:35 +09:00
David Rodríguez
53468cc111 Sync latest development version of bundler & rubygems 2021-03-08 13:47:35 +09:00
Nobuyoshi Nakada
32a13591e0
[ruby/stringio] Check if closed in loop
[Bug #17675] https://bugs.ruby-lang.org/issues/17675

1ed61d0cbc
2021-03-08 10:13:29 +09:00
Nobuyoshi Nakada
d0a05fd4b4
Fixed FD leaks 2021-03-08 10:08:40 +09:00
Hiroshi SHIBATA
c3c1800708
Prefer to use omit 2021-03-08 09:34:16 +09:00
Nobuyoshi Nakada
f6d5de8f33 [ruby/io-wait] Declare as Ractor-safe
Fixes https://bugs.ruby-lang.org/issues/17659

ba338b4764
2021-03-07 09:54:35 +09:00
Nobuyoshi Nakada
ef9bde6516 [ruby/io-wait] Refined uncommon device type tests
0c73ebcf5d
2021-03-07 09:54:35 +09:00
Jeremy Evans
68d028578a Undef Enumerator::Chain#{feed,next,next_values,peek,peek_values}
Previously these methods were defined but raised TypeError, which
seems worse.
2021-03-06 13:56:16 -08:00
Jeremy Evans
e1d16a9e56 Make Enumerator#{+,chain} create lazy chain if any included enumerator is lazy
Implements [Feature #17347]
2021-03-06 13:56:16 -08:00
Jeremy Evans
bf40fe9fed Fix calling enumerator methods such as with_index on Enumerator::Chain
This previously raised a TypeError.  Wrap the Enumerator::Chain in
an Enumerator to work around the problem.

Fixes [Bug #17216]
2021-03-06 13:56:16 -08:00
Jeremy Evans
14e1739ff3 [ruby/irb] Make save-history extension safe for concurrent use
This makes the save-history extension check for modifications to
the history file before saving it.  If the history file was modified
after the history was loaded and before it was saved, append only
the new history lines to the history file.

This can result in more lines in the history file than SAVE_HISTORY
allows.  However, that will be fixed the next time irb is run and
the history is saved.

Fixes [Bug #13654]

041ef53845
2021-03-06 00:18:32 +09:00
aycabta
182cde8dfb [ruby/irb] Add a test for not continuing when endless range at eol
1020ac9c65
2021-03-05 22:03:11 +09:00
Aaron Patterson
d45466dc5b
Oops! Add another test and fix to_proc implementation 2021-02-26 10:06:56 -08:00
Aaron Patterson
0590e9b677
Fiddle::Function responds to to_proc
This lets us cast a Fiddle::Function to a block, allowing is to write
things like:

```ruby
f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
define_method :strcpy, &f
```
2021-02-26 09:57:13 -08:00
Aaron Patterson
cfc23903df
Revert "Add tests for bug 17652"
This reverts commit a9920e7782.
2021-02-25 16:31:24 -08:00
Peter Zhu
a9920e7782 Add tests for bug 17652 2021-02-25 11:01:50 -08:00
Aaron Patterson
08d5db4064
Reverting PR #4221
It seems this breaks tests on Solaris, so I'm reverting it until we
figure out the right fix.

  20210224T210007Z.fail.html.gz
2021-02-24 13:44:10 -08:00
Peter Zhu
59fb5d4fa3 Add tests for bug 17652 2021-02-24 12:25:30 -08:00
Andrew Aladjev
0d76636117 added mutexes for socket and connection lists on win32 2021-02-23 16:20:01 +09:00
Alan Wu
58e8220605 Check for cyclic prepend before making origin
It's important to only make the origin when the prepend goes
through, as the precense of the origin informs whether to do an
origin backfill.

This plus 2d877327e fix [Bug #17590].
2021-02-22 17:57:47 -05:00
nicholas a. evans
3ee4fa9491
Send :fiber_switch event for almost every fiber_switch (#4207)
With this patch, TracePoint receives a `:fiber_switch` event for
_almost_ every fiber switch.  Previously, it would not be sent when an
exception was going to be raised. Now the event should only be blockable
by an interrupt (including `Thread#raise`) or a fatal error.

Additionally, interrupts will now be checked on the return fiber
_before_ re-raising the terminating unhandled exception.  And a fiber
that terminates with an unhandled exception no longer creates a pending
interrupt on its thread.  The exception will be raised in the return
fiber the same way as `Fiber#raise`: using `cont.value` with `cont.argc
== -1`

I moved `rb_exc_raise` from `fiber_store` to the end of `fiber_switch`
after _all_ of the other cleanup code: `fiber_stack_release`,
`th->blocking` increment, `RUBY_VM_CHECK_INTS`, and `EXEC_EVENT_HOOK`.
It seems to me that skipping those other cleanup steps may have also
resulted in other bugs.
2021-02-22 10:33:11 +13:00
aycabta
7aa3bc8403 [ruby/reline] Add a test for suppressing crash when dynamic prompt returns empty
ref. https://github.com/ruby/reline/pull/262

b98bc3c329
2021-02-21 06:43:31 +09:00
aycabta
a3055a35dd [ruby/reline] Move script files for yamatanooroti tests
03031b885d
2021-02-21 06:41:56 +09:00
aycabta
dc9e33016c [ruby/reline] Return 1 when char width not found
This fixes ruby/reline#261.

3cf1213014
2021-02-21 06:41:03 +09:00
Jeremy Evans
cfd162d535 Make String#{strip,lstrip}{,!} strip leading NUL bytes
The documentation already specifies that they strip whitespace
and defines whitespace to include null.

This wraps the new behavior in the appropriate guards in the specs,
but does not specify behavior for previous versions, because this
is a bug that could be backported.

Fixes [Bug #17467]
2021-02-20 11:17:47 +09:00
Jeremy Evans
8743732621 Fix backtrace to not skip frames with iseq without pc
Previously, frames with iseq but no pc were skipped (even before
the refactoring in 3b24b7914c).
Because the entire backtrace was procesed before the refactoring,
this was handled by using later frames instead.  However, after
the refactoring, we need to handle those frames or they get
lost.

Keep two iteration counters when iterating, one for the desired
backtrace size (so we generate the desired number of frames), and
one for the actual backtrace size (so we don't process off the end
of the stack).  When skipping over an iseq frame with no pc,
decrement the counter for the desired backtrace, so it will
continue to process the expected number of backtrace frames.

Fixes [Bug #17581]
2021-02-19 08:14:24 -08:00
Shugo Maeda
a319c04818
Fix typo [ci skip] 2021-02-19 17:27:53 +09:00
Koichi Sasada
9c769575bf invalidate negative cache any time.
negative cache on a class which does not have subclasses was not
invalidated, but it should be invalidated because other classes
can cache this negative cache.
[Bug #17553]
2021-02-19 16:54:31 +09:00
Shugo Maeda
5de38c41ae
ripper: fix a bug of Ripper::Lexer with syntax error and heredoc [Bug #17644] 2021-02-19 16:40:29 +09:00
Nobuyoshi Nakada
9110021fd2 [ruby/readline-ext] Use omit
f6dff0a9f6
2021-02-18 21:17:42 +09:00
Nobuyoshi Nakada
296a2cab07 Parse "-00:00" as UTC for the round-trip [Feature #17544] 2021-02-16 20:34:23 +09:00
Nobuyoshi Nakada
5b7439bb7b UTC zone should be still "+00:00" [Feature #17544] 2021-02-16 20:34:23 +09:00
Nobuyoshi Nakada
9ef66ce3fc strftime.c: support unknown offset UTC in RFC 3339 [Feature #17544]
In RFC 3339, -00:00 is used for the time in UTC is known, but the
offset to local time is unknown.  Support that representation by
`-` flag for `z`.
2021-02-16 20:34:23 +09:00
Kazuhiro NISHIYAMA
1a84c07715
Fix a failure
http://ci.rvm.jp/results/trunk-test@ruby-sky1/3359644
```
:   1)
: TestEncoding#test_nonascii_library_path [/tmp/ruby/v3/src/trunk-test/test/ruby/test_encoding.rb:157]:
: Exception(LoadError) with message matches to /\[Bug #16382\]/.
```
2021-02-16 18:17:09 +09:00
David Rodríguez
02151dad1b $LOAD_PATH.resolve_feature_path should not raise
I think it's more friendly and easier to work with to return `nil` when
the feature is not found in the $LOAD_PATH.
2021-02-16 18:11:13 +09:00
Nobuyoshi Nakada
4f47d655e3 Added Thread::Backtrace.limit [Feature #17479] 2021-02-15 18:29:35 +09:00
Nobuyoshi Nakada
522b256689 Added tests for --backtrace-limit option 2021-02-15 18:29:35 +09:00
xtkoba (Tee KOBAYASHI)
a681c484a3
Fixed codepage for utime [Bug #17626]
Should use the given codepage argument.

Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-02-14 19:44:41 +09:00
Nobuyoshi Nakada
1f0e0dfb22
Thread::Queue.new should accept an Enumerable [Feature #17327]
Enumerable implements #to_a but not #to_array.
2021-02-12 12:21:49 +09:00
Jeremy Evans
2d877327e1 Make a cyclic prepend not modify ancestors for the receiver
Check for cyclic prepend before making any changes.  This requires
scanning the module ancestor chain twice, but in general modules
do not have large numbers of ancestors.
2021-02-11 07:45:52 -08:00
aycabta
6eb5b3ac27 [ruby/irb] The command "irb_info" should show RUBY_PLATFORM
39d1cd874f
2021-02-11 20:36:43 +09:00
aycabta
b2d2d25b94 [ruby/irb] Suppress colorize on Windows tests
5be9354cf9
2021-02-11 20:31:29 +09:00
Hiroshi SHIBATA
231f0f6f45 [ruby/zlib] test-unit didn't provide __name__ attribute
7d3fc1f325
2021-02-10 12:49:16 +09:00
Samuel Williams
5f69a7f604
Expose scheduler as public interface & bug fixes. (#3945)
* Rename `rb_scheduler` to `rb_fiber_scheduler`.

* Use public interface if available.

* Use `rb_check_funcall` where possible.

* Don't use `unblock` unless the fiber was non-blocking.
2021-02-09 19:39:56 +13:00
Keith Bennett
3a7ff66abc [ruby/benchmark] Adds Tms#to_h
[Feature #17601]
2021-02-07 23:06:17 -05:00
Nobuyoshi Nakada
bf627e518d
Forward keyword arguments to ARGF from global functions 2021-02-08 11:33:53 +09:00
Nobuyoshi Nakada
1d686bdeb9
Added test for keyword arguments to ARGF 2021-02-08 11:31:34 +09:00
aycabta
300084a854 [ruby/reline] Terminate correctly in the middle of lines higher than the screen
e1d9240ada
2021-02-07 05:12:19 +09:00