Skip to content

Commit

Permalink
fix(gnovm): add body to testfiles to avoid crash on test parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelVallenet committed Oct 31, 2024
1 parent cf90c37 commit dd1bd94
Showing 1 changed file with 36 additions and 27 deletions.
63 changes: 36 additions & 27 deletions gnovm/memfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import (
)

func TestMemPackage_Validate(t *testing.T) {
fileA := &MemFile{
Name: "a.gno",
Body: "package test",
}
fileB := &MemFile{
Name: "b.gno",
Body: "package test",
}

t.Parallel()
tt := []struct {
name string
Expand All @@ -18,7 +27,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/demo/hey",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"",
},
Expand All @@ -27,7 +36,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/demo/hey",
Files: []*MemFile{{Name: "b.gno"}, {Name: "a.gno"}},
Files: []*MemFile{fileB, fileA},
},
"unsorted",
},
Expand All @@ -36,7 +45,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/demo/hey",
Files: []*MemFile{{Name: "a.gno"}, {Name: "a.gno"}},
Files: []*MemFile{fileA, fileA},
},
"duplicate",
},
Expand All @@ -45,7 +54,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/very/long/path",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"path length",
},
Expand All @@ -54,7 +63,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/p/path/path",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"",
},
Expand All @@ -63,7 +72,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/path/path",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"",
},
Expand All @@ -72,7 +81,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/path/_path",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"",
},
Expand All @@ -81,7 +90,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/path/path_",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"",
},
Expand All @@ -90,7 +99,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/path/p_ath",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"",
},
Expand All @@ -99,7 +108,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/path/_",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -108,7 +117,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/path/_/_",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -117,7 +126,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/path/__/path",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -126,7 +135,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/path/pa-th",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -135,7 +144,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/x/path/path",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -144,7 +153,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/p",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -153,7 +162,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/p/",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -162,7 +171,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "github.com/p/path/path",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -171,7 +180,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/p/p@th/abc/def",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -180,7 +189,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/p/p&th/abc/def",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -189,7 +198,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/p/1Path/abc/def",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -198,7 +207,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/p/PaTh/abc/def",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -207,7 +216,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/p/path//def",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -216,7 +225,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/p/path/abc/def/",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -225,7 +234,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/very/very/very/long/path",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"",
},
Expand All @@ -234,7 +243,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/very/very/very/long/p@th",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -243,7 +252,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/very/very/very/long/path/",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand All @@ -252,7 +261,7 @@ func TestMemPackage_Validate(t *testing.T) {
&MemPackage{
Name: "hey",
Path: "gno.land/r/very/very/very//long/path/",
Files: []*MemFile{{Name: "a.gno"}},
Files: []*MemFile{fileA},
},
"invalid package/realm path",
},
Expand Down

0 comments on commit dd1bd94

Please sign in to comment.