projects
/
ruby-vorbistagger.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Relaxed rules for Ogg::Vorbis::Comments#merge!.
[ruby-vorbistagger.git]
/
test
/
test_main.rb
diff --git
a/test/test_main.rb
b/test/test_main.rb
index 6da6d6dd556d90920819c3fa914d3032b89f428c..fe622e674a70fd2e1517f595023c40ffc370b04f 100644
(file)
--- a/
test/test_main.rb
+++ b/
test/test_main.rb
@@
-77,6
+77,16
@@
class MainTest < Test::Unit::TestCase
end
end
end
end
+ def test_write_keeps_file_mode
+ mode = File.stat(OGG_FILE).mode
+
+ Ogg::Vorbis::Tagger.open(OGG_FILE) do |t|
+ t.write
+ end
+
+ assert_equal(mode, File.stat(OGG_FILE).mode)
+ end
+
def test_append
Ogg::Vorbis::Tagger.open(OGG_FILE) do |t|
t.comments["genre"] = "Death Metal"
def test_append
Ogg::Vorbis::Tagger.open(OGG_FILE) do |t|
t.comments["genre"] = "Death Metal"
@@
-240,6
+250,14
@@
EOF
end
end
end
end
+ def test_merge_bad_arg
+ Ogg::Vorbis::Tagger.open(OGG_FILE) do |t|
+ assert_raises(ArgumentError) do
+ t.comments.merge!(42)
+ end
+ end
+ end
+
def test_shift
Ogg::Vorbis::Tagger.open(OGG_FILE) do |t|
assert_equal(["artist", "Bolt Thrower"], t.comments.shift)
def test_shift
Ogg::Vorbis::Tagger.open(OGG_FILE) do |t|
assert_equal(["artist", "Bolt Thrower"], t.comments.shift)
@@
-253,6
+271,21
@@
EOF
Ogg::Vorbis::Tagger.new(OGG_FILE).close
end
Ogg::Vorbis::Tagger.new(OGG_FILE).close
end
+ def test_close2
+ t = Ogg::Vorbis::Tagger.new(OGG_FILE)
+ t.close
+
+ assert_raise(Ogg::Vorbis::Tagger::ClosedStreamError) do
+ t.close
+ end
+
+ assert_raise(Ogg::Vorbis::Tagger::ClosedStreamError) do
+ Ogg::Vorbis::Tagger.open(OGG_FILE) do |t|
+ t.close
+ end
+ end
+ end
+
def test_open_non_existing_file
assert_raises(Ogg::Vorbis::Tagger::OpenError) do
Ogg::Vorbis::Tagger.new("foo.bar")
def test_open_non_existing_file
assert_raises(Ogg::Vorbis::Tagger::OpenError) do
Ogg::Vorbis::Tagger.new("foo.bar")
@@
-270,4
+303,9
@@
EOF
ensure
FileUtils.rm_f("test/foo.bar")
end
ensure
FileUtils.rm_f("test/foo.bar")
end
+
+ def test_standalone_comments_object
+ o = Ogg::Vorbis::Comments.new
+ assert_equal(o.length, 0);
+ end
end
end