-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test for cache and SafeKey
- Loading branch information
1 parent
4e074b1
commit 5d4aa62
Showing
2 changed files
with
228 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package persist | ||
|
||
import "testing" | ||
|
||
func TestSafeKey(t *testing.T) { | ||
type args struct { | ||
key string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
}{ | ||
{ | ||
"empty key", | ||
args{ | ||
key: "", | ||
}, | ||
"", | ||
}, | ||
{ | ||
"replace key", | ||
args{ | ||
key: "key123", | ||
}, | ||
"a2V5MTIz", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := SafeKey(tt.args.key); got != tt.want { | ||
t.Errorf("SafeKey() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |