summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-11-13[rubygems/rubygems] Explicitly define `@default_specifications_dir` for testsVít Ondruch
Resetting `@default_specifications_dir` to `nil` means that the `Gem.default_specifications_dir` needs to be invoked. However, given that this method might be overridden by operating_system.rb and similar, this might lead to various test failures. Providing the default value makes the issues go away. https://github.com/rubygems/rubygems/commit/59626cb650
2023-11-13[rubygems/rubygems] Provide more insightful test error outputVít Ondruch
Original output: ~~~ Failure: test_realworld_upgraded_default_gem(TestGemRequire): <false> is not true. /mnt/test/rubygems/test_require.rb:474:in `test_realworld_upgraded_default_gem' 471: File.write(path, code) 472: 473: output = Gem::Util.popen({ "GEM_HOME" => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip => 474: assert $?.success? 475: refute_empty output 476: assert_equal "999.99.9", output.lines[0].chomp 477: # Make sure only files from the newer json gem are loaded, and no files from the default json gem ~~~ New output: ~~~ Failure: test_realworld_upgraded_default_gem(TestGemRequire) /mnt/test/rubygems/test_require.rb:475:in `test_realworld_upgraded_default_gem' 472: 473: output = Gem::Util.popen({ "GEM_HOME" => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip 474: refute_empty output => 475: assert_equal "999.99.9", output.lines[0].chomp 476: # Make sure only files from the newer json gem are loaded, and no files from the default json gem 477: assert_equal ["#{@gemhome}/gems/json-999.99.9/lib/json.rb"], output.lines.grep(%r{/gems/json-}).map(&:chomp) 478: assert $?.success? <"999.99.9"> expected but was <"/mnt/tmp/test_rubygems_20231110-36663-of405r/test_realworld_upgraded_default_gem.rb:3:in `<main>': undefined method `version' for nil:NilClass (NoMethodError)"> diff: ? 999 .99.9 ? /mnt/tmp/test_rubygems_20231110-36663-of405r/test_realworld_upgraded_default_gem rb:3:in `<main>': undefined method `version' for nil:NilClass (NoMethodError) ? ??? ???? ~~~ It is more valuable to check the command output then the error code. If the command fails for some reason, the output probably contains some detail, while checking the return code tells not much. https://github.com/rubygems/rubygems/commit/b76062e852
2023-11-13[rubygems/rubygems] Drop support for Ruby 2.6 and Ruby 2.7 in RubyGemsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/10c26a483d
2023-11-13[rubygems/rubygems] Report possible error prior checking output of gem uninstallVít Ondruch
Originally, the failed test case reported following error: ~~~ Failure: test_gem_exec_gem_uninstall(TestGemCommandsExecCommand): <""> was expected to include <"Successfully uninstalled a-2\n">. /mnt/test/rubygems/test_gem_commands_exec_command.rb:742:in `block in test_gem_exec_gem_uninstall' 739: 740: # assert_empty @ui.error 741: refute_includes @ui.output, "running gem exec with" => 742: assert_includes @ui.output, "Successfully uninstalled a-2\n" 743: 744: invoke "--verbose", "gem", "uninstall", "b" 745: assert_includes @ui.output, "Successfully uninstalled b-2\n" /mnt/lib/rubygems/user_interaction.rb:46:in `use_ui' /mnt/lib/rubygems/user_interaction.rb:69:in `use_ui' /mnt/test/rubygems/test_gem_commands_exec_command.rb:726:in `test_gem_exec_gem_uninstall' ~~~ This does not tell much. Empty string is more often good sign, but not in this case. However, checking error output first helps with understanding possible issue: ~~~ Failure: test_gem_exec_gem_uninstall(TestGemCommandsExecCommand): <"ERROR: While executing gem ... (Gem::FilePermissionError)\n" + " You don't have write permissions for the /builddir/bin directory.\n" + "\t/mnt/lib/rubygems/uninstaller.rb:213:in `remove_executables'\n" + ... snip ... /mnt/test/rubygems/test_gem_commands_exec_command.rb:740:in `block in test_gem_exec_gem_uninstall' 737: nil 738: end 739: => 740: assert_empty @ui.error 741: refute_includes @ui.output, "running gem exec with" 742: assert_includes @ui.output, "Successfully uninstalled a-2\n" 743: /mnt/lib/rubygems/user_interaction.rb:46:in `use_ui' /mnt/lib/rubygems/user_interaction.rb:69:in `use_ui' /mnt/test/rubygems/test_gem_commands_exec_command.rb:726:in `test_gem_exec_gem_uninstall' ~~~ BTW this issue is caused by operating_system.rb overriding `Gem.operating_system_defaults` method and explicitly adding `--bindir` option. https://github.com/rubygems/rubygems/commit/d98e36bbe7
2023-11-12Fix crash caused by concurrent ObjectSpace.dump_all callsKJ Tsanaktsidis
Since the callback defined in the objspace module might give up the GVL, we need to make sure the right cr->mfd value is set back after the GVL is re-obtained.
2023-11-12[ruby/prism] Reject invalid rational literals like `1e1r` on lexingTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1586 https://github.com/ruby/prism/commit/b3bde866f2
2023-11-11[ruby/prism] Introduce non-associativility to `in` and `=>`TSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1596 Fix https://github.com/ruby/prism/pull/1771 Close https://github.com/ruby/prism/pull/1773 https://github.com/ruby/prism/commit/a3413e5605
2023-11-11[Bug #19969] Compact st_table after deleted if possibleNobuyoshi Nakada
2023-11-10[ruby/prism] Remove extra locals added by ...Kevin Newton
https://github.com/ruby/prism/commit/b7850f2d30
2023-11-10[ruby/prism] Disallow forwarding in blocksKevin Newton
https://github.com/ruby/prism/commit/2bbd35943c
2023-11-10Tests of irb is still broken.Hiroshi SHIBATA
Revert "[ruby/irb] Revert "Skip TypeCompletion test in ruby ci" This reverts commit 589e2b6782f17d5a1d55021c0395d5d73224e9da.
2023-11-10[ruby/irb] Revert "Skip TypeCompletion test in ruby ciHiroshi SHIBATA
(https://github.com/ruby/irb/pull/748)" (https://github.com/ruby/irb/pull/755) This reverts commit https://github.com/ruby/irb/commit/d394af0bbce4. https://github.com/ruby/irb/commit/a9d0145115
2023-11-09[ruby/irb] Add command line option to select which completor to usetomoya ishida
(https://github.com/ruby/irb/pull/754) * Add command line option to select which completor to use * Add test for completor argv https://github.com/ruby/irb/commit/1dec2708c9
2023-11-09[PRISM] Implement compilation for ForwardingArgumentssNodeJemma Issroff
2023-11-09String#force_encoding don't clear coderange if encoding is unchangedJean Boussier
Some code out there blind calls `force_encoding` without checking what the original encoding was, which clears the coderange uselessly. If the String is big, it can be a rather costly mistake. For instance the `rack-utf8_sanitizer` gem does this on request bodies.
2023-11-09[ruby/prism] Reset do_loop_stack around a body of a endless method definitionTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1772 https://github.com/ruby/prism/commit/cdf58e845e
2023-11-09Do not allow test-all to load the bundled gemsYusuke Endoh
This change prevents default gems from inadvertently depending on bundled gems. This issue was discovered by being able to `require "rbs"` from test/irb.
2023-11-09[rubygems/rubygems] Make the `test_build_extensions` more predictableVít Ondruch
The `test_build_extensions` make assumptions about return value of `Gem.install_extension_in_lib`. Givent that RubyGems allow to override this method via `defaults.rb` / `operating_system.rb`, this test might not always pass. This change makes sure that the `Gem.install_extension_in_lib` is predictable. https://github.com/rubygems/rubygems/commit/e83d0a5da8
2023-11-09[rubygems/rubygems] Use `extension_in_lib` helper instead of custom codeVít Ondruch
`extension_in_lib` helper improves readibility and it also uses `stub` on on background instead of custom code. https://github.com/rubygems/rubygems/commit/aacc8ac22c
2023-11-08[ruby/prism] Provide Parameters#signature for mirroring Method#parametersKevin Newton
https://github.com/ruby/prism/commit/90b3245528
2023-11-08[PRISM] Add tests for OptionalKeywordParameterNodeJemma Issroff
This commit adds tests for the compilation of the OptionalKeywordParameterNode, and fixes cases on the RequiredKeywordParameterNode
2023-11-08[PRISM] Added tests for ForwardingParameterNode, KeywordRestParameterNodeJemma Issroff
2023-11-08[PRISM] Add tests for several parameters nodesJemma Issroff
This commit adds tests for BlockParameterNode, RequiredParameterNode, RequiredKeywordParameterNode and RestParameterNode
2023-11-08[ruby/tempfile] Make Tempfile#open return the underlying FileJeremy Evans
Add test for this behavior. https://github.com/ruby/tempfile/commit/0ca31a6b8d
2023-11-08YJIT: Disable code GC (#8865)Takashi Kokubun
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
2023-11-08[ruby/tempfile] Fix Tempfile#{dup,clone}Jeremy Evans
Instead of storing the delegate in @tmpfile, use __getobj__, since delegate library already handles dup/clone for that. Copy the unlinked, mode, and opts instance variables to the returned object when using dup/clone. Split the close/unlink finalizer into two finalizers. The close finalizer always closes when any Tempfile instance is GCed, since each Tempfile instance uses a separate file descriptor. The unlink finalizer unlinks only when the original and all duped/cloned Tempfiles are GCed, since all share the same path. For Tempfile#open, undefine the close finalizer after closing the current file, the redefine the close finalizer with the new file. Fixes [Bug #19441] https://github.com/ruby/tempfile/commit/dafabf9c7b
2023-11-08Improve error and memory handlingAdam Hess
Apply Nobu's suggestions which improve style, memory handling and error correction. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-11-08[ruby/irb] Skip TypeCompletion test in ruby citomoya ishida
(https://github.com/ruby/irb/pull/748) https://github.com/ruby/irb/commit/d394af0bbc
2023-11-08Prevent a warning: assigned but unused variable - raised_exceptionYusuke Endoh
2023-11-08[ruby/irb] Type based completion using Prism and RBStomoya ishida
(https://github.com/ruby/irb/pull/708) * Add completor using prism and rbs * Add TypeCompletion test * Switchable completors: RegexpCompletor and TypeCompletion::Completor * Add completion info to irb_info * Complete reserved words * Fix [*] (*) {**} and prism's change of KeywordParameterNode * Fix require, frozen_string_literal * Drop prism<=0.16.0 support * Add Completor.last_completion_error for debug report * Retrieve `self` and `Module.nesting` in more safe way * Support BasicObject * Handle lvar and ivar get exception correctly * Skip ivar reference test of non-self object in ruby < 3.2 * BaseScope to RootScope, move method objects constant under Methods * Remove unused Splat struct * Drop deeply nested array/hash type calculation from actual object. Now, calculation depth is 1 * Refactor loading rbs in test, change preload_in_thread not to cache Thread object * Use new option added in prism 0.17.1 to parse code with localvars * Add Prism version check and warn when :type completor cannot be enabled * build_type_completor should skip truffleruby (because endless method definition is not supported) https://github.com/ruby/irb/commit/1048c7ed7a
2023-11-08[ruby/stringio] Add missing row separator encoding conversionSutou Kouhei
(https://github.com/ruby/stringio/pull/69) The conversion logic is borrowed from ruby/ruby's io.c: https://github.com/ruby/ruby/blob/40391faeab608665da87a05c686c074f91a5a206/io.c#L4059-L4079 Fix ruby/stringio#68 Reported by IWAMOTO Kouichi. Thanks!!! https://github.com/ruby/stringio/commit/4b170c1a68
2023-11-08[ruby/fiddle] Use Ruby's true/false for C boolSutou Kouhei
GitHub: fix https://github.com/ruby/fiddle/pull/130 Reported by Benoit Daloze. Thanks!!! https://github.com/ruby/fiddle/commit/2640e0148e
2023-11-08CI: Change the openssl_fips.cnf.tmpl and openssl_fips.cnf directories.Jun Aruga
2023-11-08[rubygems/rubygems] Allow `--install-dir` to be specified together with ↵Vít Ondruch
`--user-install` The combination of `install-dir` and `--user-install` used to be disabled for no good reason. This even makes problem on Linux distributions such as Fedora, where `--user-install` is set by default via operating_system.rb. The `--install-dir` is already prefered over the `--user-install` by the implementation, therefore just drop the check. https://github.com/rubygems/rubygems/commit/313b1c5e76
2023-11-08[rubygems/rubygems] Don't use `util_installer` for user installVít Ondruch
It is not nice to require install directory to be always specified, while this option is later ignored for user installed gems. Actually, the next step will be to remove `check_install_dir` check and let the install dir override the user install. https://github.com/rubygems/rubygems/commit/beb79e929f
2023-11-08[rubygems/rubygems] Check for `:install_dir` precedence over `:user_install`Vít Ondruch
https://github.com/rubygems/rubygems/commit/6539da07aa
2023-11-08[rubygems/rubygems] Make the user installation less exceptionalVít Ondruch
The main purpose is to put handling of user installation into the same place as e.g. handling the --build-root option handling. There is no reason why the --build-root option should not prefix also paths used for user installation. Please note that the `util_installer` in `test_generate_plugins_with_user_install` enforced the `:install_dir`, which is against what user install is about. https://github.com/rubygems/rubygems/commit/0b10cb41aa
2023-11-08[rubygems/rubygems] Remove kludge that should be unnecessary.Ellen Marie Dash
https://github.com/rubygems/rubygems/commit/f1d44ecb62
2023-11-08[rubygems/rubygems] Allow test_gem_install_update_options to raise ↵Ellen Marie Dash
Errno::ACCES, in addition to Gem::FilePermissionError. https://github.com/rubygems/rubygems/commit/784fe2a814
2023-11-07Use embedded TypedData for Time objectsPeter Zhu
This drops the total size of a Time object from 86 bytes to 80 bytes. Running the benchmark benchmark/time_now.yml, this commit improves performance of Time.now by about 30%: ``` Time.now Branch: 13159405.4 i/s Master: 10036908.7 i/s - 1.31x slower Time.now(in: "+09:00") Branch: 2712172.6 i/s Master: 2138637.9 i/s - 1.27x slower ``` It also decreases memory usage by about 20%: ``` ary = 10_000_000.times.map { Time.now } puts `ps -o rss= -p #{$$}` ``` Branch: 961792 Master: 1196544 Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2023-11-07[PRISM] Implement compilation for different parametersJemma Issroff
This commit compiles most parameter types, setting appropriate values on the ISEQ_BODY. It also adds tests for callers and callees of methods, using many versions of tests from bootstraptest
2023-11-08String for string literal is not resizableNobuyoshi Nakada
2023-11-07[PRISM] CompileEnsureNodeMatt Valentine-House
2023-11-07[ruby/cgi] Add snake case aliases for escapeURIComponentJean Boussier
As agreed in [Feature #18822] https://github.com/ruby/cgi/commit/9d1161ec9d
2023-11-07[ruby/timeout] tests for blank secondsJohn Bachir
https://github.com/ruby/timeout/commit/54bc7639d2
2023-11-07[ruby/timeout] nested exception tests for discussionJohn Bachir
https://github.com/ruby/timeout/commit/3e42aa4d84
2023-11-06[ruby/reline] Test Reline::Face without mockingStan Lo
(https://github.com/ruby/reline/pull/600) * Test Reline::Face without mocking Because `test-unit-rr` is not a default gem, using it would break CRuby's CI. * Add ruby-core workflow https://github.com/ruby/reline/commit/d2189ac436
2023-11-06[ruby/reline] Introduce a new class Reline::Face to configureHASUMI Hitoshi
character attributes (https://github.com/ruby/reline/pull/552) * Reine::Face * fix test_yamatanooroti * Define singleton methods to make accessors to attributes of a face * s/display/foreground/ * s/default/default_style/ && s/normal_line/default/ && s/enhanced_line/enhanced/ * fix typo * FaceConfig.new now takes keyword arguments * Update lib/reline/face.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Update test/reline/test_face.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Fix to correspond to frozen_string_literal * Face::FaceConfig -> Face::Config * ref https://github.com/ruby/reline/pull/552#pullrequestreview-1677282576 * delete unused ivar * ref https://github.com/ruby/reline/pull/552#discussion_r1358783723 * insert "\e[0m" into all SGR * tiny fix * ESSENTIAL_DEFINE_NAMES ref https://github.com/ruby/reline/pull/552#discussion_r1367722247 * Change to Hash-accessor style - Reline::Face[:completion_dialog].enhanced -> Reline::Face[:completion_dialog][:enhanced] - Reline::Face.configs shows all defined values * Cache array method call in local variable * Tests for Face configuration variations * resolve https://github.com/ruby/reline/pull/552#pullrequestreview-1710938154 * amend to * check invalid SGR parameter in :style * The order of define values should be preserved * Update test/reline/test_face.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Update test/reline/test_face.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Add methods: load_initial_config and reset_to_initial_config. And teardown in tests * omission in amending "style: :default" to "style: :reset" * refs https://github.com/ruby/reline/issues/598 * Fix link * amend method name * Update lib/reline/face.rb Co-authored-by: ima1zumi <52617472+ima1zumi@users.noreply.github.com> --------- https://github.com/ruby/reline/commit/fdc1d3b1e5 Co-authored-by: Stan Lo <stan001212@gmail.com> Co-authored-by: ima1zumi <52617472+ima1zumi@users.noreply.github.com>
2023-11-06[PRISM] Implement compilation for MultiWriteNodes, fix MultiTargetNodesJemma Issroff
Compilation now works for MultiWriteNodes and MultiTargetNodes, with nesting on MultiWrites. See the tests added in this commit for example behavior.
2023-11-06generic_ivar_set: properly check for TOO_COMPLEX on capacity transitionJean Boussier