require "test/unit"
require "ogg/vorbis/tagger"
require "fileutils"
+require "digest/md5"
class MainTest < Test::Unit::TestCase
OGG_FILE = "test/test.ogg"
end
end
+ def test_write_is_non_destructive
+ a = Digest::MD5.hexdigest(File.read(OGG_FILE))
+
+ Ogg::Vorbis::Tagger.open(OGG_FILE) do |t|
+ t.write
+ end
+
+ b = Digest::MD5.hexdigest(File.read(OGG_FILE))
+
+ assert_equal(a, b)
+ end
+
+ def test_multiple_writes
+ a = Digest::MD5.hexdigest(File.read(OGG_FILE))
+
+ Ogg::Vorbis::Tagger.open(OGG_FILE) do |t|
+ 1.upto(10) do
+ t.write
+ end
+ end
+
+ b = Digest::MD5.hexdigest(File.read(OGG_FILE))
+
+ assert_equal(a, b)
+ end
+
def test_write_stable_order
Ogg::Vorbis::Tagger.open(OGG_FILE) do |t|
assert_equal(3, t.write)