mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
test framework: sys returns both the output and the exit code
This commit is contained in:
parent
e59cecf141
commit
a0e01bd962
2
tests/test-355chapters.rb
Normal file → Executable file
2
tests/test-355chapters.rb
Normal file → Executable file
@ -14,7 +14,7 @@ end
|
||||
# Invalid files:
|
||||
invalid.sort.each do |chapters|
|
||||
test chapters do
|
||||
messages = merge "#{source} --chapters #{chapters}", :exit_code => 2
|
||||
messages, exit_code = merge("#{source} --chapters #{chapters}", :exit_code => 2)
|
||||
messages.detect { |line| /The\s+XML\s+chapter\s+file.*contains\s+an\s+error/i.match line } ? :ok : :bad
|
||||
end
|
||||
end
|
||||
|
2
tests/test-356tags.rb
Normal file → Executable file
2
tests/test-356tags.rb
Normal file → Executable file
@ -14,7 +14,7 @@ end
|
||||
# Invalid files:
|
||||
invalid.sort.each do |tags|
|
||||
test tags do
|
||||
messages = merge "--tags 0:#{tags} #{source}", :exit_code => 2
|
||||
messages, exit_code = merge("--tags 0:#{tags} #{source}", :exit_code => 2)
|
||||
messages.detect { |line| /The\s+XML\s+tag\s+file.*contains\s+an\s+error/i.match line } ? :ok : :bad
|
||||
end
|
||||
end
|
||||
|
2
tests/test-378deprecated_iso_639_2_codes.rb
Normal file → Executable file
2
tests/test-378deprecated_iso_639_2_codes.rb
Normal file → Executable file
@ -5,7 +5,7 @@ the_file = "data/mkv/deprecated-languages.mkv"
|
||||
# T_378deprecated_iso_639_2_codes
|
||||
describe "mkvmerge / handling deprecated ISO 639-2 language codes"
|
||||
test "identification" do
|
||||
identify(the_file).select { |e| /language:/.match(e) }.collect { |e| e.chomp.gsub(/.*language:(\w+).*/, '\1') }.compact.sort.join('+')
|
||||
identify(the_file)[0].select { |e| /language:/.match(e) }.collect { |e| e.chomp.gsub(/.*language:(\w+).*/, '\1') }.compact.sort.join('+')
|
||||
end
|
||||
|
||||
test_merge the_file
|
||||
|
2
tests/test-390timecode_info_on_resync.rb
Normal file → Executable file
2
tests/test-390timecode_info_on_resync.rb
Normal file → Executable file
@ -4,6 +4,6 @@
|
||||
describe 'mkvmerge / output timecodes on resync'
|
||||
|
||||
test 'data/mkv/resync-after-broken.mkv' do
|
||||
output = merge('data/mkv/resync-after-broken.mkv', :args => '--ui-language en_US').join('')
|
||||
output = merge('data/mkv/resync-after-broken.mkv', :args => '--ui-language en_US')[0].join('')
|
||||
[/last.*timecode.*before.*error/, /first.*cluster.*timecode.*resync/].collect { |re| re.match(output) ? 'ok' : 'BAD' }.join('+')
|
||||
end
|
||||
|
@ -257,9 +257,15 @@ class SimpleTest
|
||||
end
|
||||
|
||||
puts "COMMAND #{command}" if ENV['DEBUG']
|
||||
self.error "system command failed: #{command} (#{$? >> 8})" if !system(command) && (options[:exit_code] != ($? >> 8))
|
||||
|
||||
return IO.readlines(temp_file.path) if temp_file
|
||||
exit_code = 0
|
||||
if !system(command)
|
||||
exit_code = $? >> 8
|
||||
self.error "system command failed: #{command} (#{exit_code})" if options[:exit_code] != exit_code
|
||||
end
|
||||
|
||||
return IO.readlines(temp_file.path), exit_code if temp_file
|
||||
return exit_code
|
||||
end
|
||||
|
||||
def error reason
|
||||
|
Loading…
Reference in New Issue
Block a user