summaryrefslogtreecommitdiffhomepage
path: root/test/t/string.rb
AgeCommit message (Collapse)Author
2020-10-13Introduce endless range (a part of #5085)taiyoslime
Co-Authored-By: n4o847 <[email protected]> Co-Authored-By: smallkirby <[email protected]>
2019-12-11Fix behavior of `Kernel#Integer` to numbers ending with `_` and spacesKOBAYASHI Shuji
#### Before this patch: ```ruby Integer("1_ ") #=> 1 ``` #### After this patch (same as Ruby): ```ruby Integer("1_ ") #=> ArgumentError ```
2019-12-10Fix behavior of `String#to_i`/`Kernel#Integer` to numbers starting with `_`KOBAYASHI Shuji
#### Before this patch: ```ruby Integer("_1") #=> 1 "_1".to_i #=> 1 ``` #### After this patch (same as Ruby): ```ruby Integer("_1") #=> ArgumentError "_1".to_i #=> 0 ```
2019-12-09Fix that `String#to_f` accepts consecutive `_` as a numeric expressionKOBAYASHI Shuji
Consecutive `_` is not allowed as a numeric expression: 1_2__3 #=> SyntaxError Float("1_2__3") #=> ArgumentError Integer("1_2__3") #=> ArgumentError "1_2__3".to_i #=> 12 But `String#to_f` accept it, so I fixed the issue. Before this patch: "1_2__3".to_f #=> 123 After this patch: "1_2__3".to_f #=> 12
2019-10-10Integrate `mrb_str_inspect` and `mrb_str_dump`KOBAYASHI Shuji
2019-09-27Simplify arguments check in `String#rindex`KOBAYASHI Shuji
Also fix document about type of the first argument.
2019-09-19Simplify arguments check in `String#index`KOBAYASHI Shuji
Also fix document about type of the first argument.
2019-09-11Move tests related to `getbyte`, `setbyte`, byteslice` to core.Yukihiro "Matz" Matsumoto
2019-08-17Add `String#rindex` test for invalid UTF-8 stringdearblue
2019-08-17Fix `String#rindex` test for UTF-8 stringdearblue
2019-07-18Fix `String#*` test with `MRB_WITHOUT_FLOAT`KOBAYASHI Shuji
2019-07-17Fix `String#[]` testKOBAYASHI Shuji
2019-07-11Add UTF-8 test for `String#index`dearblue
2019-06-29Add test for `String#[]=`dearblue
2019-06-28Use `__ENCODING__` in testsKOBAYASHI Shuji
It cannot be used for `String#size` test if judging whether or not `MRB_UTF8_STRING` is defined by result of `String#size`.
2019-06-22Add test for one UTF-8 charactordearblue
2019-06-08Remove "Check the usage of a NUL character" testKOBAYASHI Shuji
Because there is not assertion in this test and NUL character literal is used in other tests.
2019-05-03Simplify conversion process for `i` in `mrb_get_args()`KOBAYASHI Shuji
2019-04-21Commented out `String#scan` because it is not implemented yetKOBAYASHI Shuji
2019-04-19Add type check (conversion) in `String#[]=`KOBAYASHI Shuji
Before this patch: 'a'[0] = 1 #=> 1 'a'[:a] = '1' #=> ArgumentError 'a'[:a, 0] = '1' #=> ArgumentError 'a'[0, :a] = '1' #=> ArgumentError 'a'[0, 1] = 1 #=> 1 After this patch / Ruby: 'a'[0] = 1 #=> TypeError 'a'[:a] = '1' #=> TypeError 'a'[:a, 0] = '1' #=> TypeError 'a'[0, :a] = '1' #=> TypeError 'a'[0, 1] = 1 #=> TypeError
2019-03-19Use `FrozenError` instead of `RuntimeError` in frozen object modification testKOBAYASHI Shuji
2019-02-28Remove `?A` style string literals from string tests; #4303Yukihiro "Matz" Matsumoto
We have a plan to obsolete this style in the future.
2019-02-27Add test for string literal concatenationdearblue
2019-01-22Fix tests for `String#reverse` with `MRB_UTF8_STRING`KOBAYASHI Shuji
2019-01-05Add `assert_same` and `assert_not_same`KOBAYASHI Shuji
2019-01-03Remove `Kernel#class_defined?` which is not available in CRuby; #3829Yukihiro "Matz" Matsumoto
2018-11-19Remove implicit conversion using `to_str` method; fix #3854Yukihiro "Matz" Matsumoto
We have added internal convenience method `__to_str` which does string type check. The issue #3854 was fixed but fundamental flaw of lack of stack depth check along with fibers still remains. Use `MRB_GC_FIXED_ARENA` for workaround.
2018-03-24Return nil if type differ in `String#<=>`.Takeshi Watanabe
2018-02-12`String#inspect` to use hexadecimal, not octal to print unprintable.Yukihiro "Matz" Matsumoto
2017-11-22Some cosmetic changesYukihiro "Matz" Matsumoto
2017-10-11Test for MRB_WITHOUT_FLOATYAMAMOTO Masaya
2017-03-22Fix result if pattern is emptyksss
2017-03-19Callback should yield with pattern every timeksss
2017-03-15Suuport custom separatorksss
2017-03-11Merge branch 'master' into string-gsubYukihiro "Matz" Matsumoto
2017-03-10\1 sequences as empty stringsksss
2017-03-10Avoid infinity loop when empty string patternksss
2017-03-05String#index shouldn't return nil when "".index ""ksss
2016-12-15Fix crash when exponent is -2147483648Clayton Smith
2016-11-24Get String length after args in String#chomp!Clayton Smith
Fixes RCE issue Reported by @bouk
2016-11-17String#include? does not take integersYukihiro "Matz" Matsumoto
2015-10-01clarify asserts to UTF-8 test suites; ref #2971Yukihiro "Matz" Matsumoto
2015-09-30fix testsYasuhiro Matsumoto
2015-09-29chop with utf-8. fix #2967Yasuhiro Matsumoto
2015-09-24UTF-8 string support in coreYukihiro "Matz" Matsumoto
define MRB_UTF8_STRING (in mrbconf.h) to enable UTF-8 support.
2015-09-23String#rindex should no longer take integer argumentYukihiro "Matz" Matsumoto
2015-09-16support String#[]= with 3 argstakahashim
2015-08-27Add String#freeze testJun Hiroe
2015-06-08gsub/sub supports back references in substitutes. fixes #2816.Tomoyuki Sahara
This implementation is compatible with CRuby's String#gsub/sub except \1 ... \9 and \+. They are useless without Regexp library.
2014-12-17String#[] should reject nil indexh2so5