Expand Gotlin language and tooling
This commit is contained in:
parent
8f4f858d86
commit
de1262b4cf
41 changed files with 6059 additions and 379 deletions
28
internal/lang/pointer_test.go
Normal file
28
internal/lang/pointer_test.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package lang
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGenerateGoAddressOfExpression(t *testing.T) {
|
||||
prog, err := Parse(`
|
||||
package demo
|
||||
|
||||
import encoding.json
|
||||
|
||||
fun decode(body: ByteSlice, target: Account) {
|
||||
json.Unmarshal(body, &target)
|
||||
}
|
||||
`)
|
||||
if err != nil {
|
||||
t.Fatalf("parse failed: %v", err)
|
||||
}
|
||||
out, err := GenerateGo(prog)
|
||||
if err != nil {
|
||||
t.Fatalf("generation failed: %v", err)
|
||||
}
|
||||
if !strings.Contains(string(out), "json.Unmarshal(body, &target)") {
|
||||
t.Fatalf("generated Go missing address-of expression:\n%s", out)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue