From f21b7ca87d3bb38ff4fe0030cb557e25d7f07e30 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 27 Mar 2016 15:00:12 +0200 Subject: [PATCH] test base class: method for identifying file & returning parsed JSON --- tests/test.d/simple_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test.d/simple_test.rb b/tests/test.d/simple_test.rb index 8de583af9..df5dcbe65 100644 --- a/tests/test.d/simple_test.rb +++ b/tests/test.d/simple_test.rb @@ -236,6 +236,17 @@ class SimpleTest self.sys command, :exit_code => options[:exit_code] end + def identify_json *args + options = args.extract_options! + fail ArgumentError if args.empty? + + command = "../src/mkvmerge --identify --identification-format json --engage no_variable_data #{args.first}" + + output, _ = self.sys(command, :exit_code => options[:exit_code]) + + return JSON.load(output.join('')) + end + def info *args options = args.extract_options! fail ArgumentError if args.empty?