summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2019-12-04Make {Method,UnboundMethod}#super_method handle clone/bind/unbindJeremy Evans
This wasn't working previously because the iclass entry wasn't being copied, and without an iclass entry, super_method returns nil. Fixes [Bug #15629] Notes: Merged: https://github.com/ruby/ruby/pull/2723
2019-12-04Revert "Regexp#match{?} with nil raises TypeError as String, Symbol (#1506)"NARUSE, Yui
This reverts commit 2a22a6b2d8465934e75520a7fdcf522d50890caf. Revert [Feature #13083]
2019-12-04Revert "Revert nil error and adding deprecation message"NARUSE, Yui
This reverts commit 452bee3ee8d68059fabd9b1c7a75661b14e3933e.
2019-12-03Make Enumerator::Chain#each treat lambdas as lambdaJeremy Evans
Previously, lambdas were converted to procs because of how rb_block_call works. Switch to rb_funcall_with_block, which handles procs as procs and lambdas as lambdas. Fixes [Bug #15613] Notes: Merged: https://github.com/ruby/ruby/pull/2720
2019-12-03Do not lose existing constant visibility when autoloadingJeremy Evans
This copies the private/deprecate constant visibility across the autoload. It still is backwards compatible with setting the private/deprecate constant visibility in the autoloaded file. However, if you explicitly set public constant in the autoloaded file, that will be reset after the autoload. Fixes [Bug #11055] Notes: Merged: https://github.com/ruby/ruby/pull/2716
2019-12-03Fixed stack overflow [Bug #16382]Nobuyoshi Nakada
Get rid of infinite recursion in expanding a load path to the real path while loading a transcoder. Notes: Merged: https://github.com/ruby/ruby/pull/2714
2019-12-01Check MJIT support in one placeTakashi Kokubun
to fix test failure on trunk-no-mjit https://gist.github.com/ko1/32ab982ffd7555988818773c08f97123
2019-12-01Skip --jit-debug= test on mswinTakashi Kokubun
it fails like https://ci.appveyor.com/project/ruby/ruby/builds/29235837/job/v0apdjj4qx8afars
2019-12-01Use build dir for testing --jit-debugTakashi Kokubun
to fix failure like https://github.com/ruby/ruby/runs/327745536
2019-12-01Allow specifying arbitrary MJIT flags by --jit-debugTakashi Kokubun
This is a secret feature for me. It's only for testing and any behavior with this flag override is unsupported. I needed this because I sometimes want to add debug options but do not want to disable optimizations, for using Linux perf.
2019-11-30Relax test strictness for error message from KeyErrorYuki Nishijima
2019-11-30ENV.update should not call block on existing keysNobuyoshi Nakada
[Bug #16192] Notes: Merged: https://github.com/ruby/ruby/pull/2512
2019-11-29Supress class variable overtaken warning when original modules are the sameJeremy Evans
This issue was exposed by recent commits to better support including refined modules. Notes: Merged: https://github.com/ruby/ruby/pull/2709
2019-11-30Make single line pattern matching void expressionNobuyoshi Nakada
Instead of returning `nil`, raise a syntax error if its value is used. [Feature #16355]
2019-11-29check interrupts at each frame pop timing.Koichi Sasada
Asynchronous events such as signal trap, finalization timing, thread switching and so on are managed by "interrupt_flag". Ruby's threads check this flag periodically and if a thread does not check this flag, above events doesn't happen. This checking is CHECK_INTS() (related) macro and it is placed at some places (laeve instruction and so on). However, at the end of C methods, C blocks (IMEMO_IFUNC) etc there are no checking and it can introduce uninterruptible thread. To modify this situation, we decide to place CHECK_INTS() at vm_pop_frame(). It increases interrupt checking points. [Bug #16366] This patch can introduce unexpected events...
2019-11-29Reduce duplicated warnings for the change of Ruby 3 keyword argumentsYusuke Endoh
By this change, the following code prints only one warning. ``` def foo(**opt); end 100.times { foo({kw:1}) } ``` A global variable `st_table *caller_to_callees` is a map from caller to a set of callee methods. It remembers that a warning is already printed for each pair of caller and callee. [Feature #16289] Notes: Merged: https://github.com/ruby/ruby/pull/2458
2019-11-29vm_method.c: add top-level ruby2_keywordsYusuke Endoh
This is a top-level version of Module#ruby2_keywords. It can be used for functions (top-level methods) that delegates arguments. [Feature #16364]
2019-11-29* remove trailing spaces. [ci skip]git
2019-11-29fastpath for ivar read of FL_EXIVAR objects.Koichi Sasada
vm_getivar() provides fastpath for T_OBJECT by caching an index of ivar. This patch also provides fastpath for FL_EXIVAR objects. FL_EXIVAR objects have an each ivar array and index can be cached as T_OBJECT. To access this ivar array, generic_iv_tbl is exposed by rb_ivar_generic_ivtbl() (declared in variable.h which is newly introduced). Benchmark script: Benchmark.driver(repeat_count: 3){|x| x.executable name: 'clean', command: %w'../clean/miniruby' x.executable name: 'trunk', command: %w'./miniruby' objs = [Object.new, 'str', {a: 1, b: 2}, [1, 2]] objs.each.with_index{|obj, i| rep = obj.inspect rep = 'Object.new' if /\#/ =~ rep x.prelude str = %Q{ v#{i} = #{rep} def v#{i}.foo @iv # ivar access method (attr_reader) end v#{i}.instance_variable_set(:@iv, :iv) } puts str x.report %Q{ v#{i}.foo } } } Result: v0.foo # T_OBJECT clean: 85387141.8 i/s trunk: 85249373.6 i/s - 1.00x slower v1.foo # T_STRING trunk: 57894407.5 i/s clean: 39957178.6 i/s - 1.45x slower v2.foo # T_HASH trunk: 56629413.2 i/s clean: 39227088.9 i/s - 1.44x slower v3.foo # T_ARRAY trunk: 55797530.2 i/s clean: 38263572.9 i/s - 1.46x slower
2019-11-28Added Symbol#start_with? and Symbol#end_with? method. [Feature #16348]NARUSE, Yui
2019-11-28Make prepending a refined module after inclusion not break refinementsJeremy Evans
After the previous commit, this was still broken. The reason it was broken is that a refined module that hasn't been prepended to yet keeps the refined methods in the module's method table. When prepending, the module's method table is moved to the origin iclass, and then the refined methods are moved from the method table to a new method table in the module itself. Unfortunately, that means that if a class has included the module, prepending breaks the refinements, because when the methods are moved from the origin iclass method table to the module method table, they are removed from the method table from the iclass created when the module was included earlier. Fix this by always creating an origin class when including a module that has any refinements, even if the refinements are not currently used. I wasn't sure the best way to do that. The approach I choose was to use an object flag. The flag is set on the module when Module#refine is called, and if the flag is present when the module is included in another module or class, an origin iclass is created for the module. Fixes [Bug #13446] Notes: Merged: https://github.com/ruby/ruby/pull/2550
2019-11-28Honor refinements for modules that prepend other modulesJeremy Evans
This previously did not work, and the reason it did not work is that: 1) Refining a module or class that prepends other modules places the refinements in the class itself and not the origin iclass. 2) Inclusion of a module that prepends other modules skips the module itself, including only iclasses for the prepended modules and the origin iclass. Those two behaviors combined meant that the method table for the refined methods for the included module never ends up in the method lookup chain for the class including the module. Fix this by not skipping the module itself when the module is included. This requires some code rearranging in rb_include_class_new to make sure the correct method tables and origin settings are used for the created iclass. As origin iclasses shouldn't be exposed to Ruby, this also requires skipping modules that have origin iclasses in Module#ancestors (classes that have origin iclasses were already skipped). Fixes [Bug #16242] Notes: Merged: https://github.com/ruby/ruby/pull/2550
2019-11-28Raise `NoMatchingPatternError` when expr `in` pat doesn't matchNobuyoshi Nakada
* `expr in pattern` should raise `NoMatchingError` when unmatched * `expr in pattern` should return `nil`. (this is unspecified, but this feature is experimental, at all) [Feature #16355]
2019-11-27Don't modify rest array when using ruby2_keywordsJeremy Evans
Previously, the rest array was modified, but it turns out that is not necessary. Not modifying the rest array fixes cases when the rest array is used more than once. Notes: Merged: https://github.com/ruby/ruby/pull/2706
2019-11-23Skip test_validate_gemspec when tarball and git installed tooKazuhiro NISHIYAMA
`git --version` failed as expected when git is not installed, but unexpectedly pass when git installed and pwd is not in git working directory. So use `git rev-parse` instead, and it failed when git installed too.
2019-11-21Refined inspection of argument forwardingNobuyoshi Nakada
2019-11-20Add tests of argument forwarding's parameters and inspectKazuhiro NISHIYAMA
2019-11-20Update representation (discussed on ruby tracker)zverok
Notes: Merged: https://github.com/ruby/ruby/pull/2618
2019-11-20Fix test_module.rbzverok
Notes: Merged: https://github.com/ruby/ruby/pull/2618
2019-11-20Method parameters inspectzverok
Example: def m(a, b=nil, *c, d:, e: nil, **rest, &block) end p method(:m) #=> #<Method: m(a, b=<default>, *c, d:, e: <default>, **rest, &block) ...> Notes: Merged: https://github.com/ruby/ruby/pull/2618
2019-11-19Fix memory corruption in Enumerable#reverse_each [ruby-dev:50867] [Bug #16354]Kazuki Tsujimoto
2019-11-19Avoid needless object allocationKazuki Tsujimoto
2019-11-19Add a testKazuhiro NISHIYAMA
and rename from b.rb [ruby-core:95055] [Bug #16177]
2019-11-18pack is not using invokebuiltin anymoreTakashi Kokubun
2019-11-18catch up last commit.Koichi Sasada
Array#pack uses `opt_invokebuiltin_delegate_leave` now.
2019-11-18Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-11-18Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans
This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-11-14`#@1` is no longer an embedded variableNobuyoshi Nakada
2019-11-14test/ruby/test_proc.rb: suppress "method redefined" warningsYusuke Endoh
2019-11-13Suspend many fibers test on JIT for nowTakashi Kokubun
https://github.com/ruby/ruby/runs/301411717 No C backtrace information and this is hard to fix immediately. As CI doesn't provide helpful information, this should be debugged locally or at least have more logs there.
2019-11-12Skip tailcall test for MJITTakashi Kokubun
failing in https://github.com/ruby/ruby/runs/300579218
2019-11-13Avoid top-level search for nested constant reference from nil in defined?Dylan Thacker-Smith
Fixes [Bug #16332] Constant access was changed to no longer allow top-level constant access through `nil`, but `defined?` wasn't changed at the same time to stay consistent. Use a separate defined type to distinguish between a constant referenced from the current lexical scope and one referenced from another namespace. Notes: Merged: https://github.com/ruby/ruby/pull/2657
2019-11-12Show the name `Kernel#proc` in the warning messageNobuyoshi Nakada
2019-11-12Added assertions for realpath and realdirpathNobuyoshi Nakada
It is said that realpath(3) and realdirpath(3) on some platforms may return a relative path.
2019-11-12Revert "Method reference operator"Nobuyoshi Nakada
This reverts commit 67c574736912003c377218153f9d3b9c0c96a17b. [Feature #16275]
2019-11-12Warn on `...` at EOLNobuyoshi Nakada
2019-11-12Clear current argument name at empty block argument [Bug #16343]Nobuyoshi Nakada
2019-11-12test/ruby/test_require.rb: Remove the tests of require with $SAFEYusuke Endoh
The taint mechanism is decided to be removed at 2.7. [Feature #16131] So, this change removes the tests that expects a SecurityError when requiring a file under $SAFE >= 1. The reason why they should be removed in advance is because the upstream of rubygems has already removed a call to "untaint" method, which makes the tests fail.
2019-11-11Skip test_validate_gemspec unless git installedKazuhiro NISHIYAMA
2019-11-11Revert "Warn EOF char in comment"NARUSE, Yui
This reverts commit 69ec3f70fab0c1c537c68fb135cc315181b1d750.