mirror of https://github.com/dirtbags/moth.git
fix test
This commit is contained in:
parent
30754fa8e9
commit
ff99f131ea
|
@ -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
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue