#!perl
use Cassandane::Tiny;

sub test_calendarevent_get_location_newline
    :min_version_3_1 :needs_component_jmap
{
    my ($self) = @_;
    my ($id, $ical) = $self->icalfile('location-newline');
    my $event = $self->putandget_vevent($id, $ical);
    my @locations = values(%{$event->{locations}});
    my ($maj, $min) = Cassandane::Instance->get_version();
    if ($maj == 3 && $min >= 6) {
        $self->assert_num_equals(1, scalar @locations);
        $self->assert_str_equals("xyz\nxyz", $locations[0]{name});
    }
    else {
        $self->assert_num_equals(2, scalar @locations);
        $self->assert_str_equals("xyz\nxyz", $locations[0]{name});
        $self->assert_str_equals("xyz\nxyz", $locations[1]{name});
    }
}
