#!/usr/bin/env bash
# Run "jing" on the RSS 1.1 Test Suite
# Author: Sean B. Palmer, inamidst.com
# http://inamidst.com/rss1.1/test/
# http://www.thaiopensource.com/relaxng/jing.html

function result() { 
   if [[ $1 = 1 ]]
   then echo Pass: $2
   else echo FAIL: $2
   fi
}

for fn in *.rss; do
   case $fn in
      neg-ext-*) echo "# $fn: non-validatable constraint" >&2;; 
      neg-bad-*uri*) echo "# $fn: jing fails due to no XSD support" >&2;; 
      neg-*) jing -c ../schema.rnc $fn &> /dev/null; result $? $fn;;
      *) jing -c ../schema.rnc $fn &> /dev/null; result $((!$?)) $fn;;
   esac
done
