tests: utility function for reading doc type (read) version elements

This commit is contained in:
Moritz Bunkus 2018-03-10 13:49:28 +01:00
parent 83a933ac23
commit df79a16c64
3 changed files with 11 additions and 7 deletions

View File

@ -18,10 +18,8 @@ test "all versions" do
command = command.join ' '
merge command
output = info(tmp, :output => :return).join('')
type_version = /Document type version:\s+(\d+)/.match(output) ? $1 : '<undef>'
type_read_version = /Document type read version:\s+(\d+)/.match(output) ? $1 : '<undef>'
type_version, type_read_version = get_doc_type_versions(tmp)
hashes << "#{type_version}+#{type_read_version}"
end

View File

@ -19,10 +19,8 @@ test "all versions" do
command = command.join ' '
merge command
output = info(tmp, :output => :return).join('')
type_version = /Document type version:\s+(\d+)/.match(output) ? $1 : '<undef>'
type_read_version = /Document type read version:\s+(\d+)/.match(output) ? $1 : '<undef>'
type_version, type_read_version = get_doc_type_versions(tmp)
hashes << "#{type_version}+#{type_read_version}"
end

View File

@ -268,7 +268,7 @@ class SimpleTest
output = "> #{output}" unless %r{^[>\|]}.match(output)
output = '' if options[:output] == :return
command = "../src/mkvinfo --engage no_variable_data --ui-language en_US #{args.first} #{output}"
self.sys command, :exit_code => options[:exit_code], :no_result => options[:no_result]
self.sys command, :exit_code => options[:exit_code], :no_result => options[:no_result], :dont_record_command => options[:dont_record_command]
end
def extract *args
@ -360,4 +360,12 @@ class SimpleTest
end.
join("/")
end
def get_doc_type_versions file_name
output = info(file_name, :output => :return, :dont_record_command => true).join('')
type_version = /Document type version:\s+(\d+)/.match(output) ? $1 : nil
type_read_version = /Document type read version:\s+(\d+)/.match(output) ? $1 : nil
return type_version, type_read_version
end
end