Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Simple test for the sub form of 'X'
Closes #165
- Loading branch information
1 parent
4f03cdb
commit f9950fa
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| use v6; | ||
|
|
||
|
|
||
| use Test; | ||
|
|
||
| plan 2; | ||
|
|
||
| # most of the tests for this are done in the S03-metaops/cross.t | ||
| # will just test the interface here; | ||
|
|
||
| is(cross(<a b>, <1 2>), <a 1 a 2 b 1 b 2>, "plain cross"); | ||
| is(cross(<a b>, <1 2>, with => &[~]), <a1 a2 b1 b2>, "cross with operator"); | ||
|
|
||
|
|
||
| # vim: expandtab shiftwidth=4 ft=perl6 |
f9950faThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to do an is-deeply? Don't these tests depend on the stringification being the same?
f9950faThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
They do, by using
eqthat stringifies its operands (whereasis-deeplyuseseqv)f9950faThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably but the
S03-metaops/cross.talso uses theislike this, so that would go broken if the stringification changed too.f9950faThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That just means
S03-metaops/cross.ttests are less than ideal too and abuseisπΈ It's not change of stringification that's the issue, but that you're failing to check correct return types and failing to check the entire output is correct:say [eq] ("a1 a2", "b1 b2"), <a1 a2 b1 b2>, ("a1", ("a2", ("b1", ("b2")))), [<a1 a2 b1 b2>]givesTrue, even though those items are vastly different.Also, from tests' perspective, there's no relation between
crossandinfix:<X>. You're letting your knowledge of a single implementation's details seep into your tests.For example, if I change this line in core to:
the entire spectest will still pass, but the sub will be abjectly broken; it won't even be returning lists πΉ
f9950faThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I'll change this one to use is-deeply, but I''ll put a issue to change the 'is' in the other tests.
f9950faThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with fa7da3d
I've added an issue #167 to pick up the rest :)