Sha256: 1f5eba5cc57ac0baa9e75849173cfc0ac513602cb13db67da8091d4915f451a8

Contents?: true

Size: 1.97 KB

Versions: 5

Compression:

Stored size: 1.97 KB

Contents

# Spira class for manipulating test-manifest style test suites.
# Used for SWAP tests
require 'spira'
require 'rdf/n3'
require 'open-uri'

module Fixtures
  module TestCase
    class Test < RDF::Vocabulary("http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#"); end

    class Entry
      attr_accessor :debug
      attr_accessor :compare
      include Spira::Resource

      property :description,    :predicate => Test.description,   :type => XSD.string
      property :status,         :predicate => Test.status,        :type => XSD.string
      property :warning,        :predicate => Test.warning,       :type => XSD.string
      property :approval,       :predicate => Test.approval
      property :issue,          :predicate => Test.issue
      property :document,       :predicate => Test.document
      property :discussion,     :predicate => Test.discussion
      property :inputDocument,  :predicate => Test.inputDocument
      property :outputDocument, :predicate => Test.outputDocument

      def name
        subject.to_s.split("#").last
      end

      def input
        Kernel.open(self.inputDocument)
      end
      
      def output
        self.outputDocument ? Kernel.open(self.outputDocument) : ""
      end

      def information; self.description; end
      
      def inspect
        "[#{self.class.to_s} " + %w(
          subject
          description
          inputDocument
          outputDocument
        ).map {|a| v = self.send(a); "#{a}='#{v}'" if v}.compact.join(", ") +
        "]"
      end
    end

    class PositiveParserTest < Entry
      default_source :entries
      type Test.PositiveParserTest
    end

    class NegativeParserTest < Entry
      default_source :entries
      type Test.NegativeParserTest
    end
    
    class MiscellaneousTest < Entry
      default_source :entries
      type Test.MiscellaneousTest
    end

    repo = RDF::Repository.load("http://www.w3.org/2000/10/rdf-tests/rdfcore/Manifest.rdf")
    Spira.add_repository! :entries, repo
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
rdf-rdfxml-0.3.4 spec/rdf_test.rb
rdf-rdfxml-0.3.3.1 spec/rdf_test.rb
the-experimenters-rdf-rdfxml-0.3.4 spec/rdf_test.rb
the-experimenters-rdf-rdfxml-0.3.3 spec/rdf_test.rb
rdf-rdfxml-0.3.3 spec/rdf_test.rb