29 lines
568 B
Go
29 lines
568 B
Go
package generator
|
|
|
|
import "testing"
|
|
|
|
func TestUnitWriterInterface (test *testing.T) {
|
|
testUnits (test,
|
|
`
|
|
`,
|
|
`[sayHello writer:io::Writer] = writer.[write 'well hello their\n']
|
|
|
|
[main]: I32 'main' = {
|
|
stdout:io::File = 1
|
|
[sayHello stdout]
|
|
0
|
|
}`,
|
|
|
|
"cstdio.fspl",
|
|
`+ FileDescriptor: Int
|
|
+ [write file:FileDescriptor buffer:*Byte count:Index]: Index 'write'`,
|
|
|
|
"io.fspl",
|
|
`+ Writer: (~ [write buffer:*:Byte]: Index)
|
|
+ File: cstdio::FileDescriptor
|
|
+ File.[write buffer:*:Byte]:Index =
|
|
cstdio::[write
|
|
[~cstdio::FileDescriptor [.this]]
|
|
[~*Byte buffer] [#buffer]]`,
|
|
)}
|