mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
de4ff71544
commit
ed4a7e1856
@ -565,6 +565,10 @@ func (cs *compileState) parseFunc(block *block, d *ast.FuncDecl) (function, bool
|
||||
cs.addError(d.Pos(), "function must have a name")
|
||||
return function{}, false
|
||||
}
|
||||
if d.Name.Name == "init" {
|
||||
cs.addError(d.Pos(), "init function is not implemented")
|
||||
return function{}, false
|
||||
}
|
||||
if d.Body == nil {
|
||||
cs.addError(d.Pos(), "function must have a body")
|
||||
return function{}, false
|
||||
|
@ -358,3 +358,17 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestShaderInit(t *testing.T) {
|
||||
if _, err := NewShader([]byte(`package main
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||
return vec4(0)
|
||||
}
|
||||
`)); err == nil {
|
||||
t.Errorf("error must be non-nil but was nil")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user