Reorganize tests into a real spec suite

This commit is contained in:
2024-08-04 19:18:43 -03:00
parent 57c160173c
commit e7c2053222
693 changed files with 136 additions and 116 deletions

View File

@ -0,0 +1,6 @@
---input---
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
---tokens---
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' Text
'\n' Text.Whitespace

View File

@ -0,0 +1,54 @@
---input---
constraint foo, bar {
:name "myrule"
rule (odd X) \ (even X) | true <=> fail.
}
rule. % not a kwd
---tokens---
'constraint' Keyword.Declaration
' ' Text.Whitespace
'foo, bar ' Name.Function
'{' Text
'\n\n ' Text.Whitespace
':name' Keyword.Mode
' ' Text.Whitespace
'"' Literal.String.Double
'myrule' Literal.String.Double
'"' Literal.String.Double
'\n ' Text.Whitespace
'rule' Keyword.Declaration
' ' Text.Whitespace
'(' Text
'odd' Text
' ' Text.Whitespace
'X' Name.Variable
')' Operator
' ' Text.Whitespace
'\\' Keyword.Declaration
' ' Text.Whitespace
'(' Text
'even' Text
' ' Text.Whitespace
'X' Name.Variable
')' Operator
' ' Text.Whitespace
'|' Keyword.Declaration
' ' Text.Whitespace
'true' Text
' ' Text.Whitespace
'<=>' Keyword.Declaration
' ' Text.Whitespace
'fail' Text
'.' Operator
'\n\n' Text.Whitespace
'}' Text
'\n' Text.Whitespace
'rule' Text
'.' Operator
' ' Text.Whitespace
'% not a kwd\n' Comment

View File

@ -0,0 +1,67 @@
---input---
true.
stop :- !.
of (fun F) :- pi x\ of x => of (F x).
match (uvar as Y) :- print Y.
---tokens---
'true' Text
'.' Operator
'\n' Text.Whitespace
'stop' Text
' ' Text.Whitespace
':-' Keyword.Declaration
' ' Text.Whitespace
'!' Keyword.Declaration
'.' Operator
'\n' Text.Whitespace
'of' Text
' ' Text.Whitespace
'(' Text
'fun' Text
' ' Text.Whitespace
'F' Name.Variable
')' Operator
' ' Text.Whitespace
':-' Keyword.Declaration
' ' Text.Whitespace
'pi' Keyword.Declaration
' ' Text.Whitespace
'x' Name.Variable
'\\' Text
' ' Text.Whitespace
'of' Text
' ' Text.Whitespace
'x' Text
' ' Text.Whitespace
'=>' Keyword.Declaration
' ' Text.Whitespace
'of' Text
' ' Text.Whitespace
'(' Text
'F' Name.Variable
' ' Text.Whitespace
'x' Text
')' Operator
'.' Operator
'\n' Text.Whitespace
'match' Text
' ' Text.Whitespace
'(' Text
'uvar' Keyword.Declaration
' ' Text.Whitespace
'as' Keyword.Declaration
' ' Text.Whitespace
'Y' Name.Variable
')' Operator
' ' Text.Whitespace
':-' Keyword.Declaration
' ' Text.Whitespace
'print' Text
' ' Text.Whitespace
'Y' Name.Variable
'.' Operator
'\n' Text.Whitespace

View File

@ -0,0 +1,35 @@
---input---
namespace foo.bar {
baz :- std.do! [].
}
shorten foo. { bar }.
---tokens---
'namespace' Keyword.Declaration
' ' Text.Whitespace
'foo.bar' Text
' ' Text.Whitespace
'{\n' Text
' ' Text.Whitespace
'baz' Text
' ' Text.Whitespace
':-' Keyword.Declaration
' ' Text.Whitespace
'std.do!' Text
' ' Text.Whitespace
'[]' Keyword.Declaration
'.' Operator
'\n' Text.Whitespace
'}\n' Text
'shorten' Keyword.Declaration
' ' Text.Whitespace
'foo.' Text
' ' Text.Whitespace
'{ ' Text
'bar' Text
' ' Text.Whitespace
'}.' Text
'\n' Text.Whitespace

View File

@ -0,0 +1,60 @@
---input---
pred p1.
pred p2 i:int, o:list A.
pred p3 i:(bool -> prop).
:index(_ 2) pred p4 i:int, i:A.
---tokens---
'pred' Keyword.Declaration
' ' Text.Whitespace
'p1' Name.Function
'.' Text
'\n' Text.Whitespace
'pred' Keyword.Declaration
' ' Text.Whitespace
'p2' Name.Function
' ' Text.Whitespace
'i:' Keyword.Mode
'int' Keyword.Type
',' Text
' ' Text.Whitespace
'o:' Keyword.Mode
'list' Keyword.Type
' ' Text.Whitespace
'A' Keyword.Type
'.' Text
'\n' Text.Whitespace
'pred' Keyword.Declaration
' ' Text.Whitespace
'p3' Name.Function
' ' Text.Whitespace
'i:' Keyword.Mode
'(' Keyword.Type
'bool' Keyword.Type
' ' Text.Whitespace
'->' Keyword.Type
' ' Text.Whitespace
'prop' Keyword.Type
')' Keyword.Type
'.' Text
'\n' Text.Whitespace
':index' Keyword.Mode
'(' Text.Whitespace
'_ 2' Literal.Number.Integer
')' Text
' ' Text.Whitespace
'pred' Keyword.Declaration
' ' Text.Whitespace
'p4' Name.Function
' ' Text.Whitespace
'i:' Keyword.Mode
'int' Keyword.Type
',' Text
' ' Text.Whitespace
'i:' Keyword.Mode
'A' Keyword.Type
'.' Text
'\n' Text.Whitespace

View File

@ -0,0 +1,33 @@
---input---
tc {{ Eq lp:A }} {{ f lp:B l } }} :- foo A B.
---tokens---
'tc' Text
' ' Text.Whitespace
'{{' Punctuation
' Eq ' Text
'lp:' Keyword
'A' Name.Variable
' ' Text
'}}' Punctuation
' ' Text.Whitespace
'{{' Punctuation
' f ' Text
'lp:' Keyword
'B' Name.Variable
' ' Text
'l' Text
' ' Text
'}' Text
' ' Text
'}}' Punctuation
' ' Text.Whitespace
':-' Keyword.Declaration
' ' Text.Whitespace
'foo' Text
' ' Text.Whitespace
'A' Name.Variable
' ' Text.Whitespace
'B' Name.Variable
'.' Operator
'\n' Text.Whitespace

View File

@ -0,0 +1,112 @@
---input---
kind list type -> type.
type nil list A.
type cons A -> list A -> list A.
kind tm type.
type fun (tm -> tm) -> tm.
type app tm -> tm -> tm.
pred foo i:(tm -> tm), o:tm.
---tokens---
'kind' Keyword.Declaration
' ' Text.Whitespace
'list' Name.Function
' ' Text.Whitespace
'type' Keyword.Type
' ' Text.Whitespace
'->' Keyword.Type
' ' Text.Whitespace
'type' Keyword.Type
'.' Text
'\n' Text.Whitespace
'type' Keyword.Declaration
' ' Text.Whitespace
'nil' Name.Function
' ' Text.Whitespace
'list' Keyword.Type
' ' Text.Whitespace
'A' Keyword.Type
'.' Text
'\n' Text.Whitespace
'type' Keyword.Declaration
' ' Text.Whitespace
'cons' Name.Function
' ' Text.Whitespace
'A' Keyword.Type
' ' Text.Whitespace
'->' Keyword.Type
' ' Text.Whitespace
'list' Keyword.Type
' ' Text.Whitespace
'A' Keyword.Type
' ' Text.Whitespace
'->' Keyword.Type
' ' Text.Whitespace
'list' Keyword.Type
' ' Text.Whitespace
'A' Keyword.Type
'.' Text
'\n' Text.Whitespace
'kind' Keyword.Declaration
' ' Text.Whitespace
'tm' Name.Function
' ' Text.Whitespace
'type' Keyword.Type
'.' Text
'\n' Text.Whitespace
'type' Keyword.Declaration
' ' Text.Whitespace
'fun' Name.Function
' ' Text.Whitespace
'(' Keyword.Type
'tm' Keyword.Type
' ' Text.Whitespace
'->' Keyword.Type
' ' Text.Whitespace
'tm' Keyword.Type
')' Keyword.Type
' ' Text.Whitespace
'->' Keyword.Type
' ' Text.Whitespace
'tm' Keyword.Type
'.' Text
'\n' Text.Whitespace
'type' Keyword.Declaration
' ' Text.Whitespace
'app' Name.Function
' ' Text.Whitespace
'tm' Keyword.Type
' ' Text.Whitespace
'->' Keyword.Type
' ' Text.Whitespace
'tm' Keyword.Type
' ' Text.Whitespace
'->' Keyword.Type
' ' Text.Whitespace
'tm' Keyword.Type
'.' Text
'\n' Text.Whitespace
'pred' Keyword.Declaration
' ' Text.Whitespace
'foo' Name.Function
' ' Text.Whitespace
'i:' Keyword.Mode
'(' Keyword.Type
'tm' Keyword.Type
' ' Text.Whitespace
'->' Keyword.Type
' ' Text.Whitespace
'tm' Keyword.Type
')' Keyword.Type
',' Text
' ' Text.Whitespace
'o:' Keyword.Mode
'tm' Keyword.Type
'.' Text
'\n' Text.Whitespace