#!/bin/sh
# Copyright (C) 2014 Ben Asselstine
# 
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.  This file is offered as-is,
# without any warranty.

#here is what we expect
expected=`mktemp $builddir/licensing.XXXXXX`
cat << EOF > $expected
{Copyright (C) 2014 Foo Bar <foo@bar.org>                               }
{                                                                           }
{This file is free software: you may copy, redistribute and/or modify it    }
{under the terms of the GNU Affero General Public License as published by   }
{the Free Software Foundation, either version 3 of the License, or (at your }
EOF

tmpdir=`mktemp -d $builddir/licensing.XXXXXX`
cat << EOF > $tmpdir/tmp.pas
{Copyright (C) 2014 Foo Bar <foo@bar.org>                               }
{                                                                           }
{This file is free software: you may copy, redistribute and/or modify it    }
{under the terms of the GNU Affero General Public License as published by   }
{the Free Software Foundation, either version 3 of the License, or (at your }
const
   VMax    = 95;     { Verbs   }
type
   Str1    = string[1];

EOF
#generating our results
$licensing boilerplate --quiet $tmpdir/tmp.pas

#0004.log is simultaneously created as this script runs.
diff -uNrd $expected $builddir/0004.log
retval=$?

#cleanup
rm $expected
rm $tmpdir/tmp.pas
rmdir $tmpdir
exit $retval
