wails icon indicating copy to clipboard operation
wails copied to clipboard

check a.map before use a.map

Open FrankFang opened this issue 3 years ago • 1 comments

when a is a string, a.slice exists but a.map does not. So, I believe it's better to check a.map instead of a.slice before calling a.map.

FrankFang avatar Sep 12 '22 11:09 FrankFang

Thanks for the PR @FrankFang. Are you able to give a little more context or a test showing the bug, and how this fixes it? Many thanks.

leaanthony avatar Sep 12 '22 23:09 leaanthony

And I suggest to add a test case too, if possible.

0x-finch avatar Sep 16 '22 05:09 0x-finch

Newbie here. How could I run tests for wails v2?

FrankFang avatar Sep 16 '22 07:09 FrankFang

Just create a standard go test. Are you familiar with this process?

leaanthony avatar Sep 16 '22 09:09 leaanthony

I am not sure. Could you show me the commands to run tests?

❯❯❯ cd v2
❯❯❯ go test ./...
cmd/wails/internal/commands/generate/template/base/main.tmpl.go:17:12: pattern build/appicon.png: no matching files found
cmd/wails/internal/commands/initialise/templates/base/main.tmpl.go:10:12: pattern frontend/dist: no matching files found
package github.com/wailsapp/wails/v2/internal/frontend/desktop/windows
        imports github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/win32
        imports golang.org/x/sys/windows/registry: build constraints exclude all Go files in /root/go/pkg/mod/golang.org/x/[email protected]/windows/registry
package github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/go-webview2/internal/w32
        imports golang.org/x/sys/windows: build constraints exclude all Go files in /root/go/pkg/mod/golang.org/x/[email protected]/windows
❯❯❯ go test
?       github.com/wailsapp/wails/v2    [no test files]

I run these commands in WSL2 on Windows.

❯❯❯ go version
go version go1.18.5 linux/amd64

FrankFang avatar Sep 16 '22 09:09 FrankFang

Tests should work now 👍

leaanthony avatar Oct 01 '22 05:10 leaanthony

@leaanthony How could I run the tests? Could you show me the commands?

FrankFang avatar Oct 05 '22 14:10 FrankFang

go test ./... in the root directory

leaanthony avatar Oct 06 '22 06:10 leaanthony