From 4582ce60603c57c6b75b73d590d93f443acda96a Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 5 Oct 2025 00:43:39 +0530 Subject: Add configuration (keymap) loading from toml file --- specs/Specs/FooSpec.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'specs/Specs') diff --git a/specs/Specs/FooSpec.hs b/specs/Specs/FooSpec.hs index 4c5f640..3260ca9 100644 --- a/specs/Specs/FooSpec.hs +++ b/specs/Specs/FooSpec.hs @@ -1,6 +1,7 @@ module Specs.FooSpec where import Daffm.Action.Commands (parseCommand) +import Daffm.Configuration (parseKey) import Daffm.Event (matchKeySequence) import Daffm.Types import qualified Data.Map as Map @@ -75,3 +76,10 @@ test = do parseCommand "cmdline-set hello" `shouldBe` Just (CmdSetCmdline "hello") parseCommand "cmdline-set" `shouldBe` Just (CmdSetCmdline "") parseCommand "cmdline-set somespaces " `shouldBe` Just (CmdSetCmdline "somespaces ") + + describe "parseKey" $ do + context "when given keys" $ do + it "parses correctly" $ do + parseKey "gdl" `shouldBe` Just [K.KChar 'g', K.KChar 'd', K.KChar 'l'] + parseKey "g" `shouldBe` Just [K.KChar '\t', K.KChar 'g', K.KEnter] + parseKey "22" `shouldBe` Just [K.KEsc, K.KChar '2', K.KChar '2'] -- cgit v1.3.1