summaryrefslogtreecommitdiff
path: root/test/irb/test_ruby_lex.rb
AgeCommit message (Collapse)Author
2020-11-22[ruby/irb] support more body argument for oneliner method definitionNobuhiro IMAI
https://github.com/ruby/irb/commit/2ff1295533
2020-08-18[ruby/irb] Support shortening lambda notetion for nesting level of promptaycabta
https://github.com/ruby/irb/commit/f1a775af47
2020-08-18[ruby/irb] Support shortening lambda notationaycabta
https://github.com/ruby/irb/commit/8e3f81d428
2020-08-18[ruby/irb] Support oneline method definitionaycabta
https://github.com/ruby/irb/commit/826ae909c9
2020-07-22[ruby/irb] handle rescue modifier properlyNobuhiro IMAI
https://github.com/ruby/irb/commit/6de1341f5e
2020-07-22[ruby/irb] Add encoding magic comments of editorsaycabta
https://github.com/ruby/irb/commit/f8c10ea24b
2020-07-22[ruby/irb] Suppress incomplete encoding magic comment erroraycabta
https://github.com/ruby/irb/commit/443e90af80
2020-07-22[ruby/irb] Suppress incomplete coding magic comment erroraycabta
https://github.com/ruby/irb/commit/6a457edbd1
2020-02-29Fix a typo [ci skip]Kazuhiro NISHIYAMA
2020-02-12[ruby/irb] Fix auto indent with closed braceaycabta
A closed brace in auto-indent shouldn't affect the next brace in the same line, but it behaves like below: p() { } It's a bug. https://github.com/ruby/irb/commit/fbe59e344f
2020-01-14[ruby/irb] Fix crashing when multiple open braces per lineBen
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[ruby/irb] Fix newline depth with multiple bracesBen
This commit fixes the check_newline_depth_difference method to multiple open braces on one line into account. Before this change we were subtracting from the depth in check_newline_depth_difference on every open brace. This is the right thing to do if the opening and closing brace are on the same line. For example in a method definition we have an opening and closing parentheses we want to add 1 to our depth, and then remove it. ``` def foo() end ``` However this isn't the correct behavior when the brace spans multiple lines. If a brace spans multiple lines we don't want to subtract from check_newline_depth_difference and we want to treat the braces the same way as we do `end` and allow check_corresponding_token_depth to pop the correct depth. Example of bad behavior: ``` def foo() [ ] puts 'bar' end ``` Example of desired behavior: ``` def foo() [ ] puts 'bar' end ``` https://github.com/ruby/irb/commit/7dc8af01e0
2020-01-01Add load path and require for ruby/rubyaycabta
2020-01-01[ruby/irb] Fix lib name of OpenStructaycabta
https://github.com/ruby/irb/commit/1f3a84ab6b
2019-12-31Add "require 'openstruct'" what is forgottenaycabta
2019-12-31[ruby/irb] Add tests for RubyLexBen
The set_auto_indent method calculates the correct number of spaces for indenting a line. We think there might be a few bugs in this method so we are testing the current functionality to make sure nothing breaks when we address those bugs. Example test failure: ``` 1) Failure: TestIRB::TestRubyLex#test_auto_indent [/Users/Ben/Projects/irb/test/irb/test_ruby_lex.rb:75]: Calculated the wrong number of spaces for: def each_top_level_statement initialize_input catch(:TERM_INPUT) do loop do begin prompt unless l = lex throw :TERM_INPUT if @line == '' else . <10> expected but was <12>. ``` https://github.com/ruby/irb/commit/752d5597ab