Skip to content

proposal: testscript: allow to specify wanted exit status #271

@marco-m

Description

@marco-m

Hello,

today testscript allows to require:

  • success (exit status 0) with exec foo
  • failure (exit status != 0) with ! exec foo.

Sometimes one would like to specify the exact exit status value. For example, if curl was written in Go, see section "EXIT CODES" of the curl man page.

I realized that a backward-compatible and clear way to express this would be to add an optional integer to the right of the ! symbol:

  • ! exec foo as of today
  • !<N> exec foo, where <N> is a non-zero, positive integer, to specify the exit status.
    • For example: !2 exec foo requires foo to exit with status 2.

As usual, the proposed syntax is just a possibility, I care more about the feature itself.

Thanks for testscript!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions