Skip to content

uucore - test_terminal_type_display fails, code looks simply wrong. #7732

@plugwash

Description

@plugwash

We recently updated the uucore crate in Debian, and I was looking through the test failures. Most of them seem related to our test environment, but one of them stuck out as plain wrong code.

thread 'features::tty::tests::test_terminal_type_display' panicked at src/lib/features/tty.rs:122:9:
assertion `left == right` failed
  left: "/dev/ttyS10"
 right: "/dev/pts/10"

The code looks like

impl Display for Teletype {
    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
        match self {
            Self::Tty(id) => write!(f, "/dev/pts/{}", id),
            Self::TtyS(id) => write!(f, "/dev/tty{}", id),
            Self::Pts(id) => write!(f, "/dev/ttyS{}", id),
            Self::Unknown => write!(f, "?"),
        }
    }

}

Which just looks plain wrong. I don't see how this test can ever have passed.

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