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

Integration test helper improvements #6156

Merged
merged 7 commits into from
Mar 20, 2023

Conversation

dead10ck
Copy link
Member

@dead10ck dead10ck commented Mar 2, 2023

  • reorganize write command tests to their own module

  • make TestCase::From more generic for ergonomics

  • print doc state during tests for much better debugging

  • To help with ergonomics, test::print was changed to allow explicit newlines in test DSL. The current test DSL currently has no way to express being at the end of a line, save for putting an explicit LF or CRLF inside the #[|]#. The problem with this approach is that it can add unintended extra new lines if used in conjunction with raw strings, which insert newlines for you.

    This is a simple attempt to mitigate this problem. If there is an explicit newline character at the end of the selection, and then it is immediately followed by the same newline character at the right end of the selection, this following newline is removed. This way, one can express a cursor at the end of a line explicitly.

  • fix a bug test::plain: it is currently using char indices for String::insert_str which is supposed to take byte indices. This causes panics on Unicode characters

  • use AppBuilder more consistently throughout tests to make use of saner defaults and improve readability

@dead10ck dead10ck mentioned this pull request Mar 2, 2023
@dead10ck dead10ck force-pushed the integration-test-improve branch from ec3ff23 to 9c77e34 Compare March 2, 2023 05:09
@pascalkuthe pascalkuthe added the S-waiting-on-review Status: Awaiting review from a maintainer. label Mar 2, 2023
@dead10ck dead10ck force-pushed the integration-test-improve branch from 9c77e34 to 53adf91 Compare March 6, 2023 00:19
@archseer archseer added this to the next milestone Mar 8, 2023
@dead10ck dead10ck force-pushed the integration-test-improve branch 3 times, most recently from 3feb2a2 to f19fb10 Compare March 11, 2023 04:51
archseer
archseer previously approved these changes Mar 16, 2023
Copy link
Member

@archseer archseer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a Cargo.lock conflict to resolve

@dead10ck
Copy link
Member Author

Done 🙂

The current test DSL currently has no way to express being at the end of
a line, save for putting an explicit LF or CRLF inside the `#[|]#`. The
problem with this approach is that it can add unintended extra new lines
if used in conjunction with raw strings, which insert newlines for you.

This is a simple attempt to mitigate this problem. If there is an
explicit newline character at the end of the selection, and then it
is immediately followed by the same newline character at the right end
of the selection, this following newline is removed. This way, one can
express a cursor at the end of a line explicitly.
test::plain uses char indices when it should use byte indices
@dead10ck dead10ck force-pushed the integration-test-improve branch from 779234e to 01c5382 Compare March 19, 2023 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants