refactor: modernize code with go fix

This commit is contained in:
yusing
2026-02-21 13:03:21 +08:00
parent 64ffe44a2d
commit 3a7d1f8b18
12 changed files with 32 additions and 61 deletions

View File

@@ -9,10 +9,6 @@ import (
expect "github.com/yusing/goutils/testing"
)
func strPtr(s string) *string {
return &s
}
func TestOverrideItem(t *testing.T) {
a := &Item{
Alias: "foo",
@@ -20,7 +16,7 @@ func TestOverrideItem(t *testing.T) {
Show: false,
Name: "Foo",
Icon: &icons.URL{
FullURL: strPtr("/favicon.ico"),
FullURL: new("/favicon.ico"),
Source: icons.SourceRelative,
},
Category: "App",
@@ -31,7 +27,7 @@ func TestOverrideItem(t *testing.T) {
Name: "Bar",
Category: "Test",
Icon: &icons.URL{
FullURL: strPtr("@walkxcode/example.png"),
FullURL: new("@walkxcode/example.png"),
Source: icons.SourceWalkXCode,
},
}

View File

@@ -7,10 +7,6 @@ import (
expect "github.com/yusing/goutils/testing"
)
func strPtr(s string) *string {
return &s
}
func TestIconURL(t *testing.T) {
tests := []struct {
name string
@@ -22,7 +18,7 @@ func TestIconURL(t *testing.T) {
name: "absolute",
input: "http://example.com/icon.png",
wantValue: &URL{
FullURL: strPtr("http://example.com/icon.png"),
FullURL: new("http://example.com/icon.png"),
Source: SourceAbsolute,
},
},
@@ -30,7 +26,7 @@ func TestIconURL(t *testing.T) {
name: "relative",
input: "@target/icon.png",
wantValue: &URL{
FullURL: strPtr("/icon.png"),
FullURL: new("/icon.png"),
Source: SourceRelative,
},
},
@@ -38,7 +34,7 @@ func TestIconURL(t *testing.T) {
name: "relative2",
input: "/icon.png",
wantValue: &URL{
FullURL: strPtr("/icon.png"),
FullURL: new("/icon.png"),
Source: SourceRelative,
},
},