aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
Commit message (Collapse)AuthorAgeFilesLines
* compile.c: avoid newarraykwsplat for argumentsv2_7_0_rc2Yusuke Endoh2019-12-221-0/+6
| | | | | | | | | | | | | | `foo(*rest, post, **empty_kw)` is compiled like `foo(*rest + [post, **empty_kw])`, and `**empty_kw` is removed by "newarraykwsplat" instruction. However, the method call still has a flag of KW_SPLAT, so "post" is considered as a keyword hash, which caused a segfault. Note that the flag cannot be removed if "empty_kw" is not always empty. This change fixes the issue by compiling arguments with "newarray" instead of "newarraykwsplat". [Bug #16442]
* Should return "." for File.extname("file.") also on WindowsNAKAMURA Usaku2019-12-222-8/+4
| | | | | But not changes another cases, such as "file.rb." [Bug #15267]
* Kernel#lambda: return forwarded block as non-lambda procAlan Wu2019-12-211-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | Before this commit, Kernel#lambda can't tell the difference between a directly passed literal block and one passed with an ampersand. A block passed with an ampersand is semantically speaking already a non-lambda proc. When Kernel#lambda receives a non-lambda proc, it should simply return it. Implementation wise, when the VM calls a method with a literal block, it places the code for the block on the calling control frame and passes a pointer (block handler) to the callee. Before this commit, the VM forwards block arguments by simply forwarding the block handler, which leaves the slot for block code unused when a control frame forwards its block argument. I use the vacant space to indicate that a frame has forwarded its block argument and inspect that in Kernel#lambda to detect forwarded blocks. This is a very ad-hoc solution and relies *heavily* on the way block passing works in the VM. However, it's the most self-contained solution I have. [Bug #15620]
* test/ruby/test_pattern_matching.rb: suppress "unused variable" warningYusuke Endoh2019-12-211-0/+17
|
* Added `-W:experimental` command line optionNobuyoshi Nakada2019-12-201-0/+6
| | | | [Feature #16420]
* Added `experimental` warning categoryNobuyoshi Nakada2019-12-202-4/+23
| | | | [Feature #16420]
* Added -W: command line optionNobuyoshi Nakada2019-12-201-0/+9
| | | | | To manage `Warning[category]` flags. Only `-W:deprecated` and `-W:no-deprecated` are available now. [Feature #16345]
* vm_args.c: rephrase the warning message of keyword argument separationYusuke Endoh2019-12-207-343/+343
| | | | | | | | | | (old) test.rb:4: warning: The last argument is used as the keyword parameter test.rb:1: warning: for `foo' defined here; maybe ** should be added to the call? (new) test.rb:4: warning: The last argument is used as keyword parameters; maybe ** should be added to the call test.rb:1: warning: The called method `foo' is defined here
* Refined the warning message for $, and $;Nobuyoshi Nakada2019-12-201-1/+1
| | | | [Bug #16438]
* Refined the warning message for numbered-parameter like variablesNobuyoshi Nakada2019-12-201-1/+1
| | | | [Bug #16438]
* Refined the warning message for numbered-parameter like variablesNobuyoshi Nakada2019-12-201-6/+7
| | | | [Bug #16438]
* Makes the receiver to FrozenError.new a keyword parameterNobuyoshi Nakada2019-12-201-1/+1
| | | | [Feature #16419]
* Fixed misspellingsNobuyoshi Nakada2019-12-203-3/+3
| | | | Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
* Warn also numbered parameter like methodsNobuyoshi Nakada2019-12-201-0/+2
|
* Warn also numbered parameter like parametersNobuyoshi Nakada2019-12-201-0/+2
| | | | [Feature #16433]
* Manage deprecation warnings about keyword argumentNobuyoshi Nakada2019-12-191-0/+3
|
* Made the warning for deprecated constants follow the category flagNobuyoshi Nakada2019-12-191-0/+5
|
* Use a temporary file for chown testNobuyoshi Nakada2019-12-181-5/+3
| | | | | Errno::EROFS may occur when the source tree is placed in a read-only filesystem.
* Added a test for [Bug #16159]Nobuyoshi Nakada2019-12-171-0/+6
|
* test/ruby/test_process.rb: suppress "unused variable" warningYusuke Endoh2019-12-171-1/+1
|
* Kernel#abort without arguments should print error infoNobuyoshi Nakada2019-12-161-1/+11
| | | | [Bug #16424]
* IO#set_encoding_by_bom should err when encoding is already setNobuyoshi Nakada2019-12-151-0/+10
| | | | Except for ASCII-8BIT. [Bug #16422]
* rand(beginless_range) raise Errno::EDOM instead of TypeErrorKazuhiro NISHIYAMA2019-12-151-0/+1
| | | | | | | | | | | | | | | | | | | | | same as `rand(endless_range)` Before: ``` $ ruby -e 'rand(..1)' Traceback (most recent call last): 2: from -e:1:in `<main>' 1: from -e:1:in `rand' -e:1:in `-': nil can't be coerced into Integer (TypeError) ``` After: ``` $ ruby -e 'rand(..1)' Traceback (most recent call last): 1: from -e:1:in `<main>' -e:1:in `rand': Numerical argument out of domain (Errno::EDOM) ```
* Add `Warning.[]` and `Warning.[]=`Nobuyoshi Nakada2019-12-131-0/+6
|
* Improved the test for Thread#inspect [Feature #16412]Nobuyoshi Nakada2019-12-131-1/+5
|
* [cygwin] fix File.absolute_path? testNobuyoshi Nakada2019-12-121-2/+5
| | | | | Paths start with the root are absolute on cygwin, regardless the drive letter.
* Cygwin path cannot be mapped to a UNC as-isNobuyoshi Nakada2019-12-121-1/+1
|
* Make super in instance_eval in method in module raise TypeErrorJeremy Evans2019-12-121-0/+23
| | | | | | | | | | | | | | | | | | | | | | | This makes behavior the same as super in instance_eval in method in class. The reason this wasn't implemented before is that there is a check to determine if the self in the current context is of the expected class, and a module itself can be included in multiple classes, so it doesn't have an expected class. Implementing this requires giving iclasses knowledge of which class created them, so that super call in the module method knows the expected class for super calls. This reference is called includer, and should only be set for iclasses. Note that the approach Ruby uses in this check is not robust. If you instance_eval another object of the same class and call super, instead of an TypeError, you get super called with the instance_eval receiver instead of the method receiver. Truly fixing super would require keeping a reference to the super object (method receiver) in each frame where scope has changed, and using that instead of current self when calling super. Fixes [Bug #11636]
* Do not load files in build directoryKazuhiro NISHIYAMA2019-12-112-21/+21
| | | | related https://bugs.ruby-lang.org/issues/16177
* Fix Enumerator::Lazy#with_indexJeremy Evans2019-12-111-2/+15
| | | | | | | | | | | | | | | | * Make it correctly handle lambdas * Make it iterate over the block if block is given The original implementation was flawed, based on lazy_set_method instead of lazy_add_method. Note that there is no implicit map when passing a block, the return value of the block passed to with_index is ignored, just as it is for Enumerator#with_index. Also like Enumerator#with_index, when called with a block, the return value is an enumerator without the index. Fixes [Bug #16414]
* test/ruby/test_keywords.rb: suppress a warningYusuke Endoh2019-12-101-1/+1
| | | | | | | https://rubyci.org/logs/rubyci.s3.amazonaws.com/ubuntu1604/ruby-master/log/20191210T003005Z.log.html.gz ``` .../test/ruby/test_keyword.rb:2711: warning: `*' interpreted as argument prefix ```
* Add Proc#ruby2_keywordsJeremy Evans2019-12-091-0/+39
| | | | | | | | | | | | This allows passing keywords through a normal argument splat in a Proc. While needing ruby2_keywords support for methods is more common, there is code that delegates keywords through normal argument splats in procs, including code in Rails. For that reason, it makes sense to expose this for procs as well. Internally, ruby2_keywords is not tied to methods, but iseqs, so this just allows for setting the ruby2_keywords for the iseq related to the proc.
* test/ruby/test_file_exhaustive.rb: shorten the name of temporary dirYusuke Endoh2019-12-071-1/+1
| | | | | | | | | ``` 1) Error: TestFileExhaustive#test_socket_p: ArgumentError: too long unix socket path (109bytes given but 108bytes max) /export/home/users/chkbuild/cb-sunc/tmp/build/20191207T024036Z/ruby/test/ruby/test_file_exhaustive.rb:155:in `initialize' ```
* Detect started threads when require onlyKazuhiro NISHIYAMA2019-12-061-0/+28
|
* add additional CF info for CI envKoichi Sasada2019-12-051-1/+1
| | | | | | | | | Introduce new RUBY_DEBUG option 'ci' to inform Ruby interpreter that an interpreter is running on CI environment. With this option, `rb_bug()` shows more information includes method entry information, local variables information for each control frame.
* Make TracePoint.stat a singleton method again (#2726)Alan Wu2019-12-041-0/+4
| | | [Bug #16399]
* implement Range#count卜部昌平2019-12-041-0/+4
| | | | As matz requested in [Bug #16366].
* Make {Method,UnboundMethod}#super_method handle clone/bind/unbindJeremy Evans2019-12-041-0/+30
| | | | | | | | 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]
* Revert "Regexp#match{?} with nil raises TypeError as String, Symbol (#1506)"NARUSE, Yui2019-12-043-12/+2
| | | | | This reverts commit 2a22a6b2d8465934e75520a7fdcf522d50890caf. Revert [Feature #13083]
* Revert "Revert nil error and adding deprecation message"NARUSE, Yui2019-12-041-2/+2
| | | | This reverts commit 452bee3ee8d68059fabd9b1c7a75661b14e3933e.
* Make Enumerator::Chain#each treat lambdas as lambdaJeremy Evans2019-12-031-0/+16
| | | | | | | | 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]
* Do not lose existing constant visibility when autoloadingJeremy Evans2019-12-031-0/+60
| | | | | | | | | | 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]
* Fixed stack overflow [Bug #16382]Nobuyoshi Nakada2019-12-031-0/+11
| | | | | Get rid of infinite recursion in expanding a load path to the real path while loading a transcoder.
* Check MJIT support in one placeTakashi Kokubun2019-12-011-2/+0
| | | | | to fix test failure on trunk-no-mjit https://gist.github.com/ko1/32ab982ffd7555988818773c08f97123
* Skip --jit-debug= test on mswinTakashi Kokubun2019-12-011-1/+2
| | | | | it fails like https://ci.appveyor.com/project/ruby/ruby/builds/29235837/job/v0apdjj4qx8afars
* Use build dir for testing --jit-debugTakashi Kokubun2019-12-011-1/+2
| | | | to fix failure like https://github.com/ruby/ruby/runs/327745536
* Allow specifying arbitrary MJIT flags by --jit-debugTakashi Kokubun2019-12-011-0/+6
| | | | | | | | 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.
* Relax test strictness for error message from KeyErrorYuki Nishijima2019-11-301-1/+1
|
* ENV.update should not call block on existing keysNobuyoshi Nakada2019-11-301-1/+1
| | | | [Bug #16192]
* Supress class variable overtaken warning when original modules are the sameJeremy Evans2019-11-291-0/+23
| | | | | This issue was exposed by recent commits to better support including refined modules.