diff options
| author | Eugen Wissner <belka@caraus.de> | 2024-08-02 00:09:57 +0300 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2024-08-02 00:09:57 +0300 |
| commit | 5f8d9abe76187669cd7d4f691a2c40db2b4c8a6f (patch) | |
| tree | 26e9f18c2b73c7533c674070f1df21e2a6ff6268 /tests/Language/Elna/NameAnalysisSpec.hs | |
| parent | d4471ca2fa765c8c4c4f1e8bec59fc0c441eb824 (diff) | |
| download | elna-5f8d9abe76187669cd7d4f691a2c40db2b4c8a6f.tar.gz | |
Require trailing semicolon for type declarations
Diffstat (limited to 'tests/Language/Elna/NameAnalysisSpec.hs')
| -rw-r--r-- | tests/Language/Elna/NameAnalysisSpec.hs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/Language/Elna/NameAnalysisSpec.hs b/tests/Language/Elna/NameAnalysisSpec.hs index c94e6c7..f0b133e 100644 --- a/tests/Language/Elna/NameAnalysisSpec.hs +++ b/tests/Language/Elna/NameAnalysisSpec.hs @@ -4,7 +4,7 @@ module Language.Elna.NameAnalysisSpec import Data.Text (Text) import Text.Megaparsec (runParser) -import Test.Hspec (Spec, describe, it, shouldBe, shouldSatisfy, pendingWith) +import Test.Hspec (Spec, describe, it, shouldBe, shouldSatisfy) import Language.Elna.NameAnalysis (Error(..), nameAnalysis) import Language.Elna.SymbolTable (Info(..), SymbolTable) import qualified Language.Elna.SymbolTable as SymbolTable @@ -19,21 +19,21 @@ nameAnalysisOnText sourceText = nameAnalysis spec :: Spec spec = describe "nameAnalysis" $ do it "adds type to the symbol table" $ do - let given = "type A = int" + let given = "type A = int;" expected = Right $ Just $ TypeInfo intType actual <- nameAnalysisOnText given actual `shouldSatisfy` (expected ==) . fmap (SymbolTable.lookup "A") it "errors when the aliased type is not defined" $ do - let given = "type A = B" + let given = "type A = B;" expected = Left $ UndefinedTypeError "B" actual <- nameAnalysisOnText given actual `shouldBe` expected it "errors if the aliased identifier is not a type" $ do - let given = "proc main() {} type A = main" + let given = "proc main() {} type A = main;" expected = Left $ UnexpectedTypeInfoError $ ProcedureInfo mempty mempty @@ -41,5 +41,9 @@ spec = describe "nameAnalysis" $ do actual `shouldBe` expected - it "replaces the alias with an equivalent base type" $ - pendingWith "Not implemented" + it "replaces the alias with an equivalent base type" $ do + let given = "type A = int; type B = A; type C = B;" + expected = Right $ Just $ TypeInfo intType + actual <- nameAnalysisOnText given + + actual `shouldSatisfy` (expected ==) . fmap (SymbolTable.lookup "C") |
