From 6cc049ac3d93c302939ebde11525e84468dc542f Mon Sep 17 00:00:00 2001 From: Sean Gillespie <sean@mistersg.net> Date: Sat, 31 Dec 2016 00:20:19 -0500 Subject: [PATCH] Refactor based on static analysis --- test/Language/Lambda/EvalSpec.hs | 10 +++++----- test/Language/LambdaSpec.hs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/Language/Lambda/EvalSpec.hs b/test/Language/Lambda/EvalSpec.hs index e6f247f..bf7e41e 100644 --- a/test/Language/Lambda/EvalSpec.hs +++ b/test/Language/Lambda/EvalSpec.hs @@ -33,7 +33,7 @@ spec = do it "reduces simple applications" $ do let e1 = Abs "x" (Var "x") - e2 = (Var "y") + e2 = Var "y" betaReduce' e1 e2 `shouldBe` Var "y" it "reduces nested abstractions" $ do @@ -97,14 +97,14 @@ spec = do etaConvert expr `shouldBe` expr describe "freeVarsOf" $ do - it "Returns simple vars" $ do + it "Returns simple vars" $ freeVarsOf (Var "x") `shouldBe` ["x"] - it "Does not return bound vars" $ do + it "Does not return bound vars" $ freeVarsOf (Abs "x" (Var "x")) `shouldBe` [] - it "Returns nested simple vars" $ do + it "Returns nested simple vars" $ freeVarsOf (Abs "x" (Var "y")) `shouldBe` ["y"] - it "Returns applied simple vars" $ do + it "Returns applied simple vars" $ freeVarsOf (App (Var "x") (Var "y")) `shouldBe` ["x", "y"] diff --git a/test/Language/LambdaSpec.hs b/test/Language/LambdaSpec.hs index 36935c9..44cc67c 100644 --- a/test/Language/LambdaSpec.hs +++ b/test/Language/LambdaSpec.hs @@ -12,19 +12,19 @@ spec = do evalString "\\x. x" `shouldBe` Right (Abs "x" (Var "x")) evalString "f y" `shouldBe` Right (App (Var "f") (Var "y")) - it "reduces simple applications" $ do + it "reduces simple applications" $ evalString "(\\x .x) y" `shouldBe` Right (Var "y") - it "reduces applications with nested redexes" $ do + it "reduces applications with nested redexes" $ evalString "(\\f x. f x) (\\y. y)" `shouldBe` Right (Abs "x" (Var "x")) describe "uniques" $ do let alphabet = reverse ['a'..'z'] len = length alphabet - it "starts with plain alphabet" $ do + it "starts with plain alphabet" $ take len uniques `shouldBe` map (:[]) alphabet - it "adds index afterwards" $ do + it "adds index afterwards" $ take len (drop len uniques) `shouldBe` map (:['0']) alphabet -- GitLab