Can't match any or not output

Issue #11 open
created an issue

I'm wanting to match output which could be empty or not. I can match known empty output with "(eol)", and any non-empty output with ".* (re), but not output which may be empty or arbitrary non-empty.

For example, this fails: $ echo -n $ echo -n .* (re)

Maybe allow (eol) and (re) on the same match? Or allow several match lines and a way to say "any of these"?

Comments (2)

  1. Brodie Rao repo owner

    My initial guess was that this should work:

      $ printf bar
      .* (no-eol) (re)

    But it turns out we need to escape the parens:

      $ printf bar
      .* \(no-eol\) (re)

    (no-eol) is also a special kind of keyword in that it's embedded in the output, which explains the escaping. Changing (re) to specially interpret (no-eol) probably wouldn't be a good idea.

    Maybe we could allow "(re) (no-eol)" and "(glob) (no-eol)"?

  2. kra reporter

    Two related issues:

    A test with a large output, most of which we don't care about. We have to match each line of output, making our .t files unwieldy:

      $ python GET /frame/enroll
      200 OK
      * (glob)
      * (glob)
      A line we actually care about.
      * (glob}

    Or a test which could have a variable number of output lines.

    Neither of these are impossible to test right now, you just need to use grep or another helper. Might be more readable if there was a test keyword, though. Maybe (multiple), which would match 0 or more of the given lines:

      * (glob) (multiple)
  3. Log in to comment