mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 09:48:32 +02:00
refactor: modernize code with go fix
This commit is contained in:
@@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user