-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[t/spec] remove Windows line endings from S06-signature/type-capture.t
git-svn-id: http://svn.pugscode.org/pugs@24152 c213334d-75ef-0310-aa23-eaa082d1ae64
- Loading branch information
hinrik
committed
Dec 4, 2008
1 parent
9511a2f
commit 7ca904f
Showing
1 changed file
with
33 additions
and
33 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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
use v6; | ||
use Test; | ||
|
||
plan 7; | ||
|
||
# Check it captures built-in types. | ||
sub basic_capture(::T $x) { ~T } | ||
is(basic_capture(42), 'Int', 'captured built-in type'); | ||
is(basic_capture(4.2), 'Num', 'captured built-in type'); | ||
|
||
# User defined ones too. | ||
class Foo { } | ||
is(basic_capture(Foo.new), 'Foo', 'captured user defined type'); | ||
|
||
# Check you can use captured type later in the signature. | ||
sub two_the_same(::T $x, T $y) { 1 } | ||
ok(two_the_same(42, 42), 'used captured type later in the sig'); | ||
my $ok = 1; | ||
try { | ||
two_the_same(42, 4.2); | ||
$ok = 0; | ||
} | ||
ok($ok, 'used captured type later in the sig'); | ||
|
||
# Check you can use them to declare variables. | ||
sub declare_cap_type(::T $x) { | ||
my T $y = 4.2; | ||
1 | ||
} | ||
ok(declare_cap_type(3.3), 'can use captured type in declaration'); | ||
$ok = 1; | ||
try { | ||
declare_cap_type(42); | ||
$ok = 0; | ||
} | ||
ok($ok, 'can use captured type in declaration'); | ||
plan 7; | ||
|
||
# Check it captures built-in types. | ||
sub basic_capture(::T $x) { ~T } | ||
is(basic_capture(42), 'Int', 'captured built-in type'); | ||
is(basic_capture(4.2), 'Num', 'captured built-in type'); | ||
|
||
# User defined ones too. | ||
class Foo { } | ||
is(basic_capture(Foo.new), 'Foo', 'captured user defined type'); | ||
|
||
# Check you can use captured type later in the signature. | ||
sub two_the_same(::T $x, T $y) { 1 } | ||
ok(two_the_same(42, 42), 'used captured type later in the sig'); | ||
my $ok = 1; | ||
try { | ||
two_the_same(42, 4.2); | ||
$ok = 0; | ||
} | ||
ok($ok, 'used captured type later in the sig'); | ||
|
||
# Check you can use them to declare variables. | ||
sub declare_cap_type(::T $x) { | ||
my T $y = 4.2; | ||
1 | ||
} | ||
ok(declare_cap_type(3.3), 'can use captured type in declaration'); | ||
$ok = 1; | ||
try { | ||
declare_cap_type(42); | ||
$ok = 0; | ||
} | ||
ok($ok, 'can use captured type in declaration'); |