Sha256: 912d6b5cd534edd290f24c612b3c8ccde3a7d149cafe146b80c72adc3e3c3f81

Contents?: true

Size: 1019 Bytes

Versions: 40

Compression:

Stored size: 1019 Bytes

Contents

require 'ast'
module OrigenTesters::ATP
  class Validator < Processor
    attr_reader :flow

    def self.testing=(value)
      @testing = value
    end

    def self.testing
      @testing
    end

    def initialize(flow)
      @flow = flow
    end

    def process(node)
      if @top_level_called
        super
      else
        @top_level_called = true
        setup
        super(node)
        unless @testing
          exit 1 if on_completion
        end
      end
    end

    # For test purposes, returns true if validation failed rather
    # than exiting the process
    def test_process(node)
      @testing = true
      process(node)
      on_completion
    end

    def setup
    end

    def error(message)
      # This is a hack to make the specs pass, for some reason RSpec
      # seems to be swallowing the Origen log output after the first
      # test that generates an error
      if Validator.testing
        puts message
      else
        Origen.log.error(message)
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

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