Commit graph

15017 commits

Author SHA1 Message Date
Hiroshi SHIBATA
8f752c95d2
[ruby/fiddle] Use test-unit gem (https://github.com/ruby/fiddle/pull/69)
e08c4c635e

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2021-09-05 17:43:48 +09:00
aycabta
ff372ed74b [ruby/irb] Suppress "assigned but unused variable" warning
a1ddf64c69
2021-09-04 17:48:31 +09:00
aycabta
9ac32e87bb [ruby/irb] Add an assertion to check completion "var.method" to get correct "class.method"
cc1ddb37a9
2021-09-04 17:48:26 +09:00
aycabta
6fa37d2666 [ruby/irb] Retrieve completed receiver that is a module or class correctly
b2324727e1
2021-09-04 17:48:20 +09:00
aycabta
f6bc4b9b97 [ruby/irb] Use autocomplete with show doc dialog that uses Reline::Key in tests
142fc53e9c
2021-09-04 02:32:04 +09:00
Nobuyoshi Nakada
76c7388c1f [ruby/rdoc] Add tests for --template-stylesheets option
Also flattens `@options.template_stylesheets` when parsing the
command lines.

Fixes #205
Fixes #828 too

857002a763
2021-09-03 19:13:15 +09:00
Vít Ondruch
33676a7aa6 [ruby/rdoc] Try to load WEBrick for testing
This is in similar vein Rake is optionally loaded in:

5437418baf/test/rdoc/test_rdoc_task.rb (L3-L6)

5f3901ae60
2021-09-03 19:12:24 +09:00
Hiroshi SHIBATA
b809e5a4a9 [ruby/rdoc] s/minitest/test-unit/g
73c030c7b0
2021-09-03 19:10:34 +09:00
Hiroshi SHIBATA
0a9a3799bb [ruby/rdoc] Removed duplicated doc
0dd36a5c35
2021-09-03 19:10:28 +09:00
aycabta
5458f23de2 [ruby/irb] Add TODO comment to remove disabling autocomplete later
856f001b60
2021-09-03 04:28:45 +09:00
aycabta
864b40176d [ruby/irb] Disable autocomplete in yamatanooroti test
cb9c9c64df
2021-09-03 04:28:38 +09:00
aycabta
b4efa37d98 [ruby/readline-ext] Omit Editline on without tty test
a2835ce957
2021-09-03 03:34:09 +09:00
Peter Zhu
682f58a933 Fix typo in test name 2021-09-02 09:57:02 -04:00
aycabta
4e40b7ddb0 [ruby/irb] Detect the variable class to show doc
33b9bec954
2021-09-02 21:39:55 +09:00
aycabta
4852d87a81 [ruby/reline] Fix a crash when completing empty line
8226ae7e57
2021-09-02 14:07:48 +09:00
aycabta
5f23003cc2 [ruby/reline] Fix a crash when completing after 2nd line
f9d3480c34
2021-09-02 14:07:40 +09:00
Nobuyoshi Nakada
ab63f6d854
Refined test [Bug #18140] 2021-09-02 09:11:41 +09:00
Aaron Patterson
8db269edb3
Guard array when appending
This prevents early collection of the array.  The GC doesn't see the
array on the stack when Ruby is compiled with optimizations enabled

Thanks @jhaberman for the test case

[ruby-core:105099] [Bug #18140]
2021-09-01 10:58:20 -07:00
Nobuyoshi Nakada
3c85698da2
Stop stale tests [Bug #9718] 2021-09-02 01:39:01 +09:00
Nobuyoshi Nakada
0729052329
Test against the target class 2021-09-02 01:33:30 +09:00
Aaron Patterson
cd4f5b1322
Guard array when appending
This prevents early collection of the array.  The GC doesn't see the
array on the stack when Ruby is compiled with optimizations enabled

[ruby-core:105099] [Bug #18140]
2021-09-02 01:22:19 +09:00
aycabta
cf2faf2e33 [ruby/rdoc] Move RDoc::RDoc#load_options to RDoc::RDoc.load_options
ac85e01756
2021-09-02 00:32:13 +09:00
aycabta
67eaa222cf Add a test for Readline.readline without tty 2021-09-01 17:29:01 +09:00
aycabta
a75f38431e Revert "Omit some tests until debugging is complete"
This reverts commit 3695d94b25.
2021-08-31 20:35:04 +09:00
jory-graham
db154b20cc [ruby/psych] Replace A-Za-z with [:alpha:]
8ec36494fb
2021-08-31 19:34:54 +09:00
Aaron Patterson
9ed2cb26de [ruby/psych] Add quotes to the strings "y" and "n"
'y' and 'n' are kind of ambiguous.  Syck treated y and n literals in
YAML documents as strings.  But this is not what the YAML 1.1 spec says.
YAML 1.1 says they should be treated as booleans.  When we're dumping
documents, we know it's a string, so adding quotes will eliminate the
"ambiguity" in the emitted document

Fixes #443

6a1c30634e
2021-08-31 19:34:46 +09:00
Alexandr Opak
44353d0dee [ruby/psych] add more tests
8f71222bf3
2021-08-31 19:34:28 +09:00
Alexandr Opak
beffa72c27 [ruby/psych] fix typo
ebb0cbded1
2021-08-31 19:34:21 +09:00
Alexandr Opak
48b50cb4fe [ruby/psych] fix parsing integer values with '_' at the end
e0bb853014
2021-08-31 19:34:13 +09:00
Tomer Brisker
31ba0921f8 [ruby/psych] Improve float scalar scanner
Previously, `+.inf` was not handled correctly. Additionally, the regexp
was checking for inf and NaN, even though these cases are handled earlier
in the condition. Added a few tests to ensure handling some missing
cases.

6e0e7a1e9f
2021-08-31 19:34:06 +09:00
David Rodríguez
1e290c31f4 [rubygems/rubygems] Merge Gem::UriParser and Gem::PrintableUri into a Gem::Uri class
The new class is a wrapper on top of an URI. And then, when you want
credentials redacted, you call `#redacted` that returns a copy of itself,
but with credentials redacted.

9581c2740a
2021-08-31 19:06:14 +09:00
Daniel Niknam
ceba866864 [rubygems/rubygems] Remove unnecessary tests
We will be passing string to this class so there is no need to be defensive about it.

30bd52a977
2021-08-31 19:06:14 +09:00
Daniel Niknam
aa898b4206 [rubygems/rubygems] Remove @credential_redacted instance variable
c3bb52eb5c
2021-08-31 19:06:14 +09:00
Daniel Niknam
589377fbdc [rubygems/rubygems] Refactor Gem::RemoteFetcher::FetchError.build back to its initialize method
21dcdd2dc5
2021-08-31 19:06:14 +09:00
Daniel Niknam
a508693f06 [rubygems/rubygems] Remove defensive guards
dba130cd80
2021-08-31 19:06:14 +09:00
Daniel Niknam
fafd9d280a [rubygems/rubygems] Rename Gem::PrintableUri#parsed_uri? to Gem::PrintableUri#valid_uri?
a5177709c9
2021-08-31 19:06:14 +09:00
Daniel Niknam
3adc141a79 [rubygems/rubygems] Refactor Gem::RemoteFetcher::FetchError initializer to build method
The `initialize` method is already doing a lot and by adding the `Gem::PrintableUri` to redact sensitive information, things are getting complicated and hard to read here. For the start, I have refactored the `initialize` method into a class method called `build`.

4312e8fdf5
2021-08-31 19:06:14 +09:00
Daniel Niknam
19e1d3cdce [rubygems/rubygems] Using Gem::PrintableUri in Gem::Request class
The `@uri` variable could be a source URI with a credential. Using `Gem::PrintableUri` to make sure we are redacting sensitive information from it when logging on verbose mode.

f566787211
2021-08-31 19:06:14 +09:00
Daniel Niknam
31c2e6c08e [rubygems/rubygems] Using Gem::PrintableUri in Gem::Commands::InstallCommand class
The `x.source.uri` could be a source URI with a credential. Using `Gem::PrintableUri` to make sure we are redacting sensitive information from it.

8755ee0aaa
2021-08-31 19:06:14 +09:00
Daniel Niknam
b41802421a [rubygems/rubygems] Introduce Gem::PrintableUri that would redact URIs to be used on outputs
We need to redact URI credential in several places and copy pasting the code into each part of it is not ideal. This class is responsible for parsing URI strings and redacting credential from it. Also, it will handle URI object in the same manner. We will be reusing this class whenever we need to print/display a URI to users.
URI with the following format will be redacted:
- Token: `http://my-secure-token@example.com` => `http://REDACTED@example.com`
- Username & Password: `http://my-username:my-secure-password@example.com` => `http://my-username:REDACTED@example.com`
- x-oauth-basic: `http://my-secure-token:x-oauth-basic@example.com` => `http://REDACTED:x-oauth-basic@example.com`

f1e45d3a89
2021-08-31 19:06:14 +09:00
Daniel Niknam
14a9e24f7e [rubygems/rubygems] Add a few tests for Gem::UriParser.parse_uri
1ea73df161
2021-08-31 19:06:14 +09:00
Daniel Niknam
c71d1a26ef [rubygems/rubygems] Pick the last founded gems when fetching metadata
e3d150d822

Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
2021-08-31 19:06:14 +09:00
David Rodríguez
907fa88a76 [rubygems/rubygems] Remove unused file
No longer used since
b7f6270b9e.

76803894a0
2021-08-31 19:06:14 +09:00
David Rodríguez
590d2222a0 [rubygems/rubygems] Remove helper method not buying us much
81dc685d20
2021-08-31 19:06:14 +09:00
David Rodríguez
d01c3111c2 [rubygems/rubygems] Remove MacOS specific extra GEM_PATH
They should properly configure `GEM_PATH` instead.

3bd9ae33ca
2021-08-31 19:06:14 +09:00
Daniel Niknam
717ad64f41 [rubygems/rubygems] Replace StandardError with Exception
We think it's unlikely that `rubygems/defaults/operating_system` could be shipped with a SyntaxError so StandardError could be better choice to prevent "false positives" errors.

1f73e784dd
2021-08-31 19:06:14 +09:00
Daniel Niknam
34e073c0ca [rubygems/rubygems] Reword the message
For errors that could happened while loading `rubygems/defaults/operating_system`

6e1e2141f8
2021-08-31 19:06:14 +09:00
Daniel Niknam
744e128ed9 [rubygems/rubygems] Exclude truffleruby from the test for failure of operating_system.rb
truffleruby does not raise any error when requiring `rubygems`.

21e2fcd0b2
2021-08-31 19:06:14 +09:00
Daniel Niknam
aafc615b4a [rubygems/rubygems] Enhance error handling when loading the rubygems/defaults/operating_system file
When loading `rubygems/defaults/operating_system`
- we want to keep it silent if the raised exception is a LoadError
- we want to print a message in other cases and ask users to report the issue to their OS support.

Ruby 3 comes with special error handling for loading `rubygems` and it will show a warning when LoadError exception raised for requiring 'rubygem'.
Because of that, we decided to leave the LoadError scenario as it is.
Reference: d1998d8767/gem_prelude.rb (L1-L5)

0a97e12fe1
2021-08-31 19:06:14 +09:00
David Rodríguez
9fa5c4cd07 [rubygems/rubygems] Also load user installed rubygems plugins
82960c262f
2021-08-31 19:06:14 +09:00