blob: d4bbd800d2d379f8def48a34cef2424288ed6e46 [file] [log] [blame]
Akron7dacd012020-05-27 12:18:57 +02001#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More;
5use Data::Dumper;
6use Mojo::JSON 'decode_json';
7
8require_ok 'KorAP::VirtualCorpus::Group';
9
10my $vc = KorAP::VirtualCorpus::Group->new;
11$vc->union_field('author', 'Goethe');
12$vc->union_field('author', 'Schiller');
13$vc->joint_field('author', 'Fontane');
14
15
16my $json = decode_json $vc->to_koral->to_string;
17
18is($json->{collection}->{operation}, 'operation:and');
19is($json->{collection}->{operands}->[0]->{'@type'}, 'koral:doc');
20is($json->{collection}->{operands}->[0]->{'value'}->[0], 'Goethe');
21is($json->{collection}->{operands}->[0]->{'value'}->[1], 'Schiller');
22
23done_testing;