ruby/spec/syntax_suggest/unit
Schneems 226cfda306 [ruby/syntax_suggest] Fix missing line break due to puts logic
In #225 it was reported that the output looks incorrect:

```
$ cat /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb
def x.y.z
end
$ ruby /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb
/tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb: --> /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb
expected a delimiter to close the parametersunexpected '.', ignoring it
> 1  def x.y.z
> 2  end
```

Specifically:

```
expected a delimiter to close the parametersunexpected '.', ignoring it
```

However this does not show up when executing the debug executable:

```
$ bin/bundle exec exe/syntax_suggest /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb
--> /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb

expected a delimiter to close the parameters
unexpected '.', ignoring it

> 1  def x.y.z
> 2  end
```

This is because `exe/syntax_suggest` uses STDOUT.puts while calling `ruby` with the filename uses a fake IO object represented by MiniStringIO. This class was incorrectly not adding a newline to the end of the print.

The fix was to move the class to it's own file where it can be tested and then fix the behavior.

close https://github.com/ruby/syntax_suggest/pull/225

d2ecd94a3b

Co-authored-by: Andy Yong <andyywz@gmail.com>
2024-11-15 01:31:26 +00:00
..
capture
api_spec.rb [ruby/syntax_suggest] Support lexing with Prism 2023-12-05 17:51:28 +00:00
around_block_scan_spec.rb
block_expand_spec.rb [ruby/syntax_suggest] Typofix by misspell 2023-12-26 02:10:25 +00:00
capture_code_context_spec.rb
clean_document_spec.rb [ruby/syntax_suggest] Typofix by misspell 2023-12-26 02:10:25 +00:00
cli_spec.rb
code_block_spec.rb
code_frontier_spec.rb
code_line_spec.rb
code_search_spec.rb
core_ext_spec.rb
display_invalid_blocks_spec.rb
explain_syntax_spec.rb [ruby/syntax_suggest] Change assertion to not rely on exact text from prism 2023-12-05 18:25:42 +00:00
lex_all_spec.rb [ruby/syntax_suggest] Update docs, clean up PR 2023-12-05 17:51:29 +00:00
mini_stringio_spec.rb [ruby/syntax_suggest] Fix missing line break due to puts logic 2024-11-15 01:31:26 +00:00
pathname_from_message_spec.rb
priority_queue_spec.rb
scan_history_spec.rb