Group
Extension

JQ-Lite/JQ-Lite-1.38/t/sort_unique.t

use strict;
use warnings;
use Test::More;
use JQ::Lite;

my $json = q({
  "nums": [5, 3, 5, 1, 3],
  "words": ["banana", "apple", "banana", "pear"]
});

my $jq = JQ::Lite->new;

my @sorted = $jq->run_query($json, '.nums | sort');
my @unique = $jq->run_query($json, '.words | unique');

is_deeply($sorted[0], [1, 3, 3, 5, 5], 'nums sorted correctly');
is_deeply($unique[0], ['banana', 'apple', 'pear'], 'words unique');

done_testing;


Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.