mirror of
https://github.com/safing/portbase
synced 2025-09-11 07:44:43 +00:00
Fix tests and linter warnings
This commit is contained in:
parent
7d2cd6c15d
commit
f59ad0357a
162 changed files with 668 additions and 696 deletions
|
@ -6,30 +6,30 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
genCodeTestMeta = &Meta{
|
||||
Created: time.Now().Unix(),
|
||||
Modified: time.Now().Unix(),
|
||||
Expires: time.Now().Unix(),
|
||||
Deleted: time.Now().Unix(),
|
||||
secret: true,
|
||||
cronjewel: true,
|
||||
}
|
||||
)
|
||||
var genCodeTestMeta = &Meta{
|
||||
Created: time.Now().Unix(),
|
||||
Modified: time.Now().Unix(),
|
||||
Expires: time.Now().Unix(),
|
||||
Deleted: time.Now().Unix(),
|
||||
secret: true,
|
||||
cronjewel: true,
|
||||
}
|
||||
|
||||
func TestGenCode(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
encoded, err := genCodeTestMeta.GenCodeMarshal(nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
new := &Meta{}
|
||||
_, err = new.GenCodeUnmarshal(encoded)
|
||||
newMeta := &Meta{}
|
||||
_, err = newMeta.GenCodeUnmarshal(encoded)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(genCodeTestMeta, new) {
|
||||
t.Errorf("objects are not equal, got: %v", new)
|
||||
if !reflect.DeepEqual(genCodeTestMeta, newMeta) {
|
||||
t.Errorf("objects are not equal, got: %v", newMeta)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue