reference collection methods section
[catagits/DOM-Tiny.git] / t / collection.t
index 65b5647..b455ba1 100644 (file)
@@ -1,8 +1,10 @@
 use strict;
 use warnings;
 use Test::More;
-use DOM::Tiny::Collection 'c';
-use JSON::Tiny 'encode_json';
+use DOM::Tiny::_Collection;
+use JSON::PP ();
+
+sub c { DOM::Tiny::_Collection->new(@_) }
 
 # Array
 is c(1, 2, 3)->[1], 2, 'right result';
@@ -135,9 +137,9 @@ is_deeply $collection->sort(sub { $b cmp $a })->to_array, [5, 4, 2, 1],
   'right order';
 is_deeply $collection->sort(sub { $_[1] cmp $_[0] })->to_array, [5, 4, 2, 1],
   'right order';
-$collection = c(qw(Test perl Mojo));
+$collection = c(qw(Test perl DOM));
 is_deeply $collection->sort(sub { uc(shift) cmp uc(shift) })->to_array,
-  [qw(Mojo perl Test)], 'right order';
+  [qw(DOM perl Test)], 'right order';
 $collection = c();
 is_deeply $collection->sort->to_array, [], 'no elements';
 is_deeply $collection->sort(sub { $a cmp $b })->to_array, [], 'no elements';
@@ -166,6 +168,6 @@ is_deeply $collection->uniq(join => ',')->flatten->to_array, [1, 2, 2, 1],
   'right result';
 
 # TO_JSON
-is encode_json(c(1, 2, 3)), '[1,2,3]', 'right result';
+is +JSON::PP->new->convert_blessed->encode(c(1, 2, 3)), '[1,2,3]', 'right result';
 
 done_testing();