Solomon Foster wrote:
> On Wed, Jun 2, 2010 at 3:52 PM, Aaron Sherman <a...@ajs.com> wrote:
>> Is there some automatic translation of these examples into tests? If not,
>> here's what they'd be:
>>
>> ok(( (1,2,3,4) «+» (1,2) ) ~~ (2,4,4,6) )
>> ok(( (1,2,3)   «+» (1,2) ) ~~ (2,4,4)   )
>> ok(( (1,2,3,4) «+« (1,2) ) ~~ (2,4)     )
>> ok(( (1,2,3,4) »+» (1,2) ) ~~ (2,4,4,6) )
>> ok(( (1,2,3)   »+» (1,2) ) ~~ (2,4,4,6) )
>> ok(( (1,2,3)   »+»  1    ) ~~ (2,4,4,6) )
>>
>> I tested these all with Rakudo, and they all currently fail, though I guess
>> that's not shocking.
> 
> ~~ (2, 4, 4) (for example) isn't actually supposed to work, is it?
> Certainly doesn't work in Rakudo and I've never seen a spectest
> written like that...

Even if it did, we try to keep the spectests as simple as possible, and
not relying on the finer points of smart matching (which traditionally
have changed rather often).

I tend to write such tests as

is ( (1,2,3,4) «+» (1,2) ).join('|'), '2|4|4|6', '«+» dwims by repeating
RHS';

etc.

the .join method is more basic than smart matching, and makes it very
obvious with what semantics the comparison happens.

Also you get good diagnostics from is() in case of failure (expected vs.
got in the output).

Cheers,
Moritz

Reply via email to