#!/bin/sh
set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR

# Simple test to ensure that the installed version of diet is able to
# produce working binaries.

cat > hello.c <<EOF
#include <stdio.h>

int main()
{
  puts("Hello World");
  return 0;
}
EOF
diet -Os gcc -Wall -o hello hello.c
./hello > hello.out
[ "Hello World" = "$(cat hello.out)" ]
