ebiten: Add more tests (ShaderUnmatchedArgs)

This commit is contained in:
Hajime Hoshi 2021-11-14 18:50:20 +09:00
parent 8ae6793d4d
commit d9c362bca9

View File

@ -1191,6 +1191,53 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
Foo(1)
return position
}
`)); err == nil {
t.Errorf("error must be non-nil but was nil")
}
if _, err := ebiten.NewShader([]byte(`package main
func Foo(x float) {
}
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
Foo()
return position
}
`)); err == nil {
t.Errorf("error must be non-nil but was nil")
}
if _, err := ebiten.NewShader([]byte(`package main
func Foo(x, y float) {
}
func Bar() (float, float, float) {
return 0, 1
}
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
Foo(Bar())
return position
}
`)); err == nil {
t.Errorf("error must be non-nil but was nil")
}
if _, err := ebiten.NewShader([]byte(`package main
func Foo(x, y, z float) {
}
func Bar() (float, float) {
return 0, 1
}
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
Foo(Bar())
return position
}
`)); err == nil {
t.Errorf("error must be non-nil but was nil")
}