#!/usr/bin/env ruby
#
# This isn't the right way to do our tests. A start, perhaps...
# 
# danbri@w3.org 
# $Id: runtests.rb,v 1.1 2002/02/28 02:09:15 danbri Exp $
#
# Note: we should use 'ruby -v' once we figure out how to remove the warnings


puts "#$0 $id$ \n"
puts "\tusage: invoke with 'postgres', 'parser', 'basic' etc to run different tests\n\n"


if ARGV.include?("parser")
  todo = `ls samples/*.squish`.split  # wrong way to get file list...
  puts "Test squish files: #{todo.inspect} \n"
  todo.each { |file| 
     puts "################################\n"
     puts "#\n##{file}\n#\n"
     puts `./squish.rb #{file} `
  }
end

# If we have a PostgreSQL database handy, filled with suitable triples
# 
if ARGV.include?("postgres")
  puts   `./squish.rb samples/test1.squish | psql codepict`
  puts   `./squish.rb samples/test2.squish | psql test1`
  puts   `./squish.rb samples/test3.squish | psql test1`
end
 

if ARGV.include?("basic")
  puts "\nRunning basic parser test: samples/test1.squish\n"
  puts `ruby ./squish.rb samples/test1.squish`
end
