Skip to content

Unit tests fail if terminal window is not exactly 80 characters wide #593

Closed
@rmunn

Description

@rmunn

#589 adds a check for sut.Settings.MaximumDisplayWidth.Should().Be(80), but that will fail if you run dotnet test in a Linux terminal window that's a different size.

To Reproduce:

  1. Clone the repo
  2. Open a Linux terminal window and don't resize it, so it's 80x24 (the usual default)
  3. Run dotnet test. It works.
  4. Resize the terminal window so it's one character wider
  5. Run dotnet test. It fails with "Expected sut.Settings.MaximumDisplayWidth to be 80, but found 81."

Note that on my dev laptop, I habitually run terminal windows at maximum screen width, so for me the exception was "Expected sut.Settings.MaximumDisplayWidth to be 80, but found 272."

Solution:

Don't assume any particular value for MaximumDisplayWidth; just check that it's greater than 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions