1#
2# One of the problems that we can encounter involves trying to typedef a struct
3# that has an error in it. The problem here is that we actually create the type
4# itself for the struct before we add members. So what we need is something that
5# will fail validation. So here we go!
6#
7
8TMPFILE="$(mktemp -p /tmp mtest.XXXXXX)"
9if [[ -z "$TMPFILE" ]]; then
10	echo "Failed to get a temp file" 2>&1
11	exit 1
12fi
13
14$MDB <<EOF
15::typedef "struct foo { int r; }" foo_t
16::typedef -l ! cat > $TMPFILE
17EOF
18
19DATA=$(cat $TMPFILE)
20rm -f $TMPFILE
21
22[[ -z $DATA ]]
23