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

tests(binary): improve readability of multiline strings #392

Merged
merged 1 commit into from
Jul 23, 2021

Conversation

ee7
Copy link
Member

@ee7 ee7 commented Jul 21, 2021

This commit indents multiline string literals in the tests of the
configlet executable, which makes the tests easier to follow visually.

We also replace a dedent with the simpler unindent.


Example before this PR:

    test "after syncing, another `sync --update --mode=include` performs no changes":
      execAndCheck(0):
        execCmdEx(&"{binaryPath} -t {trackDir} sync --update -mi -o -p {psDir}")

      check outp == """
Syncing exercises...
All exercises are synced!
"""

    test "after syncing, a `sync` without `--update` shows that exercises are up to date":
      execAndCheck(0):
        execCmdEx(&"{binaryPath} -t {trackDir} sync -o -p {psDir}")
      check outp == """
Checking exercises...
All exercises are up-to-date!
"""

With this PR:

    test "after syncing, another `sync --update --mode=include` performs no changes":
      execAndCheck(0):
        execCmdEx(&"{binaryPath} -t {trackDir} sync --update -mi -o -p {psDir}")

      check outp == """
        Syncing exercises...
        All exercises are synced!
      """.unindent()

    test "after syncing, a `sync` without `--update` shows that exercises are up to date":
      execAndCheck(0):
        execCmdEx(&"{binaryPath} -t {trackDir} sync -o -p {psDir}")
      check outp == """
        Checking exercises...
        All exercises are up-to-date!
      """.unindent()

Another tiny PR. I'm making this PR separately from #366 in the hopes of making its eventual squashed commit marginally more comprehensible.

Obscure implementation detail: strutils.dedent can only be used with & from std/strformat if the indendation amount is passed.

@ee7 ee7 requested a review from ErikSchierboom as a code owner July 21, 2021 14:47
@ee7 ee7 merged commit ca69e01 into exercism:main Jul 23, 2021
@ee7 ee7 deleted the tests-binary-prefer-unindent branch July 23, 2021 15:22
@ee7 ee7 changed the title tests(binary): improve readability of multi-line string literals tests(binary): improve readability of multiline strings Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants