-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cfe528
commit 6976a86
Showing
6 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package util | ||
|
||
import "testing" | ||
|
||
func TestString(t *testing.T) { | ||
t.Parallel() | ||
tests := []struct { | ||
name string | ||
filter Filter | ||
expectErr bool | ||
}{{ | ||
name: "success ID", | ||
filter: Filter{ | ||
ID: Pointer(123), | ||
Label: "", | ||
Tags: nil, | ||
}, | ||
expectErr: false, | ||
}, { | ||
name: "success label", | ||
filter: Filter{ | ||
ID: nil, | ||
Label: "test", | ||
Tags: nil, | ||
}, | ||
expectErr: false, | ||
}, { | ||
name: "success tags", | ||
filter: Filter{ | ||
ID: nil, | ||
Label: "", | ||
Tags: []string{"testtag"}, | ||
}, | ||
expectErr: false, | ||
}, { | ||
name: "failure unmarshal", | ||
filter: Filter{ | ||
ID: nil, | ||
Label: "", | ||
Tags: []string{}, | ||
}, | ||
expectErr: true, | ||
}} | ||
for _, tt := range tests { | ||
testcase := tt | ||
t.Run(testcase.name, func(t *testing.T) { | ||
t.Parallel() | ||
_, err := testcase.filter.String() | ||
if testcase.expectErr && err != nil { | ||
t.Error("expected err but got nil") | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package version | ||
|
||
import "testing" | ||
|
||
func TestVersion(t *testing.T) { | ||
t.Parallel() | ||
vers := GetVersion() | ||
if vers != "dev" { | ||
t.Errorf("unset version should be dev, got %s", vers) | ||
} | ||
} |