ebiten: Add returning values for tests

This commit is contained in:
Hajime Hoshi 2020-09-06 21:30:01 +09:00
parent 850303b770
commit 36179636d1

View File

@ -187,6 +187,7 @@ func TestShaderNoNewVariables(t *testing.T) {
func Fragment(position vec4, texCoord vec2, color vec4) vec4 { func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
_ := 1 _ := 1
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")
@ -196,6 +197,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
func Fragment(position vec4, texCoord vec2, color vec4) vec4 { func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
_, _ := 1, 1 _, _ := 1, 1
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")
@ -209,6 +211,7 @@ func Foo() (int, int) {
func Fragment(position vec4, texCoord vec2, color vec4) vec4 { func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
_, _ := Foo() _, _ := Foo()
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")
@ -219,6 +222,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
func Fragment(position vec4, texCoord vec2, color vec4) vec4 { func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
a, _ := 1, 1 a, _ := 1, 1
_ = a _ = a
return vec4(0)
} }
`)); err != nil { `)); err != nil {
t.Errorf("error must be nil but non-nil: %v", err) t.Errorf("error must be nil but non-nil: %v", err)
@ -229,6 +233,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
func Fragment(position vec4, texCoord vec2, color vec4) vec4 { func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
_, a := 1, 1 _, a := 1, 1
_ = a _ = a
return vec4(0)
} }
`)); err != nil { `)); err != nil {
t.Errorf("error must be nil but non-nil: %v", err) t.Errorf("error must be nil but non-nil: %v", err)