[#102393] [Ruby master Feature#17608] Compact and sum in one step — sawadatsuyoshi@...

Issue #17608 has been reported by sawa (Tsuyoshi Sawada).

13 messages 2021/02/04

[#102438] [Ruby master Bug#17619] if false foo=42; end creates a foo local variable set to nil — pkmuldoon@...

Issue #17619 has been reported by pkmuldoon (Phil Muldoon).

10 messages 2021/02/10

[#102631] [Ruby master Feature#17660] Expose information about which basic methods have been redefined — tenderlove@...

Issue #17660 has been reported by tenderlovemaking (Aaron Patterson).

9 messages 2021/02/27

[#102639] [Ruby master Misc#17662] The herdoc pattern used in tests does not syntax highlight correctly in many editors — eregontp@...

Issue #17662 has been reported by Eregon (Benoit Daloze).

13 messages 2021/02/27

[#102652] [Ruby master Bug#17664] Behavior of sockets changed in Ruby 3.0 to non-blocking — ciconia@...

Issue #17664 has been reported by ciconia (Sharon Rosner).

23 messages 2021/02/28

[ruby-core:102668] [Ruby master Misc#17662] The heredoc pattern used in tests does not syntax highlight correctly in many editors

From: xtkoba+ruby@...
Date: 2021-02-28 19:33:58 UTC
List: ruby-core #102668
Issue #17662 has been updated by xtkoba (Tee KOBAYASHI).


Emacs Ruby Mode behaves well with the current pattern. I wonder why the other editors do not simulate it.

----------------------------------------
Misc #17662: The heredoc pattern used in tests does not syntax highlight correctly in many editors
https://bugs.ruby-lang.org/issues/17662#change-90662

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
----------------------------------------
This heredoc pattern
```ruby
    assert_ruby_status([], "#{<<-"begin;"}\n#{<<-'end;'}", bug)
    begin;
      exit("1" == Thread.start(1, &:to_s).value)
    end;
```

completely breaks syntax highlighting in at least:
* GitHub: [there](https://github.com/ruby/ruby/blob/36dde35e029c7a6607e6c674062ce6fc7a51c0bd/test/ruby/test_string.rb#L697) [are](https://github.com/ruby/ruby/blob/36dde35e029c7a6607e6c674062ce6fc7a51c0bd/test/ruby/test_process.rb#L1545) [many](https://github.com/ruby/ruby/blob/565aeb81e0886c835888a425e5d05ed99fb03238/test/ruby/test_thread.rb#L201) [examples](https://github.com/ruby/ruby/blob/36dde35e029c7a6607e6c674062ce6fc7a51c0bd/test/ruby/test_require.rb#L21)
* Atom
* RubyMine (and IntelliJ)
* Likely many more editors based on TextMate grammars

Could another pattern be used in tests inside the ruby/ruby repository (at least for `test/ruby`)?

Due to this issue, it is very annoying and inconvenient to look at/read/investigate many tests.

I think this pattern is also very complicated to understand (and using `;` is quite weird for this).
I suggest to replace it with this obvious and simple pattern many people use:
```ruby
    assert_ruby_status([], <<~'RUBY', bug)
      exit("1" == Thread.start(1, &:to_s).value)
    RUBY
```
This syntax highlights correctly in most (all?) editors, and as an added bonus the code inside the heredoc is also highlighted in some editors (due to the label being `RUBY`).



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread