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

If a trailing newline is missing from actual vs. expected, it is not shown in the diff #184

Open
mcmire opened this issue Mar 18, 2023 · 0 comments
Labels

Comments

@mcmire
Copy link
Owner

mcmire commented Mar 18, 2023

Here's some example output from RSpec:

  1) Albatross::Cli given --help prints the help screen
     Failure/Error:
             expect(stdout.string).to eq(<<-OUTPUT)
       Commands for working with the development environment.

       #{colorize(:bold, "USAGE")}

       executable COMMAND [OPTIONS]

       #{colorize(:bold, "COMMANDS")}

       init - Initialize development environment

       Expected "Commands for working with the development environment.\n\n\e[1mUSAGE\e[0m\n\nexecutable COMMAND [OPTIONS]\n\n\e[1mCOMMANDS\e[0m\n\ninit - Initialize development environment\n run - Run a command within a Ruby version\n\n\e[1mOPTIONS\e[0m\n\n    -h, --help                       You're looking at it ;)\n\n"
          to eq "Commands for working with the development environment.\n\n\e[1mUSAGE\e[0m\n\nexecutable COMMAND [OPTIONS]\n\n\e[1mCOMMANDS\e[0m\n\ninit - Initialize development environment\n run - Run a command within a Ruby version\n\n\e[1mOPTIONS\e[0m\n\n    -h, --help                       You're looking at it ;)\n"

       Diff:

       ┌ (Key) ──────────────────────────┐
       │ ‹-› in expected, not in actual  │
       │ ‹+› in actual, not in expected  │
       │ ‹ › in both expected and actual │
       └─────────────────────────────────┘

         Commands for working with the development environment.\n
         \e[1mUSAGE\e[0m\n
         executable COMMAND [OPTIONS]\n
         \e[1mCOMMANDS\e[0m\n
         init - Initialize development environment\n
          run - Run a command within a Ruby version\n
         \e[1mOPTIONS\e[0m\n
             -h, --help                       You're looking at it ;)\n

Here, actual has an extra newline, whereas expected does not. However, this isn't obvious, because the diff doesn't have any - or + lines whatsoever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant