mirror of
https://github.com/wavetermdev/wails.git
synced 2026-04-22 15:26:15 -07:00
Create failing test
This commit is contained in:
@@ -103,6 +103,17 @@ func TestGenerateBindings(t *testing.T) {
|
||||
useIDs: false,
|
||||
useTypescript: true,
|
||||
},
|
||||
{
|
||||
name: "enum_from_imported_package_same_name - CallByName",
|
||||
dir: "testdata/enum_from_imported_package_same_name",
|
||||
want: map[string]map[string]string{
|
||||
"main": {
|
||||
"GreetService": getFile("testdata/enum_from_imported_package_same_name/frontend/bindings/main/GreetService.name.ts"),
|
||||
},
|
||||
},
|
||||
useIDs: false,
|
||||
useTypescript: true,
|
||||
},
|
||||
{
|
||||
name: "function_single",
|
||||
dir: "testdata/function_single",
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('../services/models').Title} servicesTitle
|
||||
*/
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
* @function Greet
|
||||
* @param name {string}
|
||||
* @param title {servicesTitle}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function Greet(name, title) {
|
||||
return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('../../../models').Title2} services2Title2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
* @function Greet
|
||||
* @param name {string}
|
||||
* @param title {Title}
|
||||
* @param title2 {services2Title2}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function Greet(name, title, title2) {
|
||||
return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('../services/models').Title} servicesTitle
|
||||
*/
|
||||
|
||||
/**
|
||||
* Greet does XYZ
|
||||
* @function Greet
|
||||
* @param name {string}
|
||||
* @param title {servicesTitle}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function Greet(name, title) {
|
||||
return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
import {Title as servicesTitle} from '../services/models';
|
||||
|
||||
// Greet does XYZ
|
||||
export async function Greet(name: string, title: servicesTitle) : Promise<string> {
|
||||
return Call.ByName("main.GreetService.Greet", name, title);
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
import {Title as servicesTitle} from '../services/models';
|
||||
|
||||
// Greet does XYZ
|
||||
export async function Greet(name: string, title: servicesTitle) : Promise<string> {
|
||||
return Call.ByID(1411160069, name, title);
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export enum Title {
|
||||
// Mister is a title
|
||||
Mister = "Mr",
|
||||
Miss = "Miss",
|
||||
Ms = "Ms",
|
||||
Mrs = "Mrs",
|
||||
Dr = "Dr",
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export const Title = {
|
||||
// Mister is a title
|
||||
Mister: "Mr",
|
||||
Miss: "Miss",
|
||||
Ms: "Ms",
|
||||
Mrs: "Mrs",
|
||||
Dr: "Dr",
|
||||
};
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export enum Title {
|
||||
// Mister is a title
|
||||
Mister = "Mr",
|
||||
Miss = "Miss",
|
||||
Ms = "Ms",
|
||||
Mrs = "Mrs",
|
||||
Dr = "Dr",
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
services2 "github.com/wailsapp/wails/v3/internal/parser/testdata/enum_from_imported_package_same_name/other/services"
|
||||
"github.com/wailsapp/wails/v3/internal/parser/testdata/enum_from_imported_package_same_name/services"
|
||||
"log"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
// GreetService is great
|
||||
type GreetService struct {
|
||||
SomeVariable int
|
||||
lowerCase string
|
||||
}
|
||||
|
||||
// Greet does XYZ
|
||||
func (*GreetService) Greet(name string, title services.Title, title2 services2.Title2) string {
|
||||
return "Hello " + title.String() + " " + name + title2.String()
|
||||
}
|
||||
|
||||
func main() {
|
||||
app := application.New(application.Options{
|
||||
Bind: []interface{}{
|
||||
&GreetService{},
|
||||
},
|
||||
})
|
||||
|
||||
app.NewWebviewWindow()
|
||||
|
||||
err := app.Run()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package services
|
||||
|
||||
type Title2 string
|
||||
|
||||
func (t Title2) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
const (
|
||||
// Mister is a title
|
||||
Mister Title2 = "Mr"
|
||||
Miss Title2 = "Miss"
|
||||
Ms Title2 = "Ms"
|
||||
Mrs Title2 = "Mrs"
|
||||
Dr Title2 = "Dr"
|
||||
)
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package services
|
||||
|
||||
type Title string
|
||||
|
||||
func (t Title) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
const (
|
||||
// Mister is a title
|
||||
Mister Title = "Mr"
|
||||
Miss Title = "Miss"
|
||||
Ms Title = "Ms"
|
||||
Mrs Title = "Mrs"
|
||||
Dr Title = "Dr"
|
||||
)
|
||||
Reference in New Issue
Block a user