Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat text blocks as files in @CsvSource #2734

Closed
5 tasks done
sbrannen opened this issue Oct 1, 2021 · 2 comments
Closed
5 tasks done

Treat text blocks as files in @CsvSource #2734

sbrannen opened this issue Oct 1, 2021 · 2 comments

Comments

@sbrannen
Copy link
Member

sbrannen commented Oct 1, 2021

Overview

PR #2721 introduced experimental support for text blocks in @CsvSource; however, there is room for improvement.

A CSV line within a text block cannot currently contain a new line (\n), even if it is within a quoted string; whereas, this is supported when using @CsvSource(value = ...).

Comments do not make sense in a single string in @CsvSource(value = ...), but they do make sense within @CsvSource(textBlock = ...).

Related Issues

Deliverables

  • Support \n within quoted strings in text blocks.
  • Support comment lines beginning with # in text blocks.
  • Implement robust solution for sanitizing a text block, since String#stripIndent() is only available on JDK 15+.
  • Document in the User Guide.
  • Document in the Release Notes.
@sbrannen sbrannen added this to the 5.8.2 milestone Oct 1, 2021
@sbrannen sbrannen self-assigned this Oct 1, 2021
@sbrannen sbrannen changed the title Support text blocks as files in @CsvSource Treat text blocks as files in @CsvSource Oct 1, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 1, 2021
@sbrannen
Copy link
Member Author

sbrannen commented Oct 1, 2021

Current work on this issue can be viewed in the following feature branch:

main...sbrannen:issues/2734-treat-text-blocks-as-files-in-CsvSource

sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 3, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 3, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 3, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 3, 2021
@sbrannen
Copy link
Member Author

sbrannen commented Oct 3, 2021

FYI: PR #2737 is ready for technical review.

sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 4, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 4, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 4, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 4, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 6, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 6, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 25, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 25, 2021
sbrannen added a commit to sbrannen/junit5 that referenced this issue Oct 25, 2021
sbrannen added a commit that referenced this issue Oct 26, 2021
PR #2721 introduced experimental support for text blocks in @CsvSource;
however, there was room for improvement.

Prior to this commit, a CSV record within a text block could not
contain a new line (\n), even if it was within a quoted string;
whereas, this is supported when using @CsvSource's value attribute. In
addition, comments do not make sense in a single string supplied via
@CsvSource's value attribute, but they do make sense within a text
block.

This commit refines the text block support in @CsvSource by treating
text blocks as complete CSV files, including support for comments
beginning with a `#` symbol as well as support for new lines within
quoted strings.

Closes #2734
runningcode pushed a commit to runningcode/junit5 that referenced this issue Feb 15, 2023
PR junit-team#2721 introduced experimental support for text blocks in @CsvSource;
however, there was room for improvement.

Prior to this commit, a CSV record within a text block could not
contain a new line (\n), even if it was within a quoted string;
whereas, this is supported when using @CsvSource's value attribute. In
addition, comments do not make sense in a single string supplied via
@CsvSource's value attribute, but they do make sense within a text
block.

This commit refines the text block support in @CsvSource by treating
text blocks as complete CSV files, including support for comments
beginning with a `#` symbol as well as support for new lines within
quoted strings.

Closes junit-team#2734
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant