Commit graph

16449 commits

Author SHA1 Message Date
Nobuyoshi Nakada
09e7a0c4a4
Dispose the global rubygems configuration wholely 2021-06-23 18:56:10 +09:00
Nobuyoshi Nakada
ddb8739634
Clear rdoc options in the global rubygems configuration 2021-06-23 18:46:53 +09:00
Nobuyoshi Nakada
69ce9e4187
Clear default configurations
Remove environment variables which can affect the default
configurations.
2021-06-23 15:14:21 +09:00
Nobuyoshi Nakada
950c7a12ef
Make temporary directory under the regular location 2021-06-23 14:17:43 +09:00
Nobuyoshi Nakada
923b365224
Close UserInteraction for tests to fix leaked file descriptors 2021-06-23 12:52:32 +09:00
Hiroshi SHIBATA
6aaa1c4d09 [ruby/rdoc] Use pend instead of skip
8460a36d84
2021-06-23 11:05:18 +09:00
Hiroshi SHIBATA
f2e39e5fed [ruby/rdoc] Update test/rdoc/test_rdoc_rubygems_hook.rb
fb264c4cc4

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-06-23 11:05:14 +09:00
Hiroshi SHIBATA
c483aa8394 [ruby/rdoc] Rwrite test-case for rubygems_hook without Gem::TestCase
f8d1087ce5
2021-06-23 11:05:11 +09:00
Nobuyoshi Nakada
3b615f4353
Strip trailing spaces 2021-06-23 10:08:51 +09:00
Keiko Kaneko
de779f4a62 [ruby/irb] Sort ls result ordered by anscestry
fdd5c0a71e
2021-06-22 22:32:42 +09:00
Samuel Williams
fcc6fd23ec Rework sysread to use blocking read_internal_locktmp. 2021-06-22 22:48:57 +12:00
Yusuke Endoh
ff609eee98 Avoid a duplicated method definition of Object#stub
20210622T063005Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20210622T063005Z/ruby/test/rubygems/helper.rb:1565: warning: method redefined; discarding old stub
/home/chkbuild/chkbuild/tmp/build/20210622T063005Z/ruby/test/resolv/test_dns.rb:8: warning: previous definition of stub was here
```
2021-06-22 16:36:36 +09:00
aycabta
8509532c78 Fix finish_using_lib_reline 2021-06-21 23:13:04 +09:00
aycabta
06d52249de Call super method by teardown of tests of Reline as Readline 2021-06-21 22:29:04 +09:00
aycabta
215fd1bf2c Call Reline-specific method in helper file 2021-06-21 22:26:11 +09:00
aycabta
046fd3ac8c Rescue conversion error of inputrc 2021-06-21 22:12:14 +09:00
aycabta
574c8ee9f1 Call Reline.test_reset in teardown of tests for readline definitely 2021-06-21 22:12:14 +09:00
aycabta
e11800e114 Use test encoding for TestRelineAsReadline and TestRelineAsReadlineHistory 2021-06-21 22:12:14 +09:00
aycabta
1192393b3e Stop using global constant, RELINE_TEST_ENCODING 2021-06-21 22:12:14 +09:00
aycabta
af19f9a6e9 Call Reline.test_reset in teardown definitely 2021-06-21 22:12:14 +09:00
aycabta
9498ea9385 Revert "Use Encoding.default_external for tests of Readline::HISTORY"
This reverts commit 089a26b0a6.
2021-06-21 22:12:14 +09:00
aycabta
089a26b0a6 Use Encoding.default_external for tests of Readline::HISTORY 2021-06-21 19:31:14 +09:00
aycabta
cf6f686d29 [ruby/reline] Remove an obsolete commented-out test
5354d02e03
2021-06-21 17:58:49 +09:00
aycabta
cf186bfe14 [ruby/reline] Add yamatanooroti test about set and exchange mark
2e6fdca5c6
2021-06-21 17:58:49 +09:00
aycabta
882c0d5015 [ruby/reline] Reset config for random test
c39615e1dd
2021-06-21 17:58:49 +09:00
aycabta
1b543dc226 [ruby/reline] Handle Errno::ENOTTY correctly
8daa392ba6
2021-06-21 17:58:48 +09:00
aycabta
754bfc66f8 [ruby/reline] Add a test for pasting Cyrillic chars into command prompt on cp 850
This closes https://github.com/ruby/reline/issues/103.

213e0523d5
2021-06-21 17:58:48 +09:00
aycabta
b0cc46b484 [ruby/reline] The config file must accept any character encoding
In Japan, so many programmers used EUC-JP to write text files that contain
Japanese. Many .inputrc files which contain EUC-JP are still being copied and
used. This commit supports the whole encoding of what user set including UTF-8.

ref. https://github.com/ruby/reline/pull/280

0b45022e16
2021-06-21 17:58:48 +09:00
aycabta
c59bbd86a6 [ruby/reline] Use ReadConsoleInputW() instead of getwch()
This needs https://github.com/aycabta/yamatanooroti/pull/19, which is released
by yamatanooroti gem 0.0.7, to test with yamatanooroti.

06c1f45da1
2021-06-21 17:58:48 +09:00
Mark Delk
a049dfd10a [ruby/reline] ensure reline's encoding is used when reading inputrc character values
This change ensures we use `Reline::IOGate`'s `encoding` when converting
characters from their integer values.

This fixes an issue that may occur if you have UTF characters in your
`.inputrc`, but your default encoding isn't set.

For example:

```
> 127864.ord.chr
RangeError: 127864 out of char range
from (pry):1:in `chr'
> Reline::IOGate.encoding
=> #<Encoding:UTF-8>
> 127864.ord.chr(Reline::IOGate.encoding)
=> "🍸"
```

cf372fc0fc
2021-06-21 17:58:48 +09:00
Yusuke Endoh
acae5f363d ast.rb: RubyVM::AST.parse and .of accepts save_script_lines: true
This option makes the parser keep the original source as an array of
the original code lines. This feature exploits the mechanism of
`SCRIPT_LINES__` but records only the specified code that is passed to
RubyVM::AST.of or .parse, instead of recording all parsed program texts.
2021-06-18 02:34:27 +09:00
Nobuyoshi Nakada
95ef545997 [rubygems/rubygems] Close then unlink tempfiles on Windows
In ruby/ruby test actions, number of "leaked tempfile" messages
are shown on Windows.

As Windows disallows removing open files, `Tempfile#unlink` fails
silently before `#close`.
Close then unlink by `#close!` instead.

fe0b88ac30
2021-06-17 12:28:15 +09:00
Nobuyoshi Nakada
d09f097eec
Time#getlocal tests for [Feature #17544] 2021-06-15 21:42:55 +09:00
Eileen M. Uchitelle
2088a45798
[Bug #17880] Set leaf false on opt_setinlinecache (#4565)
This change fixes the bug described in https://bugs.ruby-lang.org/issues/17880.

Checking `ractor_shareable_p` will cause the method to call back into
Ruby. Anything calling this method can't be a leaf instruction,
otherwise it could crash. By adding `attr bool leaf = false` we no
longer crash because it marks the function as not a leaf.

Here's a simplified reproduction script:

```ruby
require "set"

class Id
  attr_reader :db_id
  def initialize(db_id)
    @db_id = db_id
  end

  def ==(other)
    other.class == self.class && other.db_id == db_id
  end
  alias_method :eql?, :==

  def hash
    10
  end

  def <=>(other)
    db_id <=> other.db_id if other.is_a?(self.class)
  end
end

class Namespace
  IDS = Set[
    Id.new(1).freeze,
    Id.new(2).freeze,
    Id.new(3).freeze,
    Id.new(4).freeze,
  ].freeze

  class << self
    def test?(id)
      IDS.include?(id)
    end
  end
end

p Namespace.test?(Id.new(1))
p Namespace.test?(Id.new(5))
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-06-14 17:34:57 -07:00
Marc-Andre Lafortune
a09ddfc420 [lib/ostruct] Fix YAML test 2021-06-14 12:28:53 -04:00
Marc-Andre Lafortune
52369fc545 [lib/ostruct] Allow overriding of block_given? 2021-06-14 12:28:53 -04:00
Nobuyoshi Nakada
edbe0e224c
Suppress exception report in inner thread 2021-06-15 00:03:05 +09:00
Nobuyoshi Nakada
57eaa07ba6
Close leaked file descriptors 2021-06-15 00:02:15 +09:00
jfrazx
931ea7cfbe
Add fallback block to OpenStruct#delete_field (#1409) 2021-06-14 09:53:20 -04:00
Bruno Sutic
1ab71a5b98 Fix fiber scheduler address resolve solaris tests 2021-06-14 22:09:23 +12:00
Samuel Williams
050a895439
Wake up join list within thread EC context. (#4471)
* Wake up join list within thread EC context.

* Consume items from join list so that they are not re-executed.

If `rb_fiber_scheduler_unblock` raises an exception, it can result in a
segfault if `rb_threadptr_join_list_wakeup` is not within a valid EC. This
change moves `rb_threadptr_join_list_wakeup` into the thread's top level EC
which initially caused an infinite loop because on exception will retry. We
explicitly remove items from the thread's join list to avoid this situation.

* Verify the required scheduler interface.

* Test several scheduler hooks methods with broken `unblock` implementation.
2021-06-14 17:56:53 +12:00
Samuel Williams
2792acc8f2
Add scheduler hook Addrinfo.getaddrinfo. (#4375)
Co-authored-by: Bruno Sutic <code@brunosutic.com>
2021-06-14 16:21:08 +12:00
Jeremy Evans
117310bdc0
Make ENV.clone warn and ENV.dup raise
ENV.dup returned a plain Object, since all of ENV's behavior is
defined in ENV's singleton class.  So using dup makes no sense.

ENV.clone works and is used in some gems, but it doesn't do what
the user expects, since modifying ENV.clone also modifies ENV.
Add a deprecation warning pointing the user to use ENV.to_h
instead.

This also undefines some private initialize* methods in ENV,
since they are not needed.

Fixes [Bug #17767]
2021-06-08 10:19:08 -07:00
Yusuke Endoh
8c87efaa8a [ruby/psych] Fix the test that does not work with libyaml-0.1.7
542cf9754f
2021-06-08 08:12:27 +09:00
Hiroshi SHIBATA
bb4a10208c
Do not use YAML module in tests of Psych 2021-06-07 19:24:20 +09:00
Hiroshi SHIBATA
d7146dfd7d
Use assert_raise instead of assert_raises 2021-06-07 19:21:41 +09:00
Jean Boussier
fd6225c7a9
[ruby/psych] Implement YAML.safe_dump to make safe_load more usable.
In case where Psych is used as a two way serializers,
e.g. to serialize some cache or config, it is preferable
to have the same restrictions on both load and dump.

Otherwise you might dump and persist some objects payloads
that you later won't be able to read.

441958396f
2021-06-07 19:15:14 +09:00
Nobuyoshi Nakada
9f3888d6a3 Warn more duplicate literal hash keys
Following non-special_const literals:
* T_REGEXP
2021-06-03 15:11:18 +09:00
Nobuyoshi Nakada
37eb5e7439 Warn more duplicate literal hash keys
Following non-special_const literals:
* T_BIGNUM
* T_FLOAT (non-flonum)
* T_RATIONAL
* T_COMPLEX
2021-06-03 15:11:18 +09:00
Nobuyoshi Nakada
a023db49bf Assertions for duplicate literal hash key warnings 2021-06-03 15:11:18 +09:00