mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
ebiten: Refactor tests
This commit is contained in:
parent
8336cb6007
commit
557b321086
@ -116,55 +116,51 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestShaderShadowing(t *testing.T) {
|
func TestShaderShadowing(t *testing.T) {
|
||||||
_, err := NewShader([]byte(`package main
|
if _, err := NewShader([]byte(`package main
|
||||||
|
|
||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
var position vec4
|
var position vec4
|
||||||
return position
|
return position
|
||||||
}
|
}
|
||||||
`))
|
`)); err == nil {
|
||||||
if err == nil {
|
|
||||||
t.Errorf("error must be non-nil but was nil")
|
t.Errorf("error must be non-nil but was nil")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestShaderDuplicatedVariables(t *testing.T) {
|
func TestShaderDuplicatedVariables(t *testing.T) {
|
||||||
_, err := NewShader([]byte(`package main
|
if _, err := NewShader([]byte(`package main
|
||||||
|
|
||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
var foo vec4
|
var foo vec4
|
||||||
var foo vec4
|
var foo vec4
|
||||||
return foo
|
return foo
|
||||||
}
|
}
|
||||||
`))
|
`)); err == nil {
|
||||||
if err == nil {
|
|
||||||
t.Errorf("error must be non-nil but was nil")
|
t.Errorf("error must be non-nil but was nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = NewShader([]byte(`package main
|
if _, err := NewShader([]byte(`package main
|
||||||
|
|
||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
var foo, foo vec4
|
var foo, foo vec4
|
||||||
return foo
|
return foo
|
||||||
}
|
}
|
||||||
`))
|
`)); err == nil {
|
||||||
if err == nil {
|
|
||||||
t.Errorf("error must be non-nil but was nil")
|
t.Errorf("error must be non-nil but was nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = NewShader([]byte(`package main
|
if _, err := NewShader([]byte(`package main
|
||||||
|
|
||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
var foo vec4
|
var foo vec4
|
||||||
foo := vec4(0)
|
foo := vec4(0)
|
||||||
return foo
|
return foo
|
||||||
}
|
}
|
||||||
`))
|
`)); err == nil {
|
||||||
if err == nil {
|
|
||||||
t.Errorf("error must be non-nil but was nil")
|
t.Errorf("error must be non-nil but was nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = NewShader([]byte(`package main
|
if _, err := NewShader([]byte(`package main
|
||||||
|
|
||||||
func Foo() (vec4, vec4) {
|
func Foo() (vec4, vec4) {
|
||||||
return vec4(0), vec4(0)
|
return vec4(0), vec4(0)
|
||||||
@ -174,8 +170,7 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
foo, foo := Foo()
|
foo, foo := Foo()
|
||||||
return foo
|
return foo
|
||||||
}
|
}
|
||||||
`))
|
`)); err == nil {
|
||||||
if err == nil {
|
|
||||||
t.Errorf("error must be non-nil but was nil")
|
t.Errorf("error must be non-nil but was nil")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user