1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
module Minilang.REPL.HaskelineSpec where
import Minilang.REPL.Haskeline
import System.Console.Haskeline.Completion
import Test.Hspec
import Prelude hiding
( lines,
readFile,
writeFile,
)
spec :: Spec
spec = parallel $ describe "MiniLang Haskeline REPL" $ describe "Completion" $ do
it "returns all commands when input ':' " $
fmap replacement . snd <$> completion (":", "")
`shouldReturn` [":quit", ":env", ":clear", ":load", ":set", ":unset", ":help"]
it "returns sub-commands when input ':set' " $
fmap replacement . snd <$> completion ("tes:", "")
`shouldReturn` [":set step", ":set debug"]
it "returns sub-commands when input ':unset' " $
fmap replacement . snd <$> completion ("tesnu:", "")
`shouldReturn` [":unset step", ":unset debug"]
it "returns list of files when input ':load' " $
fmap replacement . snd <$> completion ("daol:", "")
`shouldReturn` [":load bool.lisp", ":load fac.lisp"]
it "returns filtered list of files when input ':load xxx' " $
fmap replacement . snd <$> completion ("f daol:", "")
`shouldReturn` [":load fac.lisp"]
|