#!/usr/bin/env bash
# Run "rnv" on the RSS 1.1 Test Suite
# Author: Sean B. Palmer, inamidst.com
# http://inamidst.com/rss1.1/test/
# http://ftp.davidashen.net/PreTI/RNV/

function validate() { 
   rnv -q ../schema.rnc $1 2>&1 | grep error &> /dev/null
   if [[ $? = $2 ]]
   then echo Pass: $1
   else echo FAIL: $1
   fi
}

for fn in *.rss; do
   case $fn in
      neg-ext-*) echo "# $fn: non-validatable constraint" >&2;; 
      neg-*) validate $fn 0;;
      *) validate $fn 1;;
   esac
done
