taglib2 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.1.5
2
+ Fix a bug when TagLib::File.new method is called with a second argument
3
+ Migrate to minitest (tests are now supported for ruby 1.9).
4
+
5
+ # 0.1.4
6
+ Fix a segfault (when BadPath exception is raised)
1
7
  Add tests files in gem package
2
8
 
3
9
  # 0.1.3
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  =begin
3
- Copyright 2010 Vincent Carmona
3
+ Copyright 2010-2012 Vincent Carmona
4
4
  vinc4mai+taglib@gmail.com
5
5
 
6
6
  This file is part of ruby-taglib2.
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2010-2011 Vincent Carmona
2
+ Copyright 2010-2012 Vincent Carmona
3
3
  vinc4mai+taglib@gmail.com
4
4
 
5
5
  This file is part of ruby-taglib2.
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2010 Vincent Carmona
2
+ Copyright 2010-2012 Vincent Carmona
3
3
  vinc4mai+taglib@gmail.com
4
4
 
5
5
  This file is part of ruby-taglib2.
@@ -23,5 +23,5 @@ require "taglib2.so"
23
23
 
24
24
  #:main: TagLib::File
25
25
  module TagLib
26
- VERSION=[0, 1, 4]
26
+ VERSION=[0, 1, 5]
27
27
  end
data/taglib2.c CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2010-2011 Vincent Carmona
2
+ Copyright 2010-2012 Vincent Carmona
3
3
  vinc4mai+taglib@gmail.com
4
4
 
5
5
  This file is part of ruby-taglib2.
@@ -121,7 +121,7 @@ file_init(int argc, VALUE* argv, VALUE self)
121
121
  }
122
122
  else
123
123
  {
124
- taglib_file_new_type(StringValuePtr(path), NUM2INT(type));
124
+ tgFile=taglib_file_new_type(StringValuePtr(path), NUM2INT(type));
125
125
  }
126
126
  if (tgFile==NULL)
127
127
  rb_raise(eBadFile, "Bad file");
@@ -19,10 +19,8 @@ This file is part of ruby-taglib2.
19
19
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
20
  =end
21
21
 
22
- class CompatTest < Test::Unit::TestCase
23
- @@read=TaglibTestsUtil.read
24
-
25
- def test_badpath_new
26
- assert_nothing_raised{TagLib::BadPath.new}
22
+ class BadPathTest < MiniTest::Unit::TestCase
23
+ def test_raise
24
+ assert_raises(TagLib::BadPath){raise TagLib::BadPath}
27
25
  end
28
26
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2010-2011 Vincent Carmona
2
+ Copyright 2010-2012 Vincent Carmona
3
3
  vinc4mai+taglib@gmail.com
4
4
 
5
5
  This file is part of ruby-taglib2.
@@ -19,7 +19,7 @@ This file is part of ruby-taglib2.
19
19
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
20
  =end
21
21
 
22
- class ConstantsTest < Test::Unit::TestCase
22
+ class ConstantsTest < MiniTest::Unit::TestCase
23
23
  def test_mpeg
24
24
  assert_instance_of(Fixnum, TagLib::MPEG)
25
25
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2010-2011 Vincent Carmona
2
+ Copyright 2010-2012 Vincent Carmona
3
3
  vinc4mai+taglib@gmail.com
4
4
 
5
5
  This file is part of ruby-taglib2.
@@ -19,20 +19,20 @@ This file is part of ruby-taglib2.
19
19
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
20
  =end
21
21
 
22
- class BadFileTest < Test::Unit::TestCase
23
- def test_new
24
- assert_nothing_raised{TagLib::BadFile.new}
22
+ class BadFileTest < MiniTest::Unit::TestCase
23
+ def test_raise
24
+ assert_raises(TagLib::BadFile){raise TagLib::BadFile}
25
25
  end
26
26
  end
27
27
 
28
- class BadTagTest < Test::Unit::TestCase
29
- def test_new
30
- assert_nothing_raised{TagLib::BadTag.new}
28
+ class BadTagTest < MiniTest::Unit::TestCase
29
+ def test_raise
30
+ assert_raises(TagLib::BadTag){raise TagLib::BadTag}
31
31
  end
32
32
  end
33
33
 
34
- class BadAudioPropertiesTest < Test::Unit::TestCase
35
- def test_new
36
- assert_nothing_raised{TagLib::BadAudioProperties.new}
34
+ class BadAudioPropertiesTest < MiniTest::Unit::TestCase
35
+ def test_raise
36
+ assert_raises(TagLib::BadAudioProperties){raise TagLib::BadAudioProperties}
37
37
  end
38
38
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2010-2011 Vincent Carmona
2
+ Copyright 2010-2012 Vincent Carmona
3
3
  vinc4mai+taglib@gmail.com
4
4
 
5
5
  This file is part of ruby-taglib2.
@@ -19,47 +19,50 @@ This file is part of ruby-taglib2.
19
19
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
20
  =end
21
21
 
22
- class TLFileTest < Test::Unit::TestCase
23
- @@tmp=TaglibTestsUtil.tmp
24
- @@read=TaglibTestsUtil.read
25
- @@empty=TaglibTestsUtil.empty
26
- @@write=TaglibTestsUtil.write
27
- @@exceptions=TaglibTestsUtil.exceptions
28
-
29
- def TLFileTest.suite
30
- suite=super
31
- def suite.setup
32
- TaglibTestsUtil.setup
33
- end
34
- def suite.teardown
35
- TaglibTestsUtil.teardown
36
- end
37
- suite
38
- end
22
+ class TagLibFileTest < MiniTest::Unit::TestCase
23
+ dir=File.expand_path(File.dirname(__FILE__))
24
+ tmp=File.join(dir, 'tmp')
25
+ data=File.join(dir, 'data')
26
+ READ=File.join(tmp, 'read.wav')
27
+ EMPTY=File.join(tmp, 'empty')
28
+ WRITE=File.join(tmp, 'write.wav')
29
+ EXCEPTIONS=File.join(tmp, 'exceptions.ogg')
30
+
31
+ FileUtils.mkdir(tmp)
32
+ FileUtils.copy(File.join(data, 'silence.wav'), READ)
33
+ FileUtils.copy(File.join(data, 'empty'), EMPTY)
34
+ FileUtils.copy(File.join(data, 'silence.wav'), WRITE)
35
+ FileUtils.copy(File.join(data, 'exceptions.ogg'), EXCEPTIONS)
36
+
37
+ MiniTest::Unit.after_tests{FileUtils.remove_entry_secure(tmp)}
39
38
 
40
39
  def test_new
41
- assert_nothing_raised{TagLib::File.new(@@read)}
40
+ assert_instance_of(TagLib::File, TagLib::File.new(READ))
41
+ end
42
+
43
+ def test_new2
44
+ assert_instance_of(TagLib::File, TagLib::File.new(READ, TagLib::OggVorbis))
42
45
  end
43
46
 
44
47
  def test_badfile
45
- assert_raise(TagLib::BadFile){TagLib::File.new(@@empty)}
48
+ assert_raises(TagLib::BadFile){TagLib::File.new(EMPTY)}
46
49
  end
47
50
 
48
51
  def test_badtag
49
- assert_raise(TagLib::BadTag){
50
- f=TagLib::File.new(@@exceptions)
52
+ assert_raises(TagLib::BadTag){
53
+ f=TagLib::File.new(EXCEPTIONS)
51
54
  f.title
52
55
  }
53
56
  end
54
57
 
55
58
  def test_badaudio
56
- assert_raise(TagLib::BadAudioProperties){
57
- f=TagLib::File.new(@@exceptions)
59
+ assert_raises(TagLib::BadAudioProperties){
60
+ f=TagLib::File.new(EXCEPTIONS)
58
61
  f.length
59
62
  }
60
63
  end
61
64
 
62
- def read_tag(file, tag)
65
+ def check_tag(file, tag)
63
66
  assert_equal(tag[:title], file.title)
64
67
  assert_equal(tag[:artist], file.artist)
65
68
  assert_equal(tag[:album], file.album)
@@ -69,18 +72,20 @@ class TLFileTest < Test::Unit::TestCase
69
72
  assert_equal(tag[:track], file.track)
70
73
  end
71
74
 
72
- def test_read
73
- f=TagLib::File.new(@@read)
74
- read_tag(f, {:title=>'Title', :artist=>'Artist', :album=>'Album',
75
+
76
+ def test_readtag
77
+ f=TagLib::File.new(READ)
78
+ check_tag(f, {:title=>'Title', :artist=>'Artist', :album=>'Album',
75
79
  :comment=>'Comment', :genre=>'Genre', :year=>2010, :track=>12})
76
- # assert_equal(, f.length)
77
- assert_equal(62, f.bitrate)
80
+ assert_equal(3, f.length)
81
+ assert_equal(64, f.bitrate)
78
82
  assert_equal(8000, f.samplerate)
79
83
  assert_equal(1, f.channels)
80
84
  end
81
85
 
82
86
  def test_write
83
- f=TagLib::File.new(@@write)
87
+ f=TagLib::File.new(WRITE)
88
+ assert_instance_of(TagLib::File, f)
84
89
  f.title="title"
85
90
  f.artist="artist"
86
91
  f.album="album"
@@ -88,16 +93,14 @@ class TLFileTest < Test::Unit::TestCase
88
93
  f.genre="genre"
89
94
  f.year=1020
90
95
  f.track=21
91
- f.save
92
- read_tag(TagLib::File.new(@@write), {:title=>'title', :artist=>'artist',
96
+ assert_equal(true, f.save)
97
+ check_tag(TagLib::File.new(WRITE), {:title=>'title', :artist=>'artist',
93
98
  :album=>'album', :comment=>'comment', :genre=>'genre',
94
99
  :year=>1020, :track=>21})
95
100
  end
96
-
101
+
97
102
  def test_close
98
- assert_nothing_raised{
99
- f=TagLib::File.new(@@read)
100
- f.close
101
- }
103
+ f=TagLib::File.new(READ)
104
+ assert_equal(f, f.close)
102
105
  end
103
106
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2010-2011 Vincent Carmona
2
+ Copyright 2010-2012 Vincent Carmona
3
3
  vinc4mai+taglib@gmail.com
4
4
 
5
5
  This file is part of ruby-taglib2.
@@ -19,79 +19,30 @@ This file is part of ruby-taglib2.
19
19
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
20
  =end
21
21
 
22
- require "test/unit"
23
- require 'ftools'
22
+ require 'fileutils'
23
+ require 'minitest/autorun'
24
24
 
25
- class Test::Unit::TestSuite
26
- alias :old_testunit_run_for_taglib2 :run
27
- def run(result, &progress_block)
28
- setup if respond_to?(:setup)
29
- old_testunit_run_for_taglib2(result, &progress_block)
30
- teardown if respond_to?(:teardown)
31
- end
32
- end
33
-
34
- class TaglibTestsUtil
35
- dir=File.expand_path(File.dirname(__FILE__))
36
- @@tmp=File.join(dir, 'tmp')
37
- @@read=File.join(@@tmp, 'read.wav')
38
- @@empty=File.join(@@tmp, 'empty')
39
- @@write=File.join(@@tmp, 'write.wav')
40
- @@exceptions=File.join(@@tmp, 'exceptions.ogg')
41
-
42
- def TaglibTestsUtil.tmp
43
- @@tmp
44
- end
45
-
46
- def TaglibTestsUtil.read
47
- @@read
48
- end
49
-
50
- def TaglibTestsUtil.empty
51
- @@empty
52
- end
53
-
54
- def TaglibTestsUtil.write
55
- @@write
56
- end
57
-
58
- def TaglibTestsUtil.exceptions
59
- @@exceptions
60
- end
61
-
62
- def TaglibTestsUtil.clean
63
- if File.exists?(@@tmp)
64
- File.delete(*Dir.glob(File.join(@@tmp, '*')))
65
- Dir.rmdir(@@tmp)
66
- end
67
- end
68
-
69
- def TaglibTestsUtil.setup
70
- data=File.join(@@tmp, '..', 'data')
71
- TaglibTestsUtil.clean
72
- File.makedirs(@@tmp)
73
- File.copy(File.join(data, 'silence.wav'), @@read)
74
- File.copy(File.join(data, 'empty'), @@empty)
75
- File.copy(File.join(data, 'silence.wav'), @@write)
76
- File.copy(File.join(data, 'exceptions.ogg'), @@exceptions)
77
- end
78
-
79
- def TaglibTestsUtil.teardown
80
- TaglibTestsUtil.clean
81
- end
25
+ compat=false
26
+ if ARGV.include?('--compat')
27
+ ARGV.delete('--compat')
28
+ compat=true
82
29
  end
83
30
 
84
31
  dir=File.expand_path(File.join(File.dirname(__FILE__), ".."))
85
32
  $:.unshift(dir)
86
33
  $:.unshift(File.join(dir, 'lib'))
87
- if ARGV.include?('--compat')
88
- ARGV.delete('--compat')
34
+ if compat
89
35
  $:.unshift(File.join(dir, 'compat'))
90
36
  require 'taglib'
91
- require 'tests/compat'
92
37
  else
93
38
  require "taglib2"
94
39
  end
95
- require 'tests/constants'
96
- require 'tests/exceptions'
97
- require 'tests/file'
40
+ puts "taglib2 version #{TagLib::VERSION.join('.')}"
41
+
42
+ tests=%w(constants exceptions file)
43
+ tests << "compat" if compat
44
+ if Kernel.respond_to? :require_relative
45
+ tests.each{|test| require_relative test}
46
+ else#DEPRECATED: ruby1.8
47
+ tests.each{|test| require File.join(dir, 'tests', test)}
48
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taglib2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vincent Carmona
@@ -36,7 +36,7 @@ cert_chain:
36
36
  oxzIRXlS
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2012-01-21 00:00:00 Z
39
+ date: 2012-02-20 00:00:00 Z
40
40
  dependencies: []
41
41
 
42
42
  description:
@@ -52,12 +52,12 @@ files:
52
52
  - compat/taglib.rb
53
53
  - taglib2.c
54
54
  - extconf.rb
55
- - tests/data/silence.wav
56
55
  - tests/data/empty
57
56
  - tests/data/exceptions.ogg
57
+ - tests/data/silence.wav
58
58
  - tests/tests.rb
59
- - tests/exceptions.rb
60
59
  - tests/constants.rb
60
+ - tests/exceptions.rb
61
61
  - tests/file.rb
62
62
  - tests/compat.rb
63
63
  - ChangeLog
metadata.gz.sig CHANGED
Binary file