Sha256: 891cc446c0bbeac64c837c06d478435bc0b3de91ca95592634189f950be85368

Contents?: true

Size: 1.18 KB

Versions: 41

Compression:

Stored size: 1.18 KB

Contents

module OrigenTesters::ATP
  module Processors
    # Makes the AST safe for Marshaling
    class Marshal < Processor
      def on_object(node)
        o = node.value
        if o.is_a?(String)
          meta = { 'Test' => o }
        elsif o.is_a?(Hash)
          meta = o
        elsif o.respond_to?(:to_meta) && o.to_meta && !o.to_meta.empty?
          meta = o.to_meta
        else
          meta = {}
        end
        # The test suite / test instance name
        meta['Test'] ||= o.try(:name)
        meta['Pattern'] ||= o.try(:pattern)
        # The test name column on IG-XL, or the name of a specific instance of a test which shares a common
        # 'Test' name with other tests
        meta['Test Name'] ||= o.try(:test_name) || o.try(:_test_name) || o.try('TestName') || meta['Test']
        # The name of the primary test that is logged by the test instance / test method, if it logs more
        # than one then this is represented by sub_test nodes
        meta['Sub Test Name'] ||= o.try(:sub_test_name) || o.try('SubTestName') || meta['Test']
        node.updated(nil, [meta])
      end

      def on_render(node)
        node.updated(nil, [node.value.to_s])
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
origen_testers-0.52.9 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.52.8 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.52.7 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.52.6 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.52.5 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.52.4 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.52.3 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.52.1 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.52.0 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.51.5 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.51.4 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.51.3 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.51.2 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.51.1 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.51.0 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.50.0 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.49.4 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.49.3 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.49.2 lib/origen_testers/atp/processors/marshal.rb
origen_testers-0.49.1 lib/origen_testers/atp/processors/marshal.rb