TestBasicFunc
This commit is contained in:
@@ -79,7 +79,7 @@ source_filename = "foo/bar"
|
||||
`)
|
||||
}
|
||||
|
||||
func TestFunc(t *testing.T) {
|
||||
func TestDeclFunc(t *testing.T) {
|
||||
prog := NewProgram(nil)
|
||||
pkg := prog.NewPackage("bar", "foo/bar")
|
||||
params := types.NewTuple(types.NewVar(0, nil, "a", types.Typ[types.Int]))
|
||||
@@ -91,3 +91,19 @@ source_filename = "foo/bar"
|
||||
declare void @fn(i64)
|
||||
`)
|
||||
}
|
||||
|
||||
func TestBasicFunc(t *testing.T) {
|
||||
prog := NewProgram(nil)
|
||||
pkg := prog.NewPackage("bar", "foo/bar")
|
||||
rets := types.NewTuple(types.NewVar(0, nil, "a", types.Typ[types.Int]))
|
||||
sig := types.NewSignatureType(nil, nil, nil, nil, rets, false)
|
||||
b := pkg.NewFunc("fn", sig).MakeBody("")
|
||||
b.Return(prog.Val(1))
|
||||
assertPkg(t, pkg, `; ModuleID = 'foo/bar'
|
||||
source_filename = "foo/bar"
|
||||
|
||||
define i64 @fn() {
|
||||
ret i64 1
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user