From 382132a84fa3aaf752150a4d6a881dbb8b71fa66 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Wed, 18 Feb 2015 05:41:02 +0000 Subject: Correctly parse tests with multiple implementation-types. We now parse a single test-definition into multiple test-implementations. This isn't required here because the parser only needs to know that the configuration file *can* be parsed, not what the result is. Validate that we got an array, but otherwise ignore the results after the first. --- lib/custodian/parser.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'lib/custodian') diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb index d32b9c9..fb35cd5 100644 --- a/lib/custodian/parser.rb +++ b/lib/custodian/parser.rb @@ -337,8 +337,23 @@ module Custodian job = nil begin + + # + # We need to parse the job with the class-factory + # + # BUT the key thing here is that the line is parseable, + # not that we care about the result of that parsing. + # + # The result of the parsing will be an array and if so + # we just need to store the first job. Since it is duplicated + # if there are multiple handlers and we should always have one - + # or an unknown job-type of course! + # job = Custodian::TestFactory.create( macro_expanded ) - ret.push( job ) + + if ( job && ( job.kind_of? Array ) ) + ret.push( job[0].to_s ) + end rescue => ex raise ArgumentError, "Parsing a line to a protocol test gave the error: #{ex}" return nil -- cgit v1.2.1