diff options
| author | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-10-28 20:14:16 +0100 |
|---|---|---|
| committer | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-10-28 20:14:16 +0100 |
| commit | 1d1f0efc7de1eaa0c8a6b503892c2f950008fde6 (patch) | |
| tree | bd2e2ea5963d8a208d302854502f580d8ffd73cb /lambda-calcul/haskell/test/Minilang/REPL/HaskelineSpec.hs | |
| parent | a210419fd60c00d011f70fb1b968031621e4c01a (diff) | |
| download | lambda-nantes-1d1f0efc7de1eaa0c8a6b503892c2f950008fde6.tar.gz | |
wip: port REPL from minilang
Diffstat (limited to 'lambda-calcul/haskell/test/Minilang/REPL/HaskelineSpec.hs')
| -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"] |
