Skip to content

--debug crashes should not cause assert-* to be like expect-* #183

Open
@cgay

Description

@cgay

Assume you have a test containing these assertions:

  let frag = read-fragment(source-code);
  assert-instance?(<string-fragment>, frag, description);
  assert-equal(want-value, frag.fragment-value, description);

Normally if the first assertion fails the test should terminate, but if you specify --debug crashes or --debug all the first assertion will not terminate the test and the second assertion will be run, causing a potentially confusing error. (In the above case, "No applicable method for fragment-value(#f)".)

The --debug flag should not change the semantics of assert-*, it should just cause the debugger to be entered when they fail.

I can quickly see from the code that the debug?() function is the problem:

              block ()
                test.test-function();
              exception (err :: <assertion-failure>,
                         test: method (c) ~debug?() end)

but I don't want to squirrel on this right now and the correct fix isn't immediately obvious to me.

(I believe there are other bugs in this area, like I'm not sure whether --debug all actually causes assertion failures (not crashes) to enter the debugger. Verify it.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    assertionsbugA problem with existing functionality or documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions