Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[t/spec] Add a bunch of tests to make sure === and !=== return Bool.

git-svn-id: http://svn.pugscode.org/pugs@29959 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 60babe241a28d8b5a806c4dc4ef11627c3f18fe7 1 parent ac6b6ed
colomon authored
Showing with 20 additions and 4 deletions.
  1. +20 −4 S03-operators/value_equivalence.t
View
24 S03-operators/value_equivalence.t
@@ -14,18 +14,21 @@ false, and C<[1,2] eqv [1,2]> returns true.
# L<S03/"Chaining binary precedence" /Value identity>
-plan 52;
+plan *;
# === on values
{
ok (1 === 1), "=== on values (1)";
ok (0 === 0), "=== on values (2)";
ok !(0 === 1), "=== on values (3)";
+ isa_ok (1 === 1), Bool, "=== on values (4)";
ok ("abc" === "abc"), "=== on values(abc)";
ok !("abc" === "ABC"), "=== on values(abc === ABC)";
+ isa_ok ("abc" === "abc"), Bool, "=== on values (abc)";
ok !(1 === 1.0), "=== on values (1 === 1.0)";
ok !(1 === "1"), '=== on values (1 === "1")';
ok (Mu === Mu), '=== on values (Mu === Mu)';
+ isa_ok (Mu === Mu), Bool, '=== on values (Mu === Mu)';
}
# Value types
@@ -36,6 +39,7 @@ plan 52;
ok $a === $a, "=== on value types (1-1)";
ok $b === $b, "=== on value types (1-2)";
ok $a === $b, "=== on value types (1-3)";
+ isa_ok $a === $b, Bool, "=== on value types (1-4)";
}
{
@@ -45,6 +49,7 @@ plan 52;
ok ($a === $a), "=== on value types (2-1)";
ok ($b === $b), "=== on value types (2-2)";
ok !($a === $b), "=== on value types (2-3)";
+ isa_ok ($a === $a), Bool, "=== on value types (2-4)";
}
# Reference types
@@ -56,6 +61,7 @@ plan 52;
ok (\@a === \@a), "=== on array references (1)";
ok (\@b === \@b), "=== on array references (2)";
ok !(\@a === \@b), "=== on array references (3)";
+ isa_ok (\@a === \@a), Bool, "=== on array references (4)";
}
{
@@ -65,6 +71,7 @@ plan 52;
ok ($a === $a), "=== on scalar references (1-1)";
ok ($b === $b), "=== on scalar references (1-2)";
ok !($a === $b), "=== on scalar references (1-3)";
+ isa_ok ($a === $a), Bool, "=== on scalar references (1-4)";
}
{
@@ -74,12 +81,14 @@ plan 52;
ok ($a === $a), "=== on sub references (1-1)";
ok ($b === $b), "=== on sub references (1-2)";
ok !($a === $b), "=== on sub references (1-3)";
+ isa_ok ($a === $a), Bool, "=== on sub references (1-4)";
}
{
ok (&say === &say), "=== on sub references (2-1)";
ok (&map === &map), "=== on sub references (2-2)";
ok !(&say === &map), "=== on sub references (2-3)";
+ isa_ok (&say === &say), Bool, "=== on sub references (2-4)";
}
{
@@ -91,23 +100,27 @@ plan 52;
ok ($b === $b), "=== on scalar references (2-2)";
#?rakudo todo "=== fail"
ok ($a === $b), "=== on scalar references (2-3)";
+ isa_ok ($a === $a), Bool, "=== on scalar references (2-4)";
}
{
ok !([1,2,3] === [4,5,6]), "=== on anonymous array references (1)";
ok !([1,2,3] === [1,2,3]), "=== on anonymous array references (2)";
ok !([] === []), "=== on anonymous array references (3)";
+ isa_ok ([1,2,3] === [4,5,6]), Bool, "=== on anonymous array references (4)";
}
{
ok !({a => 1} === {a => 2}), "=== on anonymous hash references (1)";
ok !({a => 1} === {a => 1}), "=== on anonymous hash references (2)";
+ isa_ok ({a => 1} === {a => 2}), Bool, "=== on anonymous hash references (3)";
}
{
- ok !(\3 === \4), "=== on anonymous scalar references (1)";
- ok !(\3 === \3), "=== on anonymous scalar references (2)";
- ok !(\Mu === \Mu), "=== on anonymous scalar references (3)";
+ ok !(\3 === \4), "=== on anonymous scalar references (1)";
+ ok !(\3 === \3), "=== on anonymous scalar references (2)";
+ ok !(\Mu === \Mu), "=== on anonymous scalar references (3)";
+ isa_ok (\3 === \4), Bool, "=== on anonymous scalar references (4)";
}
# Chained === (not specced, but obvious)
@@ -142,10 +155,13 @@ plan 52;
ok !(1 !=== 1), "!=== on values (1)";
ok !(0 !=== 0), "!=== on values (2)";
ok (1 !=== 0), "!=== on values (3)";
+ isa_ok (1 !=== 1), Bool, "!=== on values (4)";
ok !("abc" !=== "abc"), "!=== on values(abc)";
ok ("abc" !=== "ABC"), "!=== on values(abc !=== ABC)";
ok (1 !=== 1.0), "!=== on values (1 !=== 1.0)";
ok (1 !=== "1"), '!=== on values (1 !=== "1")';
}
+done_testing;
+
# vim: ft=perl6
Please sign in to comment.
Something went wrong with that request. Please try again.