Permalink
Browse files

[t/spec] A little re-fudging that I forgot to commit earlier.

git-svn-id: http://svn.pugscode.org/pugs@29883 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 6476383 commit f2f0e2411f817fd6d0111cb9691a606fc36ee7d5 jnthn committed Feb 27, 2010
Showing with 34 additions and 34 deletions.
  1. +34 −34 S03-junctions/misc.t
View
@@ -325,7 +325,7 @@ ok(!(?(1&0) != ?(1&&0)), 'boolean context');
}
# used to be a rakudo regression (RT #60886)
-ok ?(Mu & Mu.notdef), 'Mu & Mu.notdef works';
+ok Mu & Mu ~~ Mu, 'Mu & Mu ~~ Mu works';
## See also S03-junctions/autothreading.t
#?rakudo skip 'substr on junctions'
@@ -370,41 +370,41 @@ ok ?(Mu & Mu.notdef), 'Mu & Mu.notdef works';
}
# Naive implementation of comparing two junctions
-sub junction_diff(Mu $this, Mu $that) {
- if ($this.WHAT ne 'junction()' and $that.WHAT ne 'junction()') {
- return if $this ~~ $that;
- }
- if ($this.WHAT ne 'junction()' and $that.WHAT eq 'junction()') {
- return "This is not a junction";
- }
- if ($this.WHAT eq 'junction()' and $that.WHAT ne 'junction()') {
- return "That is not a junction";
- }
- my ($this_type) = $this.perl ~~ /^(\w+)/;
- my ($that_type) = $that.perl ~~ /^(\w+)/;
- if ($this_type ne $that_type) {
- return "This is $this_type, that is $that_type";
- }
-
- my @these = sort $this!eigenstates;
- my @those = sort $that!eigenstates;
- my @errors;
- for @these -> $value {
- if $value !~~ any(@those) {
- push @errors, "$value is missing from that";
- }
- }
- for @those -> $value {
- if $value !~~ any(@these) {
- push @errors, "$value is missing from this";
- }
- }
- return @errors if @errors;
- return;
-}
-
#?rakudo skip 'Confusing tests (to pmichaud)'
{
+ sub junction_diff(Mu $this, Mu $that) {
+ if ($this.WHAT ne 'junction()' and $that.WHAT ne 'junction()') {
+ return if $this ~~ $that;
+ }
+ if ($this.WHAT ne 'junction()' and $that.WHAT eq 'junction()') {
+ return "This is not a junction";
+ }
+ if ($this.WHAT eq 'junction()' and $that.WHAT ne 'junction()') {
+ return "That is not a junction";
+ }
+ my ($this_type) = $this.perl ~~ /^(\w+)/;
+ my ($that_type) = $that.perl ~~ /^(\w+)/;
+ if ($this_type ne $that_type) {
+ return "This is $this_type, that is $that_type";
+ }
+
+ my @these = sort $this!eigenstates;
+ my @those = sort $that!eigenstates;
+ my @errors;
+ for @these -> $value {
+ if $value !~~ any(@those) {
+ push @errors, "$value is missing from that";
+ }
+ }
+ for @those -> $value {
+ if $value !~~ any(@these) {
+ push @errors, "$value is missing from this";
+ }
+ }
+ return @errors if @errors;
+ return;
+ }
+
ok(! junction_diff(1, 1), 'no junctions');
is_deeply(junction_diff(1, 1|2), "This is not a junction", 'Left value is not a junction');
is_deeply(junction_diff(1|2, 1), "That is not a junction", 'Right value is not a junction');

0 comments on commit f2f0e24

Please sign in to comment.