From 16c6dc95e0203bfee9f3633a46f81a02d7dd3b7e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 31 Jan 2012 14:55:00 +0100 Subject: [PATCH] Helper method SimpleTest::test_identify for "mkvmerge --identify[-verbose]" --- tests/test-285h264_misdetected_as_mp3.rb | 11 +++-------- tests/test.d/simple_test.rb | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/tests/test-285h264_misdetected_as_mp3.rb b/tests/test-285h264_misdetected_as_mp3.rb index 8305333cc..ff5770496 100644 --- a/tests/test-285h264_misdetected_as_mp3.rb +++ b/tests/test-285h264_misdetected_as_mp3.rb @@ -1,13 +1,8 @@ #!/usr/bin/ruby -w -class T_285h264_misdetected_as_mp3 < Test - def description - "mkvmerge / h264 ES mis-detected as MP3" - end +class T_285h264_misdetected_as_mp3 < SimpleTest + describe "mkvmerge / h264 ES mis-detected as MP3" - def run - sys "../src/mkvmerge --identify-verbose data/h264/bug574.h264 > #{tmp}", 0 - hash_tmp - end + test_identify "data/h264/bug574.h264" end diff --git a/tests/test.d/simple_test.rb b/tests/test.d/simple_test.rb index 667bb1a66..a9101d689 100644 --- a/tests/test.d/simple_test.rb +++ b/tests/test.d/simple_test.rb @@ -84,6 +84,20 @@ class SimpleTest } end + def self.test_identify file, *args + options = args.extract_options! + options[:verbose] = true if options[:verbose].nil? + full_command_line = [ options[:verbose] ? "--identify-verbose" : "--identify", options[:args], file ].flatten.join(' ') + options[:name] ||= full_command_line + @@blocks[:tests] << { + :name => full_command_line, + :block => lambda { + sys "../src/mkvmerge #{full_command_line} > #{tmp}", 0 + hash_tmp + }, + } + end + def self.description @@description || fail("Class #{self.class.name} misses its description") end