rouge icon indicating copy to clipboard operation
rouge copied to clipboard

Double quoted strings within Java text blocks are incorrectly parsed

Open sbrannen opened this issue 2 years ago • 0 comments

Name of the lexer

Java

Code sample

@CsvSource(delimiter = '|', quoteCharacter = '"', textBlock = """
    #-----------------------------
    #    FRUIT     |     RANK
    #-----------------------------
         apple     |      1
    #-----------------------------
         banana    |      2
    #-----------------------------
      "lemon lime" |     0xF1
    #-----------------------------
       strawberry  |    700_000
    #-----------------------------
    """)
void testWithCsvSource(String fruit, int rank) {
    // ...
}

"lemon lime" is highlighted differently.

Strings enclosed in double quotes (") should not be highlighted differently than the surrounding text block.

FYI: the GitHub syntax highlighter apparently does not support Java text blocks correctly either.

Additional context

  • First reported in https://github.com/junit-team/junit5/issues/3287
  • 3rd code example in: https://junit.org/junit5/docs/5.9.3/user-guide/#writing-tests-parameterized-tests-sources-CsvSource

sbrannen avatar May 07 '23 14:05 sbrannen