summaryrefslogtreecommitdiff
path: root/lib/custodian/parser.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-02-18 05:41:02 +0000
committerSteve Kemp <steve@steve.org.uk>2015-02-18 05:41:02 +0000
commit1fd332a69d222293581b25fb2fa892ddbccd305c (patch)
tree7c67237038fc400610005f34c0feea13043d1c1c /lib/custodian/parser.rb
parentc235dbb7ca0d09008224f80e96457bf29efcc3d3 (diff)
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.
Diffstat (limited to 'lib/custodian/parser.rb')
-rw-r--r--lib/custodian/parser.rb17
1 files changed, 16 insertions, 1 deletions
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