Skip to content

test cleanup: Remove Cargo's internal hamcrest module #5742

Closed
@alexcrichton

Description

@alexcrichton

This used to be an upstream crate and we switched due to it being outdated, and otherwise nowadays it's very much showing its age! We primarily use this module to assert various properties of each executed command, but nowadays we should stop using hamcrest in favor of a new form of specifying what should happen.

I'm personally partial to the system I made for cargo-fix the other day for a replacement which features:

  • A builder style instead of a method-oriented style of building up a command
  • By default asserts output status is 0 (unless otherwise specified)
  • Lifts the awesome idea of supporting foo("arg1 arg2 arg3") instead of using arg("arg1").arg("arg2")...
  • Has a vastly simplified method of matching output (avoids things like [/] and dealing with things like cwd changing)
  • Was relatively simple to implement!

I think it'd be worth moving such a system into Cargo and migrating tests to use this assertion builder as well, I think it'd make assertions more concise and be a strong step forward to removing the hamcrest module.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions