Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e0990374bb
Fetching contributors…

Cannot retrieve contributors at this time

file 44 lines (33 sloc) 1.199 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
use strict;
use warnings;

use Test::More;

use VegGuide::AlternateLinks;

my $links = VegGuide::AlternateLinks->new();
isa_ok( $links, 'VegGuide::AlternateLinks' );

$links->add(
    mime_type => 'text/foo',
    uri => '/a/uri',
    title => 'yadda',
);

my @links = $links->all();
is( scalar @links, 1, 'one link returned' );

is( $links[0]->mime_type(), 'text/foo', 'mime_type() for link object' );
is( $links[0]->uri(), '/a/uri', 'uri() for link object' );
is( $links[0]->title(), 'yadda', 'title() for link object' );

$links->add(
    mime_type => 'application/bar',
    uri => '/b/uri',
    title => 'foo',
);

@links = $links->all();
is( scalar @links, 2, 'two alternate_links returned' );

is( $links[0]->mime_type(), 'text/foo', 'mime_type() for link object' );
is( $links[0]->uri(), '/a/uri', 'uri() for first link object' );
is( $links[0]->title(), 'yadda', 'title() for first link object' );

is(
    $links[1]->mime_type(), 'application/bar',
    'mime_type() for link object'
);
is( $links[1]->uri(), '/b/uri', 'uri() for second link object' );
is( $links[1]->title(), 'foo', 'title() for second link object' );

done_testing();
Something went wrong with that request. Please try again.