summaryrefslogtreecommitdiff
path: root/test/ruby/test_symbol.rb
AgeCommit message (Collapse)Author
2019-12-04Revert "Regexp#match{?} with nil raises TypeError as String, Symbol (#1506)"NARUSE, Yui
This reverts commit 2a22a6b2d8465934e75520a7fdcf522d50890caf. Revert [Feature #13083]
2019-11-28Added Symbol#start_with? and Symbol#end_with? method. [Feature #16348]NARUSE, Yui
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-10-17Regexp#match{?} with nil raises TypeError as String, Symbol (#1506)Kenichi Kamiya
* {String|Symbol}#match{?} with nil returns falsy To improve consistency with Regexp#match{?} * String#match(nil) returns `nil` instead of TypeError * String#match?(nil) returns `false` instead of TypeError * Symbol#match(nil) returns `nil` instead of TypeError * Symbol#match?(nil) returns `false` instead of TypeError * Prefer exception * Follow empty ENV * Drop outdated specs * Write ruby/spec for above https://github.com/ruby/ruby/pull/1506/files#r183242981 * Fix merge miss
2018-12-30vm_args.c: search symbol proc in super classesnobu
* vm_args.c (refine_sym_proc_call): traverse ancestors to search inherited methods for symbol proc. [ruby-dev:50741] [Bug #15489] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-18Enable refinements on symbol-proc in ruby-level methodsnobu
* vm_args.c (refine_sym_proc_call): resolve refinements when the proc is invoked, instead of resolving at making the proc, to enable refinements on symbol-proc in ruby-level methods * vm.c (vm_cref_dup): clear cached symbol-procs when duplicating. [Bug #15114] [Fix GH-2039] From: manga_osyo <manga.osyo@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-04Revert "Symbol refinements"mrkn
Due to assertion failures when VM_CHECK_MODE >= 2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-04Symbol refinementsmrkn
* vm_args.c (refine_sym_proc_call): enalbe accidentally disabled refinements in Symbol#to_proc. [Bug #15114] From: osyo (manga osyo) <manga.osyo@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03Revert "Symbol refinements"nobu
Due to assertion failures when VM_CHECK_MODE >= 2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03Symbol refinementsnobu
* vm_args.c (refine_sym_proc_call): enalbe accidentally disabled refinements in Symbol#to_proc. [Bug #15114] From: osyo (manga osyo) <manga.osyo@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03Revert "Symbol refinements [Bug #15114]"nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03Symbol refinements [Bug #15114]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-03Suppress warning: method redefined; discarding old ==naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-02Symbol#== should be able to be redefinedktsj
* vm.c (vm_init_redefined_flag): set redefinition flag for Symbol#==. The bug was introduced in r58895. * test/ruby/test_symbol.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21test_string.rb,test_symbol.rb: add some testsstomar
* test/ruby/test_string.rb: add more test cases for String#casecmp. * test/ruby/test_symbol.rb: ditto for Symbol#{casecmp,casecmp?}. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-29test_symbol.rb: switch to assert_not_equalnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-28test/ruby/test_symbol.rb: new test for nondeterminismnormal
We need to ensure hashes for static symbols remain non-deterministic to avoid DoS attacks. This is currently the case since 2.4+, but was not for the 2.3 series. * test/ruby/test_symbol.rb (test_hash_nondeterministic): new test [ruby-core:80430] [Bug #13376] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26vm_eval.c: Symbol#to_proc and instance_execnobu
* vm_eval.c (yield_under): should evaluate the proc on the first argument. [ruby-core:78839] [Bug #13074] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-26test/ruby/test_symbol.rb: use begin;end; hacknobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-18Increase timeoutnaruse
http://rubyci.s3.amazonaws.com/unstable10s/ruby-trunk/log/20161215T021909Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-12test for Symbol#match? [Feature #12898]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-06Fix typoskazu
Patch by: Koichi ITO <koic.ito@gmail.com> [Fix GH-1498] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-28implement String/Symbol#casecmp? including Unicode case foldingduerst
* string.c: Implement String#casecmp? and Symbol#casecmp? by using String#downcase :fold for Unicode case folding. This does not include options such as :turkic, because these currently cannot be combined with the :fold option. This implements feature #12786. * test/ruby/test_string.rb/test_symbol.rb: Tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-15test_refinement.rb: test_symbol_procnobu
* test/ruby/test_refinement.rb (test_symbol_proc): move from test_symbol.rb [Feature #9451] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-15vm_args.c: allow refinements in Symbol procnobu
* vm_args.c (refine_sym_proc_call): search and call method with refinements. * vm_args.c (vm_caller_setup_arg_block): enable refinements when enabled in the caller. [Feature #9451] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-28Passed block symbol to procnobu
* proc.c (passed_block): convert passed block symbol to proc. based on the patch by Daisuke Sato in [ruby-dev:49695]. [Bug #12531] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06vm_insnhelper.c: check symbol proc to thrownobu
* vm_insnhelper.c (vm_throw_start): check if the iseq is symbol proc, class definition should not be a symbol proc. [ruby-core:75856] [Bug #12462] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16proc.c: fail symbol proc bindingnobu
* proc.c (proc_binding): proc from symbol can not make a binding. [ruby-core:74100] [Bug #12137] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-19test/ruby: suppress parser warningsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-18string.c: Symbol#matchnobu
* string.c (sym_match_m): delegate to String#match but not String#=~. [ruby-core:72864] [Bug #11991] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-25symbol.c: more informative error messagenobu
* symbol.c (sym_check_asciionly): more informative error message with the encoding name and the inspected content. [ruby-core:73398] [Feature #12016] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-19proc.c: fix infinite loopnobu
* proc.c (rb_proc_get_iseq): proc made from symbol does not have iseq. fix infinite loop. [ruby-core:72381] [Bug #11845] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-17* proc.c (rb_block_arity): should not call GetProcPtr() for symbols.shugo
[ruby-core:72205] [Bug #11830] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-20symbol.c: not freeze the receivernobu
* symbol.c (rb_str_intern): should not freeze the receiver itself unexpectedly. [ruby-core:71611] [Bug #11721] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-16* test/ruby/test_symbol.rb (test_symbol_fstr_leak): add a warm-upodaira
code and check RSS to avoid false positive on AIX and false negative on Mac OS X. [Bug #10686] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-15proc.c: void envnobu
* proc.c (rb_sym_to_proc): make void env. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-15proc.c: proc without envnobu
* proc.c (rb_sym_to_proc): move from string.c and create a Proc with no environments. [ruby-core:71088] [Bug #11594] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06vm_args.c: wrap symbol ifuncnobu
* vm_args.c (args_setup_block_parameter): wrap a symbol in ifunc by a proc as a block parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-05proc.c: set ep properlynobu
* proc.c (proc_new): link ep to calling block. [ruby-core:70980] [Bug #11566] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-04test_symbol.rb: relaxnobu
* test/ruby/test_symbol.rb (test_to_proc): relax timeout of r51991 too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-03test_symbol.rb: reduce iterationnobu
* test/ruby/test_symbol.rb (test_to_proc): reduce iteration count more. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-02test_symbol.rb: reduce iterationnobu
* test/ruby/test_symbol.rb (test_to_proc): reduce iteration count. actually it reproduced in 2 times. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-01test_symbol.rb: relaxnobu
* test/ruby/test_symbol.rb (test_to_proc): relax the timeout. [ruby-core:70961] [Bug #11560] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-01proc.c: fix symbol proc marknobu
* proc.c (proc_mark): block.ep of Proc from Symbol is now NULL. [ruby-core:70961] [Bug #11560] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-01vm_args.c: GC guardnobu
* vm_args.c (vm_caller_setup_arg_block): prevent newly created ifunc object from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-22test_parse.rb: move assertionsnobu
* test/ruby/test_module.rb (test_remove_class_variable): move an assertion for Module#remove_class_variable from test_parse.rb. * test/ruby/test_symbol.rb (test_intern, test_all_symbols): move assertions for Symbol#intern and Symbol.all_symbols from test_parse.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-23vm_eval.c: allow symbols to instance_eval/execnobu
* vm_eval.c (rb_obj_instance_eval, rb_obj_instance_exec): allow symbols to just instance_eval/exec, execept for definition of singletons. [ruby-core:68961] [Bug #11086] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-08* test/ruby/test_symbol.rb: fix syntax error.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-08hash.c: compare symbols by identitiesnobu
* hash.c (rb_any_hash): Symbols are compared by the identities always. [ruby-core:68767] [Bug #11035] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e