diff options
Diffstat (limited to 'lambda-calcul/haskell/test/Minilang/REPL')
| -rw-r--r-- | lambda-calcul/haskell/test/Minilang/REPL/HaskelineSpec.hs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lambda-calcul/haskell/test/Minilang/REPL/HaskelineSpec.hs b/lambda-calcul/haskell/test/Minilang/REPL/HaskelineSpec.hs new file mode 100644 index 0000000..b7ca5c9 --- /dev/null +++ b/lambda-calcul/haskell/test/Minilang/REPL/HaskelineSpec.hs @@ -0,0 +1,33 @@ +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" $ do + describe "Completion" $ do + it "returns all commands when input ':' " $ do + (fmap replacement) . snd <$> completion (":", "") + `shouldReturn` [":quit", ":env", ":clear", ":load", ":set", ":unset", ":help"] + + it "returns sub-commands when input ':set' " $ do + (fmap replacement) . snd <$> completion ("tes:", "") + `shouldReturn` [":set step", ":set debug"] + + it "returns sub-commands when input ':unset' " $ do + (fmap replacement) . snd <$> completion ("tesnu:", "") + `shouldReturn` [":unset step", ":unset debug"] + + it "returns list of files when input ':load' " $ do + (fmap replacement) . snd <$> completion ("daol:", "") + `shouldReturn` [":load bool.mtt", ":load nelist.mtt", ":load vector.mtt", ":load indrec.mtt"] + + it "returns filtered list of files when input ':load xxx' " $ do + (fmap replacement) . snd <$> completion ("v daol:", "") + `shouldReturn` [":load vector.mtt"] |
