This commit is contained in:
Neale Pickett 2021-03-05 14:42:57 -07:00
parent 30754fa8e9
commit ff99f131ea
2 changed files with 38 additions and 2 deletions

36
cmd/mothd/testdata/cat0/2/mkpuzzle vendored Executable file
View File

@ -0,0 +1,36 @@
#! /bin/sh
fail () {
echo "ERROR: $*" 1>&2
exit 1
}
case $1:$2 in
puzzle:)
cat <<'EOT'
{
"Answers": ["answer"],
"Authors": ["neale"],
"Body": "I am a generated puzzle."
}
EOT
;;
file:moo.txt)
echo "Moo."
;;
file:*)
fail "no such file: $1"
;;
answer:moo)
echo '{"Correct":true}'
;;
answer:error)
fail "you requested an error"
;;
answer:*)
echo '{"Correct":false}'
;;
*)
fail "What is $1"
;;
esac

View File

@ -13,7 +13,7 @@ func TestTranspiler(t *testing.T) {
inv := p.Inventory()
if len(inv) != 1 {
t.Error("Wrong inventory:", inv)
} else if len(inv[0].Puzzles) != 1 {
t.Error("Wrong inventory:", inv)
} else if len(inv[0].Puzzles) != 2 {
t.Error("Wrong puzzles:", inv)
}
}