summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2024-11-01[ruby/json] Setup ruby_memcheckJean Boussier
Hoping it might find the leak reported in https://github.com/ruby/json/issues/460 https://github.com/ruby/json/commit/08635312e5
2024-11-01`alias` should not set `defined_class` for ModulesKoichi Sasada
`me->defined_class` should be 0 for method entries of Modules. This patch checks this condition and fix https://github.com/ruby/ruby/pull/11965#issuecomment-2448291790 Notes: Merged: https://github.com/ruby/ruby/pull/11968
2024-11-01Removed accidentally sync fileHiroshi SHIBATA
2024-10-31Fix assertion when envval of proc is QundefPeter Zhu
The following code crashes with assertions enabled because envval could be Qundef: {}.to_proc.dup Notes: Merged: https://github.com/ruby/ruby/pull/11970
2024-10-31Fix indentation in TestProc#test_hash [ci skip]Peter Zhu
2024-10-31[ruby/openssl] pkcs7: remove default cipher from PKCS7.encryptKazuki Yamaguchi
Require that users explicitly specify the desired algorithm. In my opinion, we are not in a position to specify the default cipher. When OpenSSL::PKCS7.encrypt is given only two arguments, it uses "RC2-40-CBC" as the symmetric cipher algorithm. 40-bit RC2 is a US export-grade cipher and considered insecure. Although this is technically a breaking change, the impact should be minimal. Even when OpenSSL is compiled with RC2 support and the macro OPENSSL_NO_RC2 is not defined, it will not actually work on modern systems because RC2 is part of the legacy provider. https://github.com/ruby/openssl/commit/439f456bfa
2024-10-31Introduce Fiber Scheduler `blocking_region` hook. (#11963)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2024-10-31[ruby/error_highlight] use `instance_method` to get method objectKoichi Sasada
instead of `method()`. There is a bug around `define_method`, so this patch is workaround. https://github.com/ruby/error_highlight/commit/4d04537f58
2024-10-30Only check RubyVM on CRubyCharles Oliver Nutter
Blind use of the RubyVM constant here prevents this test from running on non-CRuby. This patch guards it with RUBY_ENGINE == "ruby" to make sure that doesn't happen. Notes: Merged: https://github.com/ruby/ruby/pull/11964
2024-10-30[rubygems/rubygems] Fix `gem update --system` leaving old default bundler ↵David Rodríguez
executables around https://github.com/rubygems/rubygems/commit/4b81add54c
2024-10-29[ruby/error_highlight] Redefine in the module contextNobuyoshi Nakada
https://github.com/ruby/error_highlight/commit/0048bd0285
2024-10-30Fix method definition ownersNobuyoshi Nakada
2024-10-29[ruby/error_highlight] Suppress smaller `max_snippet_width` warningNobuyoshi Nakada
https://github.com/ruby/error_highlight/commit/9cd14c5b9a
2024-10-29Handle all formatting configs potentially being `nil`.Jean Boussier
Fix: https://github.com/ruby/json/issues/653 I don't think this was really fully supported in the past, but it kinda worked with some of the implementations.
2024-10-26[ruby/json] Workaround rubygems $LOAD_PATH bugJean Boussier
Ref: https://github.com/ruby/json/issues/647 Ref: https://github.com/rubygems/rubygems/pull/6490 Older rubygems are executing `extconf.rb` with a broken `$LOAD_PATH` causing the `json` gem native extension to be loaded with the stdlib version of the `.rb` files. This fails with ``` json/common.rb:82:in `initialize': wrong number of arguments (given 1, expected 0) (ArgumentError) ``` Since this is just for `extconf.rb` we can probably just accept that extra argument and ignore it. The bug was fixed in rubygems 3.4.9 / 2023-03-20 https://github.com/ruby/json/commit/1f5e849fe0
2024-10-26[ruby/json] Cleanup test_helper.rbJean Boussier
https://github.com/ruby/json/commit/49de571dd8
2024-10-26json_pure: fix ractor compatibilityJean Boussier
This actually never worked, because the test was always testing the ext version from the stdlib, never the pure version nor the current ext version.
2024-10-26[ruby/json] Cleaner .encode / .force_encodingJean Boussier
https://github.com/ruby/json/commit/cecf04fdfc
2024-10-26[ruby/json] Modernize heredocsJean Boussier
https://github.com/ruby/json/commit/fb25e94aea
2024-10-26pretty_generate: don't apply object_nl / array_nl for empty containersJean Boussier
Fix: https://github.com/ruby/json/issues/437 Before: ```json { "foo": { }, "bar": [ ] } ``` After: ```json { "foo": {}, "bar": [] } ```
2024-10-26[ruby/json] JSON.dump / String#to_json: raise on invalid encodingJean Boussier
This regressed since 2.7.2. https://github.com/ruby/json/commit/35407d6635
2024-10-26Raise the correct exception in fast_serialize_stringBenoit Daloze
* Related to https://github.com/ruby/json/issues/344
2024-10-26[ruby/json] raise_parse_error: avoid UBJean Boussier
Fix: https://github.com/ruby/json/pull/625 Declaring the buffer in a sub block cause bugs on some compilers. https://github.com/ruby/json/commit/90967c9eb0
2024-10-26[ruby/json] Drop compatibility for missing Array#permutation (Ruby <= 1.8.6)Étienne Barrié
https://github.com/ruby/json/commit/b02091ed44 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-10-26Use frozen string literalsÉtienne Barrié
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-10-26Use Encoding constants, String#bÉtienne Barrié
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-10-26[ruby/json] Add test coverage for JSON.load with a ProcJean Boussier
Fix: https://github.com/ruby/json/issues/438 https://github.com/ruby/json/commit/9dd89eaac8
2024-10-26[ruby/json] Limit the size of ParserError exception messagesJean Boussier
Fix: https://github.com/ruby/json/issues/534 Only include up to 32 bytes of unparseable the source. https://github.com/ruby/json/commit/f44995cfb6
2024-10-26[ruby/strscan] [JRuby] Optimize `scan()`: Remove duplicate `ifNAITOH Jun
(restLen() < patternsize()) return context.nil;` checks in `!headonly`. (https://github.com/ruby/strscan/pull/110) - before: #109 ## Why? https://github.com/ruby/strscan/blob/d31274f41b7c1e28f23d58cf7bfea03baa818cb7/ext/jruby/org/jruby/ext/strscan/RubyStringScanner.java#L371-L373 This means the following : `if (str.size() - curr < pattern.size()) return context.nil;` A similar check is made within `StringSupport#index()` within `!headonly`. https://github.com/jruby/jruby/blob/be7815ec02356a58891c8727bb448f0c6a826d96/core/src/main/java/org/jruby/util/StringSupport.java#L1706-L1720 ```Java public static int index(ByteList source, ByteList other, int offset, Encoding enc) { int sourceLen = source.realSize(); int sourceBegin = source.begin(); int otherLen = other.realSize(); if (otherLen == 0) return offset; if (sourceLen - offset < otherLen) return -1; ``` - source = `strBL` - other = `patternBL` - offset = `strBeg + curr` This means the following : `if (strBL.realSize() - (strBeg + curr) < patternBL.realSize()) return -1;` Both checks are the same. ## Benchmark It shows String as a pattern is 2.40x faster than Regexp as a pattern. ``` $ benchmark-driver benchmark/check_until.yaml Warming up -------------------------------------- regexp 7.613M i/s - 7.593M times in 0.997350s (131.35ns/i) regexp_var 7.793M i/s - 7.772M times in 0.997364s (128.32ns/i) string 13.222M i/s - 13.199M times in 0.998297s (75.63ns/i) string_var 15.283M i/s - 15.216M times in 0.995667s (65.43ns/i) Calculating ------------------------------------- regexp 10.003M i/s - 22.840M times in 2.283361s (99.97ns/i) regexp_var 9.991M i/s - 23.378M times in 2.340019s (100.09ns/i) string 23.454M i/s - 39.666M times in 1.691221s (42.64ns/i) string_var 23.998M i/s - 45.848M times in 1.910447s (41.67ns/i) Comparison: string_var: 23998466.3 i/s string: 23453777.5 i/s - 1.02x slower regexp: 10002809.4 i/s - 2.40x slower regexp_var: 9990580.1 i/s - 2.40x slower ``` https://github.com/ruby/strscan/commit/843e931d13
2024-10-26[ruby/fiddle] Fix Fiddle::Handle.new for a missing library in theBenoit Daloze
FFI backend (https://github.com/ruby/fiddle/pull/156) * From https://github.com/ruby/reline/issues/766#issuecomment-2422135968 https://github.com/ruby/fiddle/commit/eea9fd0cc4
2024-10-25[ruby/reline] Add completion_append_character testtomoya ishida
(https://github.com/ruby/reline/pull/773) https://github.com/ruby/reline/commit/5f5a0aa78c
2024-10-24[ruby/reline] nonprinting_start and nonprinting_end should betomoya ishida
removed (https://github.com/ruby/reline/pull/771) https://github.com/ruby/reline/commit/e36441652a
2024-10-24append completion_append_character only when continous completion is … (#764)Wu
* append completion_append_character only when continous completion is not possible * refactoring * remove debug puts
2024-10-24[rubygems/rubygems] [SpecFetcher tests] Use >3 character long fake gem name.Ellen Marie Dash
https://github.com/rubygems/rubygems/commit/ce06b8f0d9
2024-10-24[ruby/error_highlight] Rename the `ErrorHighlight::DefaultFormatter` setting ↵Guilherme Carreiro
to `max_snippet_width` for clarity https://github.com/ruby/error_highlight/commit/e13cbd4335
2024-10-23[rubygems/rubygems] Add another bail-early condition to ↵Ellen Marie Dash
suggest_gems_from_name(), with test. https://github.com/rubygems/rubygems/commit/7bb7c0ac2d
2024-10-23[ruby/error_highlight] Adjust truncation, add opt-out mechanism, rename ↵Guilherme Carreiro
methods, and prepare error highlighting to render on extremely small screens https://github.com/ruby/error_highlight/commit/c565340958
2024-10-23[ruby/error_highlight] Handle very long lines with errors in the middle of ↵Guilherme Carreiro
the line https://github.com/ruby/error_highlight/commit/0657bc1afa
2024-10-23[ruby/error_highlight] Handle very long linesGuilherme Carreiro
https://github.com/ruby/error_highlight/commit/383490a4b4
2024-10-22[ruby/reline] Use IO's encoding instead of Encoding.default_externalWu
(https://github.com/ruby/reline/pull/765) * use IO's encoding * refactoring * remove unused encoding params * (for retriggering CI) remove unused encoding params https://github.com/ruby/reline/commit/f09772adab
2024-10-21Show where mutated chilled strings were allocatedÉtienne Barrié
[Feature #20205] The warning now suggests running with --debug-frozen-string-literal: ``` test.rb:3: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information) ``` When using --debug-frozen-string-literal, the location where the string was created is shown: ``` test.rb:3: warning: literal string will be frozen in the future test.rb:1: info: the string was created here ``` When resurrecting strings and debug mode is not enabled, the overhead is a simple FL_TEST_RAW. When mutating chilled strings and deprecation warnings are not enabled, the overhead is a simple warning category enabled check. Co-authored-by: Jean Boussier <byroot@ruby-lang.org> Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Jean Boussier <byroot@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/11893
2024-10-20[ruby/irb] Improve history test's encoding settingGo
(https://github.com/ruby/irb/pull/1022) * improve history test's encoding setting * fix missing locale error for ci and refactoring https://github.com/ruby/irb/commit/7f385bc19b
2024-10-18[ruby/ipaddr] Added to_json/as_json methodTaketo Takashima
Updated to use cidr method when return address with prefix in #as_json https://github.com/ruby/ipaddr/commit/cf8181d53e
2024-10-18[ruby/fiddle] test: Fix a typokojix2
(https://github.com/ruby/fiddle/pull/154) https://github.com/ruby/fiddle/commit/1f818e4684
2024-10-18Relax Pure::Parser's comment regex...Stephen Humphries
...to allow any character sequence, including "/*", before then end sequence of a multi-line ANSI C-style comment .
2024-10-18[ruby/json] Assume Encoding is definedJean Boussier
https://github.com/ruby/json/commit/8713aa4812
2024-10-18[ruby/json] Always dup argument to preserve original encoding for force_encodingTakumasa Ochi
https://github.com/ruby/json/commit/db9a489ca2
2024-10-18[ruby/json] Fix behavior of trying to parse non-string objectsYuheiNakasaka
https://github.com/ruby/json/commit/e2e9936047
2024-10-17[ruby/rdoc] feature: Render mixed-in methods and constants withMike Dalessio
`--embed-mixins` (https://github.com/ruby/rdoc/pull/842) * Embed mixed-in methods and constants with `--embed-mixins` When `--embed-mixins` option is set: - methods from an `extend`ed module are documented as singleton methods - attrs from an `extend`ed module are documented as class attributes - methods from an `include`ed module are documented as instance methods - attrs from an `include`ed module are documented as instance attributes - constants from an `include`ed module are documented Sections are created when needed, and Darkfish's template annotates each of these mixed-in CodeObjects. We also respect the mixin methods' visibility. This feature is inspired by Yard's option of the same name. * Add comment to document why we set object visibility Co-authored-by: Stan Lo <stan001212@gmail.com> * Add the mixin_from attribute to CodeObject's initializer * Add test coverage for private mixed-in attributes. --------- https://github.com/ruby/rdoc/commit/481c2ce660 Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-10-17[ruby/etc] Fix sysconfdir when load-relativeNobuyoshi Nakada
When relative load paths option is enabled, the prefix is determined at the runtime. The only way to get it outside libruby is to use rbconfig.rb. https://github.com/ruby/etc/commit/e5b498fad9