tests: run ebml_validator after mkvpropedit if it exists

This commit is contained in:
Moritz Bunkus 2015-02-23 20:37:31 +01:00
parent 649b331c88
commit 56357aa31c
5 changed files with 18 additions and 8 deletions

2
tests/test-370propedit_attachments.rb Normal file → Executable file
View File

@ -47,7 +47,7 @@ test "several" do
commands.each do |command|
sys "cp #{src} #{work}"
hashes << hash_file(work)
propedit "#{work} #{command}"
propedit work, command
hashes << hash_file(work)
end

View File

@ -14,6 +14,6 @@ end
test "propedit" do
sys "cp #{file} #{tmp}"
propedit "#{tmp} --replace-attachment '=0:data/text/chap1.txt'"
propedit tmp, "--replace-attachment '=0:data/text/chap1.txt'"
hash_tmp
end

View File

@ -7,7 +7,7 @@ test "data/mkv/no-track-uid.mks" do
sys "cp data/mkv/no-track-uid.mks #{tmp}"
hashes << hash_tmp(false)
propedit "#{tmp} --edit track:s1 --set name=chunky-bacon"
propedit tmp, "--edit track:s1 --set name=chunky-bacon"
hashes << hash_tmp(false)
hashes.join '-'

View File

@ -248,12 +248,16 @@ class SimpleTest
self.sys command, :exit_code => options[:exit_code]
end
def propedit *args
def propedit file_name, *args
options = args.extract_options!
fail ArgumentError if args.empty?
command = "../src/mkvpropedit --engage no_variable_data #{args.first}"
self.sys command, :exit_code => options[:exit_code]
command = "../src/mkvpropedit --engage no_variable_data #{file_name} #{args.first}"
*result = self.sys command, :exit_code => options[:exit_code]
self.sys "../src/tools/ebml_validator -M #{file_name}" if FileTest.exists?("../src/tools/ebml_validator")
return *result
end
def sys *args

View File

@ -116,8 +116,14 @@ class Test
retcode = args.detect { |a| !a.is_a? String } || 0
args.reject! { |a| !a.is_a? String }
command = "../src/mkvpropedit --engage no_variable_data " + (args.size == 1 ? tmp : args.shift) + " " + args.shift
sys command, retcode
file_name = args.size == 1 ? tmp : args.shift
command = "../src/mkvpropedit --engage no_variable_data #{file_name} #{args.shift}"
*result = sys command, retcode
sys "../src/tools/ebml_validator -M #{file_name}" if FileTest.exists?("../src/tools/ebml_validator")
return *result
end
def xtr_tracks_s(*args)