Sha256: 1e41d5e1fc8cd9125a046b2c879e9f5e23110583c9c68dc7447d512ffdca6d2a

Contents?: true

Size: 1.55 KB

Versions: 9

Compression:

Stored size: 1.55 KB

Contents

#!/usr/bin/env ruby -s
require 'rubygems'
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", 'lib')))
require 'rdf/n3'
require File.expand_path(File.join(File.dirname(__FILE__), "..", 'spec', 'rdfa_helper'))
require 'getoptlong'

def run_tc(tc)
  puts "run #{tc.name}"
  puts RDF::Writer.for($output_format.to_sym).buffer { |writer|
    RDF::N3::Reader.new(tc.input, :base_uri => tc.about, :strict => $strict).each do |statement|
      writer << statement
    end
  }
end

$verbose = false
$output_format = :ntriples
$strict = false
suite = "turtle"
opts = GetoptLong.new(
  ["--debug", GetoptLong::NO_ARGUMENT],
  ["--verbose", GetoptLong::NO_ARGUMENT],
  ["--quiet", GetoptLong::NO_ARGUMENT],
  ["--suite", GetoptLong::OPTIONAL_ARGUMENT],
  ["--strict", GetoptLong::NO_ARGUMENT],
  ["--format", GetoptLong::REQUIRED_ARGUMENT]
)
opts.each do |opt, arg|
  case opt
  when '--verbose' then $verbose = true
  when '--quiet' then $quiet = true
  when '--debug' then ::RDF::N3::debug = true
  when '--format' then $output_format = arg
  when '--suite' then suite = arg
  when '--strict' then $strict = true
  end
end

# Test URI and directory for different suites
TEST_PARAMS = {
  "rdfxml"  => [RDFCORE_TEST, RDFCORE_DIR],
  "cwm"  => [CWM_TEST, SWAP_DIR],
  "swap"  => [SWAP_TEST, SWAP_DIR],
  "turtle"  => [TURTLE_TEST, TURTLE_DIR],
  "turtlebad"  => [TURTLE_BAD_TEST, TURTLE_DIR],
}
test_cases = RdfHelper::TestCase.test_cases(*TEST_PARAMS[suite])

test_cases = test_cases.detect do |tc|
  next unless ARGV.empty? || ARGV.any? {|n| tc.name.match(/#{n}/)}
  run_tc(tc)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rdf-n3-0.3.4.1 script/tc
rdf-n3-0.3.4 script/tc
rdf-n3-0.3.3.1 script/tc
rdf-n3-0.3.3 script/tc
rdf-n3-0.3.1.3 script/tc
rdf-n3-0.3.1.2 script/tc
rdf-n3-0.3.1.1 script/tc
rdf-n3-0.3.1 script/tc
rdf-n3-0.3.0 script/tc