mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-10 18:13:18 +01:00
parent
5b551bbf09
commit
3666920fb7
@ -128,7 +128,7 @@ func xmain() error {
|
|||||||
|
|
||||||
// Add source hashes.
|
// Add source hashes.
|
||||||
for i := range shaders[origN:] {
|
for i := range shaders[origN:] {
|
||||||
shader := &shaders[i]
|
shader := &shaders[origN+i]
|
||||||
hash, err := graphics.CalcSourceHash([]byte(shader.Source))
|
hash, err := graphics.CalcSourceHash([]byte(shader.Source))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
visitErr = err
|
visitErr = err
|
||||||
|
@ -22,6 +22,8 @@ import (
|
|||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hajimehoshi/ebiten/v2/internal/graphics"
|
||||||
)
|
)
|
||||||
|
|
||||||
func hasGoCommand() bool {
|
func hasGoCommand() bool {
|
||||||
@ -46,9 +48,10 @@ func TestRun(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type shader struct {
|
type shader struct {
|
||||||
Package string
|
Package string
|
||||||
File string
|
File string
|
||||||
Source string
|
Source string
|
||||||
|
SourceHash string
|
||||||
}
|
}
|
||||||
var shaders []shader
|
var shaders []shader
|
||||||
if err := json.Unmarshal(out, &shaders); err != nil {
|
if err := json.Unmarshal(out, &shaders); err != nil {
|
||||||
@ -70,6 +73,13 @@ func TestRun(t *testing.T) {
|
|||||||
if s.File == "" {
|
if s.File == "" {
|
||||||
t.Errorf("s.File is empty: %v", s)
|
t.Errorf("s.File is empty: %v", s)
|
||||||
}
|
}
|
||||||
|
hash, err := graphics.CalcSourceHash([]byte(s.Source))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if got, want := s.SourceHash, hash.String(); got != want {
|
||||||
|
t.Errorf("s.SourceHash: got: %q, want: %q", got, want)
|
||||||
|
}
|
||||||
if got, want := s.Source, fmt.Sprintf("shader %d", i+1); got != want {
|
if got, want := s.Source, fmt.Sprintf("shader %d", i+1); got != want {
|
||||||
t.Errorf("s.Source: got: %q, want: %q", got, want)
|
t.Errorf("s.Source: got: %q, want: %q", got, want)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user