petdance/scratch — Issue #242: Improve <null> handling in Test::More.pir
Author: petdance
Created: 2011-11-01 05:30:26+00:00
State: open
Labels: cage, library, Pri-normal, Sev-medium

I had occasion to pass some null values to Test::More's `is()` multisub, and got an unexpected fault - NULL pmc access, etc.

Bacek mentioned in the commit comments to cs# [43660] that discussion was needed on how Test::More handles null, so I have created this ticket to host that discussion.

To get started, I am committing a patch (cs# [44058]) that adds `is_null` as a test assertion, as well as adding support for null values to the various `is()` multisub elements.

I think that "null happens", which is especially vexing when calling from NQP to PIR. So I think that any assertion that accepts a PMC type must support the possibility that the PMC type will be null.

I have implemented "null equivalence" -- that is, null==null, for the assertions. I know this can be argued both ways.

Obvious leftovers include the creation of `isnt_null` and adding null support to the `isnt` assertions, as well as devising a null policy for the other assertions. The `is_deeply` seems to do something with null, but that's about it.

Trac ID #1453