This is an automatically generated mail to inform you that tests are now available in t/spec/S32-list/sort.t
commit 307c1ab2718b1bb94c287d2b3ce1c365753f362a Author: bbkr <b...@c213334d-75ef-0310-aa23-eaa082d1ae64> Date: Fri Jul 30 16:57:13 2010 +0000 [t/spec] tests for RT #71258 Cant sort objects of a custom class, cant supply .cmp method in Rakudo git-svn-id: http://svn.pugscode.org/p...@31870 c213334d-75ef-0310-aa23-eaa082d1ae64 diff --git a/t/spec/S32-list/sort.t b/t/spec/S32-list/sort.t index 1e0d219..27205a2 100644 --- a/t/spec/S32-list/sort.t +++ b/t/spec/S32-list/sort.t @@ -1,6 +1,6 @@ use v6; use Test; -plan 31; +plan 35; # L<S32::Containers/"List"/"=item sort"> @@ -220,4 +220,37 @@ plan 31; 'sort accepts rand method'; } +# RT #71258 +{ + class RT71258_1 { }; + + my @sorted; + + lives_ok { @sorted = (RT71258_1.new, RT71258_1.new).sort }, + 'sorting by stringified class instance (name and memory address)'; + + ok ([<]...@sorted.map({.WHERE})), + 'checking sort order by class memory address'; + + class RT71258_2 { + has $.x; + method Str { $.x } + }; + + multi sub cmp(RT71258_2 $a, RT71258_2 $b) { + $a.x <=> $b.x; + } + + lives_ok { + @sorted = ( + RT71258_2.new(x => 2), + RT71258_2.new(x => 3), + RT71258_2.new(x => 1) + ).sort + }, 'sorting stringified class instance with custom cmp'; + + is ~...@sorted, '1 2 3', + 'checking sort order with custom cmp'; +} + # vim: ft=perl6