Author: ash Date: 2010-01-19 17:34:28 +0100 (Tue, 19 Jan 2010) New Revision: 29558
Added: t/spec/S32-array/create.t t/spec/S32-list/create.t Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod Log: Adding some tests for List.new, Array.new, &list() and adding a description to S32-List and S32-Array Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Containers.pod 2010-01-18 06:08:15 UTC (rev 29557) +++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2010-01-19 16:34:28 UTC (rev 29558) @@ -120,6 +120,18 @@ =over +=item new + + our List multi method new(*...@args) + +Constructs a C<List> containing the arguments passed to the C<new> method. + +=item list + + our List sub list(*...@args) + +Constructs a C<List> containing the arguments passed to the C<list> subroutine. + =item cat our Cat multi cat ( @values ) @@ -415,6 +427,12 @@ =over +=item new + + our Array multi method new(*...@args) + +Constructs a new C<Array> containing the arguments passed to C<new>. + =item shape our Parcel method shape (@array: ) is export Added: t/spec/S32-array/create.t =================================================================== --- t/spec/S32-array/create.t (rev 0) +++ t/spec/S32-array/create.t 2010-01-19 16:34:28 UTC (rev 29558) @@ -0,0 +1,20 @@ +use v6; +use Test; + +# L<S32::Containers/"Array"/"=item "> + +=begin pod + +built-in "Array" tests + +=end pod + +plan 3; + +my $array_obj = Array.new(4, 5, 6); +is($array_obj.WHAT, Array, 'Creating a new list object with new works.'); +is($array_obj, list(4, 5, 6), 'The list object contains the right values.'); +is(+$array_obj, 3, 'Finding the length funcitons properly.'); + +# vim: ft=perl6 + Added: t/spec/S32-list/create.t =================================================================== --- t/spec/S32-list/create.t (rev 0) +++ t/spec/S32-list/create.t 2010-01-19 16:34:28 UTC (rev 29558) @@ -0,0 +1,25 @@ +use v6; +use Test; + +# L<S32::Containers/"List"/"=item "> + +=begin pod + +built-in "list" tests + +=end pod + +plan 6; + +my $list_sub = list(1, 2, 3); +is($list_sub.WHAT, List, '&list() creates a list assignable to a scalar.'); +is($list_sub, (1, 2, 3), 'The &list() function created a list.'); +is(+$list_sub, 3, 'Finding the length of the list works as expected.'); + +my $list_obj = List.new(4, 5, 6); +is($list_obj.WHAT, List, 'Creating a new list object with new works.'); +is($list_obj, list(4, 5, 6), 'The list object contains the right values.'); +is(+$list_obj, 3, 'Finding the length funcitons properly.'); + +# vim: ft=perl6 +