ebiten: Add more tests of unused variables in shaders

This commit is contained in:
Hajime Hoshi 2020-09-13 22:47:00 +09:00
parent 154f86e6c1
commit 6114c2b49d

View File

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