From af6072c1b4e2ba6f491b215092795c7687ea81e5 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 3 Aug 2024 19:04:53 +0900 Subject: [PATCH] internal/shader: add more tests Updates #3011 --- internal/shader/syntax_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/internal/shader/syntax_test.go b/internal/shader/syntax_test.go index f258cbd81..16bd0885b 100644 --- a/internal/shader/syntax_test.go +++ b/internal/shader/syntax_test.go @@ -4368,6 +4368,16 @@ func TestSyntaxIndex(t *testing.T) { // Issue #3011 if _, err := compileToIR([]byte(`package main +func Foo() float { + var a int + var b vec4 + return b[a] +} +`)); err == nil { + t.Error("compileToIR must return an error but did not") + } + if _, err := compileToIR([]byte(`package main + func Foo() int { var a int var b ivec4 @@ -4388,6 +4398,16 @@ func Foo() float { } if _, err := compileToIR([]byte(`package main +func Foo() float { + const a = 0 + var b vec4 + return b[a] +} +`)); err != nil { + t.Error(err) + } + if _, err := compileToIR([]byte(`package main + func Foo() int { const a = 0 var b ivec4