update tests

This commit is contained in:
rhiannon morris 2023-09-22 18:38:32 +02:00
parent 8395bec4cb
commit bcfb0d81b8
1 changed files with 30 additions and 17 deletions

View File

@ -424,33 +424,46 @@ tests = "parser" :- [
"top level" :- [ "top level" :- [
parseMatch input "def0 A : ★⁰ = {}; def0 B : ★¹ = A;" parseMatch input "def0 A : ★⁰ = {}; def0 B : ★¹ = A;"
`([PD $ PDef $ MkPDef (PQ Zero _) "A" (Just $ TYPE 0 _) (Enum [] _) _, `([PD $ MkPDecl []
PD $ PDef $ MkPDef (PQ Zero _) "B" (Just $ TYPE 1 _) (V "A" {}) _]), (PDef $ MkPDef (PQ Zero _) "A" (Just $ TYPE 0 _) (Enum [] _) _) _,
PD $ MkPDecl []
(PDef $ MkPDef (PQ Zero _) "B" (Just $ TYPE 1 _) (V "A" {}) _) _]),
parseMatch input "def0 A : ★⁰ = {} def0 B : ★¹ = A" $ parseMatch input "def0 A : ★⁰ = {} def0 B : ★¹ = A" $
`([PD $ PDef $ MkPDef (PQ Zero _) "A" (Just $ TYPE 0 _) (Enum [] _) _, `([PD $ MkPDecl []
PD $ PDef $ MkPDef (PQ Zero _) "B" (Just $ TYPE 1 _) (V "A" {}) _]), (PDef $ MkPDef (PQ Zero _) "A" (Just $ TYPE 0 _) (Enum [] _) _) _,
PD $ MkPDecl []
(PDef $ MkPDef (PQ Zero _) "B" (Just $ TYPE 1 _) (V "A" {}) _) _]),
note "empty input", note "empty input",
parsesAs input "" [], parsesAs input "" [],
parseFails input ";;;;;;;;;;;;;;;;;;;;;;;;;;", parseFails input ";;;;;;;;;;;;;;;;;;;;;;;;;;",
parseMatch input "namespace a {}" parseMatch input "namespace a {}"
`([PD $ PNs $ MkPNamespace [< "a"] [] _]), `([PD $ MkPDecl [] (PNs $ MkPNamespace [< "a"] [] _) _]),
parseMatch input "namespace a.b.c {}" parseMatch input "namespace a.b.c {}"
`([PD $ PNs $ MkPNamespace [< "a", "b", "c"] [] _]), `([PD $ MkPDecl []
(PNs $ MkPNamespace [< "a", "b", "c"] [] _) _]),
parseMatch input "namespace a {namespace b {}}" parseMatch input "namespace a {namespace b {}}"
`([PD $ PNs $ MkPNamespace [< "a"] [PNs $ MkPNamespace [< "b"] [] _] _]), `([PD (MkPDecl []
(PNs $ MkPNamespace [< "a"]
[MkPDecl [] (PNs $ MkPNamespace [< "b"] [] _) _] _) _)]),
parseMatch input "namespace a {def x = 't ∷ {t}}" parseMatch input "namespace a {def x = 't ∷ {t}}"
`([PD $ PNs $ MkPNamespace [< "a"] `([PD (MkPDecl []
[PDef $ MkPDef (PQ Any _) "x" Nothing (PNs $ MkPNamespace [< "a"]
(Ann (Tag "t" _) (Enum ["t"] _) _) _] _]), [MkPDecl []
(PDef $ MkPDef (PQ Any _) "x" Nothing
(Ann (Tag "t" _) (Enum ["t"] _) _) _) _] _) _)]),
parseMatch input "namespace a {def x = 't ∷ {t}} def y = a.x" parseMatch input "namespace a {def x = 't ∷ {t}} def y = a.x"
`([PD $ PNs $ MkPNamespace [< "a"] `([PD (MkPDecl []
[PDef $ MkPDef (PQ Any _) "x" Nothing (PNs $ MkPNamespace [< "a"]
(Ann (Tag "t" _) (Enum ["t"] _) _) _] _, [MkPDecl []
PD $ PDef $ MkPDef (PQ Any _) "y" Nothing (PDef $ MkPDef (PQ Any _) "x" Nothing
(V (MakePName [< "a"] "x") {}) _]), (Ann (Tag "t" _) (Enum ["t"] _) _) _) _] _) _),
PD (MkPDecl []
(PDef $ MkPDef (PQ Any _) "y" Nothing
(V (MakePName [< "a"] "x") Nothing _) _) _)]),
parseMatch input #" load "a.quox"; def b = a.b "# parseMatch input #" load "a.quox"; def b = a.b "#
`([PLoad "a.quox" _, `([PLoad "a.quox" _,
PD $ PDef $ MkPDef (PQ Any _) "b" Nothing PD (MkPDecl []
(V (MakePName [< "a"] "b") {}) _]) (PDef $ MkPDef (PQ Any _) "b" Nothing
(V (MakePName [< "a"] "b") Nothing _) _) _)])
] ]
] ]