1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/irb
Jeremy Evans b07db96744 [ruby/irb] Support --noscript option to not use first non-option argument as script
Also add --script option to turn the option back on.

Previously there wasn't a way to get an interactive IRB session
and access arguments provided on the command line.

Additionally, handle `-` as script as stdin. In Unix-like tools, `-`
means to take standard input instead of a file.  This doesn't
result in exactly the same output for:

```
echo 'p ARGV' > args.rb; irb args.rb a b c
```

and

```
echo 'p ARGV' | irb - a b c
```

Due to how irb handles whether stdin is a tty.

However, this change allows use of `-` as a argument, instead of
giving an unrecognized switch error. This required some small
changes to context.rb (to handle `-` as standard input) and
input-method.rb (to have FileInputMethod accept IO arguments in
addition to strings).

Implements [Feature #15371]

https://github.com/ruby/irb/commit/4192683ba2
2022-09-17 02:25:26 +09:00
..
yamatanooroti [ruby/irb] Add tests for truncated show doc dialog 2021-10-08 10:34:20 +09:00
test_cmd.rb [ruby/irb] Remove unnecessary space in regexp 2021-12-20 16:19:37 +09:00
test_color.rb
test_color_printer.rb
test_completion.rb [ruby/irb] Ignore parenthesis during completion 2021-10-13 06:33:48 +09:00
test_context.rb [ruby/irb] Properly reset USE_COLORIZE after changing it in tests 2022-06-29 00:23:18 +09:00
test_history.rb [ruby/irb] Refine assertion for failures 2022-09-15 08:25:53 +09:00
test_init.rb [ruby/irb] Support --noscript option to not use first non-option argument as script 2022-09-17 02:25:26 +09:00
test_option.rb
test_raise_no_backtrace_exception.rb
test_ruby_lex.rb [ruby/irb] Examine indentation of in keyword when trying to type include 2021-12-03 00:56:43 +09:00
test_workspace.rb [ruby/irb] Tests may not execute in the source directory 2021-09-10 08:34:51 +09:00