mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-23 11:27:50 +00:00
tests: use centralize MD5 generation functions
This commit is contained in:
parent
b0bbcc7a87
commit
0a96f4a19b
@ -10,19 +10,6 @@ class Test
|
||||
@tmp_num_mutex = Mutex.new
|
||||
@commands = Array.new
|
||||
@debug_commands = Array.new
|
||||
|
||||
# install md5 handler
|
||||
if $is_macos
|
||||
@md5 = lambda do |name|
|
||||
@debug_commands << "/sbin/md5 #{name}"
|
||||
`/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "")
|
||||
end
|
||||
else
|
||||
@md5 = lambda do |name|
|
||||
@debug_commands << "md5sum #{name}"
|
||||
`md5sum #{name}`.chomp.gsub(/\s+.*/, "")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def description
|
||||
@ -90,7 +77,7 @@ class Test
|
||||
end
|
||||
|
||||
def hash_file(name)
|
||||
@md5.call name
|
||||
md5 name
|
||||
end
|
||||
|
||||
def hash_tmp(erase = true)
|
||||
|
@ -41,14 +41,10 @@ class String
|
||||
end
|
||||
end
|
||||
|
||||
# install md5 handler
|
||||
if $is_macos
|
||||
def md5 name
|
||||
`/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "")
|
||||
end
|
||||
else
|
||||
def md5 name
|
||||
`md5sum #{name}`.chomp.gsub(/\s+.*/, "")
|
||||
def md5 name
|
||||
case
|
||||
when $is_macos then `/sbin/md5 #{name}`.chomp.gsub(/.*=\s*/, "")
|
||||
else `md5sum #{name}`.chomp.gsub(/\s+.*/, "")
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user