Граф коммитов

23 Коммитов

Автор SHA1 Сообщение Дата
k0kubun 89c7e6de44 irb/test_init.rb: add test to ensure $0
is not changed.

At first `ARGV.unshift('something')` was suggested for r61149,
but it wasn't sufficient because it modifies $0.

Not only to preserve ARGV, but also r61149 intends to preserve $0.
This test prevents future breakage of the behavior.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 13:56:48 +00:00
k0kubun da1ba13714 irb.rb: preserve ARGV on binding.irb
This is not perfectly good solution (at least we don't want to have ARGV
as default value of `argv` argument), but unfortunately IRB.setup and
IRB.parse_opts are public methods and we can't make breaking change to
those methods.

We may deprecate using them and then make them private in the future,
but the removal should not be in Ruby 2.5. So I kept their interface for
now.

[Bug #14162] [close GH-1770]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 11:25:16 +00:00
k0kubun 96d576733a test_workspace.rb: prefer using skip
rather than ignoring test definition to know untestability when
executing test with `-v`.

Also this simplifies check using `MiniTest::Unit::Guard#windows?`.

This change is suggested by @MSP-Greg here:
7128849c8c (commitcomment-25836745)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-29 11:27:32 +00:00
k0kubun 7128849c8c test_workspace.rb: skip test failing on windows
> Note that all files are always readable
> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/chmod-wchmod
It seems that we can't make a file unreadable with `File.chmod` on
Windows.

When file can't be read, File::EACCES is raised on Windows too. So
r60900 should work anyway, but I don't know how to let it happen by
Ruby code. I tried to open file before reading it, but I couldn't
reproduce File::EACCES too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-24 12:37:07 +00:00
kazu 6d14c47c20 Fix TOCTTOU and avoid to read existing unreadable file
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-24 11:00:10 +00:00
kazu dff3d5dc69 Fix typos [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-24 11:00:08 +00:00
nobu 9560d2e0fb test/irb/test_workspace.rb: fix SCRIPT_LINES__
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-24 05:46:55 +00:00
k0kubun 106c9883e1 irb.rb: show source around binding.irb on start
[Feature #14124] [ruby-dev:50319] [close GH-1764]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-24 03:53:27 +00:00
nobu f14f0d3464 ruby-lex.rb: fix continued line conditions
* lib/irb/ruby-lex.rb (RubyLex#lex): fix conditions for continued
  line; empty lines, a semicolon, first line in `begin` block,
  just after `else` are not continued.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-20 11:07:02 +00:00
nobu 9b0118a84c refine assertions
* test/irb/test_ruby-lex.rb (test_prompt): invert confinue flag by
  FIXME comments.  adjust line numbers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-30 04:47:44 +00:00
nobu d617fce9ab more checks for prompt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-30 03:57:46 +00:00
nobu 5a48f20c33 test for prompt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-30 03:21:15 +00:00
nobu 62acbb9805 test for immature statement
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-29 12:53:24 +00:00
nobu 1997f7807b test for top level statement
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-29 12:53:23 +00:00
nobu 3abb4948b2 test for comment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-29 12:20:26 +00:00
nobu 25ad4a7907 tests for irb lexer
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-29 09:51:55 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
akr fb2008a73a * test/lib/envutil.rb: Moved from test/ruby/.
* test/lib/find_executable.rb: Ditto.

* test/lib/memory_status.rb: Ditto.

* test/lib/test/unit.rb: require envutil.

* test/: Don't require envutil in test files.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13 16:05:37 +00:00
hsbt f741fd2d9d * lib/irb.rb: Prevent irb from crashing when exception with
nil backtrace is raised.
  [fix GH-434][ruby-core:58078][Bug #9063]
* test/irb/test_raise_no_backtrace_exception.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-13 02:19:48 +00:00
usa 5625355c9b * test/irb/test_completion.rb: skip if cannot load irb/completion
(maybe readline does not exist).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-30 01:39:52 +00:00
nobu ef72bdf2de * lib/irb/completion.rb (IRB::InputCompletor::CompletionProc):
ignore non-string name modules.  [ruby-core:42244][Bug #5938]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-27 20:53:37 +00:00
nobu fc2748e71e * test/irb/test_option.rb (test_end_of_option): don't read .irbrc. Bug#4138
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-08 22:00:59 +00:00
nobu 504e6b4dac * lib/irb/init.rb (IRB.parse_opts): fix typo. [ruby-core:33574]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-05 03:09:34 +00:00