#!/bin/sh
# Copyright (C) 2017 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
/*
 foo
 */
int bar();
EOF

#this is the SOURCE file in the prepend command
src=`mktemp $builddir/licensing.XXXXXX`
cat << EOF > $src
/*
 foo
 */
EOF

#this is the DEST file in the prepend command
dst=`mktemp $builddir/licensing.XXXXXX`
cat << EOF > $dst
int bar();
EOF

#generating our results
$licensing prepend $src $dst --no-backup --quiet
cat $dst

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

#cleanup
rm $expected
rm $src
rm $dst

exit $retval
