Commit graph

15017 commits

Author SHA1 Message Date
Alan Wu
3dd3ea092a Use Module#ancestors order in recursive constant lookup
Before this commit, const_get with inherit=true and constant lookup
expressions searched the ancestors of the starting point in an order
different from `starting_point.ancestors`.

Items in the ancestry list introduced through prepend were searched
after searching the module they were prepended into. This oddity allowed
for situations where constant lookups gave different results even though
`starting_point.ancestors` is the same.

Do the lookup in the same order as `starting_point.ancestors` by
skipping classes and modules that have an origin iclass. The origin
iclass is in the super chain after the prepended modules.

Note that just like before this commit, the starting point of the
constant lookup is always the first item that we search, regardless of
the presence of any prepended modules.

[Bug #17887]
2021-06-30 10:49:27 +09:00
Yusuke Endoh
9438c99590 Rename error_squiggle to error_highlight 2021-06-29 23:45:49 +09:00
Yusuke Endoh
e946049665 [WIP] add error_squiggle gem
```
$ ./local/bin/ruby -e '1.time {}'
-e:1:in `<main>': undefined method `time' for 1:Integer (NoMethodError)

1.time {}
 ^^^^^
Did you mean?  times
```

https://bugs.ruby-lang.org/issues/17930
2021-06-29 23:45:49 +09:00
Samuel Williams
5e75280c8e Add basic test for updated IO wait functions. 2021-06-29 23:54:41 +12:00
Yusuke Endoh
39f99b8176 Use assert_not_match "Did you mean?" for UncorrectableNameCheckTest
... instead of exact matching. I'm now creating a built-in gem that
modifies Exception's error message, so the expectation value is changed.

IMO, it is good to check that did_you_mean suggestion is NOT added in
the uncorrectable case.

ebe88ec4d2
2021-06-29 15:49:51 +09:00
Nobuyoshi Nakada
9eae8cdefb
Prefer qualified names under Thread 2021-06-29 11:41:10 +09:00
Nobuyoshi Nakada
13939d61b4
Check if closed after each yield [Bug #17661] 2021-06-27 11:18:41 +09:00
Jeremy Evans
e86c1f6fc5
Work around issue transcoding issue with non-ASCII compatible encodings and xml escaping
When using a non-ASCII compatible source and destination encoding
and xml escaping (the :xml option to String#encode), the resulting
string was broken, as it used the correct non-ASCII compatible
encoding, but contained data that was ASCII-compatible instead of
compatible with the string's encoding.

Work around this issue by detecting the case where both the
source and destination encoding are non-ASCII compatible, and
transcoding the source string from the non-ASCII compatible
encoding to UTF-8. The xml escaping code will correctly handle
the UTF-8 source string and the return the correctly encoded
and escaped value.

Fixes [Bug #12052]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-06-26 12:32:39 -07:00
Nobuyoshi Nakada
391abc543c
Scan the coderange in the given encoding 2021-06-26 16:05:15 +09:00
aycabta
5ffb313ccc Revert "Revert "[ruby/reline] Fix failed test""
I'm so sorry, the previous revert was just a mistake.

This reverts commit 9103c3ba8b.
2021-06-25 18:56:46 +09:00
aycabta
9103c3ba8b Revert "[ruby/reline] Fix failed test"
This reverts commit 491591c7cee842601118efc2698e0e41283827b3.
2021-06-25 17:42:45 +09:00
ima1zumi
d340b091a8 [ruby/reline] Fix failed test
For ruby/ruby repository's AppVeyor CI (Windows environment), `Reline::IOGate.encoding` will be changed from `UTF-8` to `Windows-31J` after the test is run.
So, when `test/reline/test_key_actor_emacs.rb` is loaded, `Reline::IOGate.encoding == Encoding::UTF_8` will be `true`,
but at the time of test execution, `Reline::IOGate.encoding` is `Windows-31J`.
For this reason, I changed the test method to check `Reline::IOGate.encoding` in the test method.

10e1ce3320
2021-06-25 17:42:45 +09:00
Jean Boussier
71344a1d63 [ruby/racc] Stop compressing integer lists
It is unclear why this was implemented, I assume
it was for performance back in 2006.

However today, this compression defeats bytecode caching
entirely and end up being counter productive.

ae3703c1d0
2021-06-25 17:23:06 +09:00
Jeremy Evans
be230615d0 Remove shift of ep when computing Proc#hash
The shift was causing far fewer unique values of hash than expected.

Fix pointed out by xtkoba (Tee KOBAYASHI)

Fixes [Bug #17951]
2021-06-24 12:25:33 -07:00
Jeremy Evans
a2592702ae Actually ignore FNM_CASEFOLD flag in Dir.glob
This was already documented as being ignored, but it wasn't being
ignored, causing an issue in a particular case where a UTF-8
pattern was provided and a filename was tested that wasn't valid
UTF-8.

Fixes [Bug #14456]
2021-06-24 12:22:09 -07:00
eileencodes
31f4d26273 Check type of instruction - can be INSN or ADJUST
If the type is ADJUST we don't want to treat it like an INSN so we have
to check the type before reading from `insn_info.events`.

[Bug #18001] [ruby-core:104371]

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-06-23 11:34:37 -07:00
aycabta
557b4eb4aa Add detailed message to assert_external_string_equal 2021-06-23 21:00:48 +09:00
Nobuyoshi Nakada
298d65b1e4
Discard RDOCOPT environment variable to make tests stable 2021-06-23 18:57:39 +09:00
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