Skip to content

Commit

Permalink
Merge pull request #4 from davorg-cpan/davorg/add-basic-tests
Browse files Browse the repository at this point in the history
Add some basic tests
  • Loading branch information
davorg authored Sep 9, 2024
2 parents a13f6a9 + 22440c1 commit dee6153
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
14 changes: 14 additions & 0 deletions t/basic.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use strict;
use warnings;
use Test::More tests => 3;
use App::LinkSite;

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.24 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.24 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.26 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.26 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.28 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.28 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.32 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.32 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.36 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.36 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.34 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.34 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.30 on macos-latest

Compilation failed in require

Check failure on line 4 in t/basic.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.30 on macos-latest

BEGIN failed--compilation aborted

# Test the creation of an App::LinkSite object
my $linksite = App::LinkSite->new();
isa_ok($linksite, 'App::LinkSite', 'Created an App::LinkSite object');

# Test the src method
is($linksite->src, 'src', 'src method returns "src"');

# Test the out method
is($linksite->out, 'docs', 'out method returns "docs"');
25 changes: 25 additions & 0 deletions t/link.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use strict;
use warnings;
use Test::More tests => 5;
use App::LinkSite::Link;

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.24 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.24 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.26 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.26 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.28 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.28 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.32 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.32 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.36 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.36 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.34 on ubuntu-latest

Compilation failed in require

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.34 on ubuntu-latest

BEGIN failed--compilation aborted

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.30 on macos-latest

Compilation failed in require

Check failure on line 4 in t/link.t

View workflow job for this annotation

GitHub Actions / test / Perl 5.30 on macos-latest

BEGIN failed--compilation aborted

# Test the creation of an App::LinkSite::Link object
my $link = App::LinkSite::Link->new(
title => 'Test Title',
subtitle => 'Test Subtitle',
link => 'http://example.com',
new_link => 1,
);
isa_ok($link, 'App::LinkSite::Link', 'Created an App::LinkSite::Link object');

# Test the title method
is($link->title, 'Test Title', 'title method returns "Test Title"');

# Test the subtitle method
is($link->subtitle, 'Test Subtitle', 'subtitle method returns "Test Subtitle"');

# Test the link method
is($link->link, 'http://example.com', 'link method returns "http://example.com"');

# Test the is_new method
is($link->is_new, 1, 'is_new method returns 1');
33 changes: 33 additions & 0 deletions t/site.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use strict;
use warnings;
use Test::More tests => 7;
use App::LinkSite::Site;

# Test the creation of an App::LinkSite::Site object
my $site = App::LinkSite::Site->new(
name => 'Test Name',
handle => 'Test Handle',
image => 'test_image.jpg',
desc => 'Test Description',
og_image => 'test_og_image.png',
site_url => 'http://example.com',
);
isa_ok($site, 'App::LinkSite::Site', 'Created an App::LinkSite::Site object');

# Test the name method
is($site->name, 'Test Name', 'name method returns "Test Name"');

# Test the handle method
is($site->handle, 'Test Handle', 'handle method returns "Test Handle"');

# Test the image method
is($site->image, 'test_image.jpg', 'image method returns "test_image.jpg"');

# Test the desc method
is($site->desc, 'Test Description', 'desc method returns "Test Description"');

# Test the og_image method
is($site->og_image, 'test_og_image.png', 'og_image method returns "test_og_image.png"');

# Test the site_url method
is($site->site_url, 'http://example.com', 'site_url method returns "http://example.com"');
21 changes: 21 additions & 0 deletions t/social.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use strict;
use warnings;
use Test::More tests => 4;
use App::LinkSite::Social;

# Test the creation of an App::LinkSite::Social object
my $social = App::LinkSite::Social->new(
service => 'twitter',
handle => 'test_handle',
url => 'http://example.com',
);
isa_ok($social, 'App::LinkSite::Social', 'Created an App::LinkSite::Social object');

# Test the service method
is($social->service, 'twitter', 'service method returns "twitter"');

# Test the handle method
is($social->handle, 'test_handle', 'handle method returns "test_handle"');

# Test the url method
is($social->url, 'http://example.com', 'url method returns "http://example.com"');

0 comments on commit dee6153

Please sign in to comment.