mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 00:10:47 +08:00
v3 parser: fix model tests when no structs returned
This commit is contained in:
parent
be1624ca9f
commit
1c9a52463b
@ -43,6 +43,10 @@ func pkgAlias(fullPkg string) string {
|
||||
}
|
||||
|
||||
func GenerateModels(models map[packagePath]map[structName]*StructDef) (string, error) {
|
||||
if models == nil {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
var buffer bytes.Buffer
|
||||
buffer.WriteString(modelsHeader)
|
||||
|
||||
|
@ -15,7 +15,7 @@ func TestGenerateModels(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
"testdata/function_single",
|
||||
getFile("testdata/function_single/models.ts"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"testdata/function_from_imported_package",
|
||||
@ -23,11 +23,11 @@ func TestGenerateModels(t *testing.T) {
|
||||
},
|
||||
{
|
||||
"testdata/variable_single",
|
||||
getFile("testdata/variable_single/models.ts"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"testdata/variable_single_from_function",
|
||||
getFile("testdata/variable_single_from_function/models.ts"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"testdata/variable_single_from_other_function",
|
||||
@ -39,7 +39,7 @@ func TestGenerateModels(t *testing.T) {
|
||||
},
|
||||
{
|
||||
"testdata/struct_literal_multiple",
|
||||
getFile("testdata/struct_literal_multiple/models.ts"),
|
||||
"",
|
||||
},
|
||||
{
|
||||
"testdata/struct_literal_multiple_other",
|
||||
@ -47,7 +47,7 @@ func TestGenerateModels(t *testing.T) {
|
||||
},
|
||||
{
|
||||
"testdata/struct_literal_multiple_files",
|
||||
getFile("testdata/struct_literal_multiple_files/models.ts"),
|
||||
"",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
Loading…
Reference in New Issue
Block a user