Add parser tests for constants

This commit is contained in:
Sasha Koshka 2024-04-03 13:32:26 -04:00
parent 7d8378f7d8
commit d568d5efef
1 changed files with 15 additions and 2 deletions

View File

@ -11,7 +11,11 @@ testString (test,
- Union: (| Int F64 *:U8 (. x:Int y:Int))
- Array: 16:16:16:Int
- StructArray: 31:24:340920:(. x:Int y:Int)
- String: *:U8`,
- String: *:U8
+ FileDescriptor: I32
| stdin 0
| stdout 1
| stderr 2`,
// input
`
BasicInt: Int
@ -29,6 +33,10 @@ StructArray: 31:24:340920:(.
x:Int
y:Int)
String: *:U8
+ FileDescriptor: I32
| stdin 0
| stdout 1
| stderr 2
`)
}
@ -75,7 +83,8 @@ testString (test,
- [for s:String] = for i:Index e:Byte in str if [> i 3] then [break e]
- [for s:String] = for e:Byte in s [break e]
- [matchToInt u:(| Int F64)]:Int = match u | u:Int u | u:F64 [~ Int u] * 0
- [switch x:Int] = switch x | 0 5 | 1 4 | 2 3 * 0`,
- [switch x:Int] = switch x | 0 5 | 1 4 | 2 3 * 0
- [whatFile fd:FD]:String = switch fd | FD.stdin 'in' | FD.stdout 'out' * '?'`,
// input
`
[var] = sdfdf
@ -134,6 +143,10 @@ testString (test,
| 1 4
| 2 3
* 0
[whatFile fd:FD]:String = switch fd
| FD.stdin 'in'
| FD.stdout 'out'
* '?'
`)
}