aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-12-08 13:44:16 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-12-08 13:44:16 +1300
commit92c0340df74323a52fa8719a92fdf7477e69009c (patch)
tree4a6b31c3ee879c32f147bfe324dfe30c5bc18257
parentMerge branch 'release/v0.10' (diff)
parentUpdate Changes for v0.11 (diff)
downloadMusic-Lyrics-LRC-92c0340df74323a52fa8719a92fdf7477e69009c.tar.gz
Music-Lyrics-LRC-92c0340df74323a52fa8719a92fdf7477e69009c.zip
Merge branch 'release/v0.11'v0.11
* release/v0.11: Update Changes for v0.11 Update README.markdown from perldoc Bump version number to 0.11 Remove doc warning about barren test suite Add new test module reqs to build requirements Add lyrics save() method test Count %tags more correctly in load test Add file load testing
-rw-r--r--Changes4
-rw-r--r--MANIFEST3
-rw-r--r--Makefile.PL4
-rw-r--r--README.markdown4
-rw-r--r--lib/Music/Lyrics/LRC.pm6
-rw-r--r--t/basic.t2
-rw-r--r--t/japh.lrc10
-rw-r--r--t/load.t37
-rw-r--r--t/save.t26
9 files changed, 87 insertions, 9 deletions
diff --git a/Changes b/Changes
index 416ac2f..75581c3 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
Revision history for Music-Lyrics-LRC
+0.11 2017-12-08
+
+ - Add basic load() and save() method tests
+
0.10 2017-12-06
- Add dependency links to documentation
diff --git a/MANIFEST b/MANIFEST
index a250116..1a2fbd9 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5,6 +5,9 @@ Makefile.PL
MANIFEST
README
t/basic.t
+t/japh.lrc
+t/load.t
+t/save.t
xt/manifest.t
xt/pod-coverage.t
xt/pod.t
diff --git a/Makefile.PL b/Makefile.PL
index cac8e48..2f35c7c 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -15,6 +15,8 @@ WriteMakefile(
'ExtUtils::MakeMaker' => '0',
},
BUILD_REQUIRES => {
+ 'English' => '0',
+ 'File::Temp' => '0',
'Test::More' => '0',
},
PREREQ_PM => {
@@ -25,7 +27,7 @@ WriteMakefile(
'meta-spec' => { version => 2 },
provides => {
'Music::Lyrics::LRC' => {
- version => '0.10',
+ version => '0.11',
file => 'lib/Music/Lyrics/LRC.pm',
},
},
diff --git a/README.markdown b/README.markdown
index 742f74e..c4d45ce 100644
--- a/README.markdown
+++ b/README.markdown
@@ -4,7 +4,7 @@ Music::Lyrics::LRC - Manipulate LRC karaoke timed lyrics files
# VERSION
-Version 0.10
+Version 0.11
# DESCRIPTION
@@ -170,8 +170,6 @@ Fractional seconds of any length can be parsed, and preserved in the
millisecond count return by `lyrics()`, but any resolution beyond 2 decimal
places is lost on `save()`.
-The test suite is skeletal, and needs a lot of fleshing out.
-
# AUTHOR
Tom Ryder `<tom@sanctum.geek.nz>`
diff --git a/lib/Music/Lyrics/LRC.pm b/lib/Music/Lyrics/LRC.pm
index 4f8d3fb..842702d 100644
--- a/lib/Music/Lyrics/LRC.pm
+++ b/lib/Music/Lyrics/LRC.pm
@@ -13,7 +13,7 @@ use Carp;
use English '-no_match_vars';
# Declare package version
-our $VERSION = '0.10';
+our $VERSION = '0.11';
# Patterns to match elements of the LRC file; these are somewhat tolerant
our %RE = (
@@ -272,7 +272,7 @@ Music::Lyrics::LRC - Manipulate LRC karaoke timed lyrics files
=head1 VERSION
-Version 0.10
+Version 0.11
=head1 DESCRIPTION
@@ -454,8 +454,6 @@ Fractional seconds of any length can be parsed, and preserved in the
millisecond count return by C<lyrics()>, but any resolution beyond 2 decimal
places is lost on C<save()>.
-The test suite is skeletal, and needs a lot of fleshing out.
-
=head1 AUTHOR
Tom Ryder C<< <tom@sanctum.geek.nz> >>
diff --git a/t/basic.t b/t/basic.t
index d849044..6092db0 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -8,7 +8,7 @@ use Test::More tests => 9;
use Music::Lyrics::LRC;
-our $VERSION = '0.10';
+our $VERSION = '0.11';
my $lrc = Music::Lyrics::LRC->new();
ok( defined $lrc, 'constructed' );
diff --git a/t/japh.lrc b/t/japh.lrc
new file mode 100644
index 0000000..83ad9e4
--- /dev/null
+++ b/t/japh.lrc
@@ -0,0 +1,10 @@
+[ar:J A Phacker]
+[ti:Just Another Perl Hacker]
+
+[01:53.53] I'm just another Perl hacker,
+this line should get skipped
+
+[01:59]And you know the world's my oyster,
+[01:56.560]Matchin' up the world.
+
+[02:02.4]And my language is its pearl.
diff --git a/t/load.t b/t/load.t
new file mode 100644
index 0000000..17242f2
--- /dev/null
+++ b/t/load.t
@@ -0,0 +1,37 @@
+#!perl -T
+
+use strict;
+use warnings;
+use utf8;
+
+use 5.006;
+
+use English qw(-no_match_vars);
+use Test::More tests => 11;
+
+use Music::Lyrics::LRC;
+
+our $VERSION = '0.11';
+
+my $lrc = Music::Lyrics::LRC->new();
+
+open my $fh, '<', 't/japh.lrc' or die "$ERRNO\n";
+ok( $lrc->load($fh), 'loaded' );
+close $fh or die "$ERRNO\n";
+
+my %tags = %{ $lrc->tags };
+ok( keys %tags == 2, 'tags_count' );
+
+my @lyrics = @{ $lrc->lyrics };
+ok( @lyrics == 4, 'lines_count' );
+
+ok( $lyrics[0]{text} eq q{I'm just another Perl hacker,}, 'line_text_1' );
+ok( $lyrics[1]{text} eq q{Matchin' up the world.}, 'line_text_2' );
+ok( $lyrics[2]{text} eq q{And you know the world's my oyster,}, 'line_text_3' );
+ok( $lyrics[3]{text} eq q{And my language is its pearl.}, 'line_text_4' );
+
+## no critic (ProhibitMagicNumbers)
+ok( $lyrics[0]{time} == 113_530, 'line_time_1' );
+ok( $lyrics[1]{time} == 116_560, 'line_time_2' );
+ok( $lyrics[2]{time} == 119_000, 'line_time_3' );
+ok( $lyrics[3]{time} == 122_400, 'line_time_4' );
diff --git a/t/save.t b/t/save.t
new file mode 100644
index 0000000..ad55df8
--- /dev/null
+++ b/t/save.t
@@ -0,0 +1,26 @@
+#!perl -T
+
+use strict;
+use warnings;
+use utf8;
+
+use 5.006;
+
+use English qw(-no_match_vars);
+use File::Temp qw(tempfile);
+use Test::More tests => 2;
+
+use Music::Lyrics::LRC;
+
+our $VERSION = '0.11';
+
+my $lrc = Music::Lyrics::LRC->new();
+$lrc->set_tag( 'foo', 'bar' );
+$lrc->add_lyric( 0, 'lalala' );
+$lrc->add_lyric( 10, 'doremi' );
+
+my ( $fh, $fn ) = tempfile();
+ok( $lrc->save($fh), 'save' );
+close $fh
+ or die "$ERRNO\n";
+ok( -s $fn == 44, 'length' ); ## no critic (ProhibitMagicNumbers)