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
Ben c94025b630 [ruby/irb] Fix crashing when multiple open braces per line
https://github.com/ruby/irb/issues/55

If we had put multiple open braces on a line the with no closing brace
spaces_of_nest array keeps getting '0' added to it. This means that when
we pop off of this array we are saying that we should be in position zero
for the next line. This is an issue because we don't always want to be
in position 0 after a closing brace.

Example:
```
[[[
]
]
]
```
In the above example the 'spaces_of_nest' array looks like this after
the first line is entered: [0,0,0]. We really want to be indented 4
spaces for the 1st closing brace 2 for the 2nd and 0 for the 3rd. i.e.
we want it to be: [0,2,4].

We also saw this issue with a heredoc inside of an array.

```
[<<FOO]
hello
FOO
```

https://github.com/ruby/irb/commit/80c69c8272
2020-01-14 15:40:38 +09:00
..
test_color.rb qsymbols and symbols should be colored as Symbol 2019-11-10 13:54:44 -08:00
test_completion.rb Add require "irb" to test/irb/test_completion.rb 2019-11-28 15:32:21 +09:00
test_context.rb Use singleline/multiline instead of readline/reidline 2019-11-21 02:44:35 +09:00
test_init.rb [ruby/irb] Restore environment variables 2019-12-14 00:39:53 +09:00
test_option.rb make sync-default-gems GEM=irb 2019-06-13 00:32:20 +09:00
test_raise_no_backtrace_exception.rb Don't echo results of assignment expressions 2019-08-16 06:02:45 +09:00
test_ruby_lex.rb [ruby/irb] Fix crashing when multiple open braces per line 2020-01-14 15:40:38 +09:00
test_workspace.rb Add "require 'irb'" to use IRB.conf 2019-05-21 09:24:09 +09:00