Commit graph

841 commits

Author SHA1 Message Date
Kazuhiro NISHIYAMA
5deb273a1a
Fix a typo 2021-10-13 15:04:16 +09:00
Nobuyoshi Nakada
7f3786c3e8
Use an isolated class
The number of all instances of `Class` may be affected by GC-able
anonymous classes created by other tests.
2021-10-10 01:20:40 +09:00
Jeremy Evans
08759edea8
Remove autoload for constant if the autoload fails
Previously, if an autoload failed (the file was loaded, but the
constant was not defined by the autoloaded file). Ruby will try
to autoload again if you delete the autoloaded file from
$LOADED_FEATURES.  With this change, the autoload and the
constant itself are removed as soon as it fails.

To handle cases where multiple threads are autoloading, when
deleting an autoload, handle the case where another thread
already deleted it.

Fixes [Bug #15790]
2021-10-08 14:54:26 -07:00
Hiroshi SHIBATA
ae5dffd666
Followed up bd6e1a0f08 2021-10-07 18:34:29 +09:00
Nobuyoshi Nakada
7ed1180e00
Remove the useless platform guard 2021-10-06 12:19:52 +09:00
Nobuyoshi Nakada
ddca0c6686
Fix filesystem dependent tests
Ruby cannot guarantee the resolutions of underlying filesystems.
2021-10-06 11:41:03 +09:00
Benoit Daloze
b9f34062f0 Update to ruby/spec@ccf0d85 2021-10-05 19:41:44 +02:00
Jean Boussier
afcbb501ac marshal.c Marshal.load accepts a freeze: true option.
Fixes [Feature #18148]

When set, all the loaded objects are returned as frozen.

If a proc is provided, it is called with the objects already frozen.
2021-10-05 18:34:56 +02:00
Jean byroot Boussier
529fc204af
marshal.c: don't call the proc with partially initialized objects. (#4866)
For cyclic objects, it requires to keep a st_table of the partially
initialized objects.
2021-09-30 16:50:31 +02:00
Hiroshi SHIBATA
2f19f4d1d8
Followed up behavior change of set
f360ebb306
2021-09-28 19:15:12 +09:00
Hiroshi SHIBATA
395da04aa6
Followed up ruby/spec examples for date.
f9f7f3a75e
2021-09-28 19:14:02 +09:00
Nobuyoshi Nakada
69ce154d6e
FL_USER flags on ohter than T_DATA are reserved [Misc #18059] 2021-09-25 15:38:38 +09:00
Nobuyoshi Nakada
225a29b9bc
FL_USER flags on ohter than T_DATA are reserved [Misc #18059] 2021-09-24 19:23:15 +09:00
Samuel Williams
4730a1e0ec Don't describe C function that does not exist in prior versions. 2021-09-20 22:07:34 +12:00
Samuel Williams
649c87bd86 Add C interface spec. 2021-09-20 18:30:51 +12:00
Nobuyoshi Nakada
fd918d1afa
Removed Module.allocate [Bug #17048] 2021-09-17 11:14:08 +09:00
Nobuyoshi Nakada
8f41c791b1
Add spec for MatchData#match and MatchData#match_length [Feature #18172] 2021-09-17 10:27:00 +09:00
Jean Boussier
89242279e6 Marshal.load: do not call the proc until strings have their encoding
Ref: https://bugs.ruby-lang.org/issues/18141
2021-09-15 08:00:18 +09:00
Nobuyoshi Nakada
e802587433
Add printf attribute to functions call va_list format functions 2021-09-12 14:05:52 +09:00
卜部昌平
f752382688 spec/ruby/optional/capi/ext: must support GCC 5
What a silly bug.
2021-09-10 20:00:06 +09:00
卜部昌平
b0f0120267 spec/ruby/optional/capi/ext: support ruby < 3
RBIMPL_WARNING_PUSH is a 3.0 feature.  Rubyspec OTOH has to support 2.x.
2021-09-10 20:00:06 +09:00
卜部昌平
b563b9c48f spec/ruby/optional/capi/ext: suppress warnings
These warnings are okay here.
2021-09-10 20:00:06 +09:00
Benoit Daloze
258661409e Update to ruby/spec@b1e93a2 2021-09-07 19:01:07 +02:00
Nobuyoshi Nakada
be9cc6c758
Fix rubyspec_capiext dependency and flags
- The file needed to link may be the import library.
- Remove duplicate flags.
2021-08-30 12:03:44 +09:00
Nobuyoshi Nakada
9f9ea28375
Fix dllimport attribute 2021-08-30 00:52:16 +09:00
Nobuyoshi Nakada
d574b84182
Fix failures on non-UTF-8 environment [Bug #18077]
Call `IOSpecs.io_fixture` with the default encoding explicitly.
`IOSpecs.closed_io` calls the method without optional `mode` which
is set to UTF-8 by default, while the default external encoding
depends on the locale environment variables.
2021-08-22 12:11:45 +09:00
Lars Kanis
6594623f62 Fix Marshal.dump(closed_io) to raise TypeError and allow encoding on closed IO
Mashalling a closed IO object raised "closed stream (IOError)" before instead of TypeError.
This changes IO#(in|ex)ternal_encoding to still return the encoding even if the underlying FD is closed.

Fixes bug #18077
2021-08-22 10:33:22 +09:00
Jeremy Evans
48c8df9e0e
Allow tracing of optimized methods
This updates the trace instructions to directly dispatch to
opt_send_without_block.  So this should cause no slowdown in
non-trace mode.

To enable the tracing of the optimized methods, RUBY_EVENT_C_CALL
and RUBY_EVENT_C_RETURN are added as events to the specialized
instructions.

Fixes [Bug #14870]

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2021-08-21 10:15:01 -07:00
Kazuki Tsujimoto
f96c199449
Fix test failure on spec/ruby/language/pattern_matching_spec.rb
3369486308
2021-08-19 17:28:30 +09:00
Kazuki Tsujimoto
ecb6d6a4ef
Allow omission of parentheses in one line pattern matching [Feature #16182] 2021-08-19 17:07:58 +09:00
Benoit Daloze
73085c8d8e Update to ruby/spec@330c641 2021-08-13 18:09:14 +02:00
S.H
9b3fcfbbb9
Suppress unused-result warnings
* Hide read function warning in string_spec_RSTRING_PTR_read function

* The type of `read` may be `ssize_t`

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-08-07 12:50:55 +09:00
Benoit Daloze
ff6c176028 Tweak rb_str_modify_expand() + read() spec to try to find out why it fails on some platforms
* Use a longer string as <= 23 characters it's embedded on CRuby and
  the value of rb_str_capacity() is implementation-specific.
2021-07-30 11:36:20 +02:00
Jeremy Evans
64ac984129 Make RubyVM::AbstractSyntaxTree.of raise for method/proc created in eval
This changes Thread::Location::Backtrace#absolute_path to return
nil for methods/procs defined in eval.  If the realpath of an iseq
is nil, that indicates it was defined in eval, in which case you
cannot use RubyVM::AbstractSyntaxTree.of.

Fixes [Bug #16983]

Co-authored-by: Koichi Sasada <ko1@atdot.net>
2021-07-29 13:51:03 -07:00
Benoit Daloze
6998d75824 Update to ruby/spec@b65d01f 2021-07-29 22:11:21 +02:00
Hiroshi SHIBATA
c3d31377b3
Bump unicode version for Ruby 3.1 2021-07-27 18:00:32 +09:00
Benoit Daloze
c8172d0b96 rb_iterate is no longer used in ruby/spec 2021-07-26 13:24:38 +02:00
Nobuyoshi Nakada
42745ecae3
Remove meaningless IO#close_on_exec= spec [Feature #17745] 2021-07-20 21:45:11 +09:00
Nobuyoshi Nakada
e0e12202c7
Use rb_block_call() instead of the deprecated rb_iterate() 2021-07-18 11:40:21 +09:00
Kazuhiro NISHIYAMA
f11f9fc921
Disable spec of pattern matching is experimental since 3.1 2021-07-17 13:24:23 +09:00
Kazuhiro NISHIYAMA
2a5b5ff49a
Fix a spec failure
```
1)
Warning.[]= :experimental emits and suppresses warnings for :experimental FAILED
Expected "" =~ /is experimental/
to be truthy but was nil
```
2021-07-17 13:24:08 +09:00
Kazuhiro NISHIYAMA
503fa1620c
Fix a spec failure
```
1)
The -W command line option with :no-experimental suppresses experimental warnings FAILED
Expected "" =~ /is experimental/
to be truthy but was nil
```
2021-07-17 13:16:48 +09:00
Nobuyoshi Nakada
301d194ee3 Add Integer.try_convert [Feature #15211] 2021-07-16 17:49:53 +09:00
Martin Dürst
146a943d9a Fix ruby_version guards in Unicode/Emoji version specs
Correct version guards in ruby_version in Unicode/Emoji version
specs to correctly use exclusive range endings.
2021-07-08 14:45:03 +09:00
Martin Dürst
ba357bace2 Add new Unicode/Emoji version checks to spec/ruby/library/rbconfig
- Limit Unicode version 12.1.0 to Ruby versions 2.6.3 - 3.0
- Check that Ruby version 3.1 has Unicode version 13.0.0
- Limit Unicode Emoji version 12.1 to Ruby versions 2.7 - 3.0
- Check that Ruby version 3.1 has Unicode Emoji version 13.0
2021-07-08 14:45:03 +09:00
Yusuke Endoh
e946049665 [WIP] add error_squiggle gem
```
$ ./local/bin/ruby -e '1.time {}'
-e:1:in `<main>': undefined method `time' for 1:Integer (NoMethodError)

1.time {}
 ^^^^^
Did you mean?  times
```

https://bugs.ruby-lang.org/issues/17930
2021-06-29 23:45:49 +09:00
Benoit Daloze
750f807575 Update to ruby/spec@c6e9285 2021-06-02 15:54:38 +02:00
Benoit Daloze
22e2a6a999 Update to ruby/spec@a0b7d0d 2021-06-02 14:34:07 +02:00
Jun Aruga
2048dfc5d3 Skip a File.atime test randomly failing on Travis ppc64le.
See <https://bugs.ruby-lang.org/issues/17926>.
2021-06-02 12:38:27 +02:00
Jeremy Evans
f516379853 Fix Enumerator::ArithmeticSequence handling of float ranges
Depending on the float range, there could be an off-by-one error,
where the last result that should be in the range was missed. Fix
this by checking if the computed value for the expected value
outside the range is still inside the range, and if so, increment
the step size.

Fixes [Bug #16612]
2021-05-29 08:56:15 -07:00