diff options
| author | Shulhan <ms@kilabit.info> | 2019-02-21 08:35:02 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2019-02-21 09:05:46 +0700 |
| commit | 4e4fda78a2126ac78c6c0fb88040e687bfc7950e (patch) | |
| tree | dae2766f54c6d589502336bd73421cb54cf18b21 /lib/bytes/bytes_test.go | |
| parent | 47af7f937043ba3c0f5920e1642438c2d2ca257a (diff) | |
| download | pakakeh.go-4e4fda78a2126ac78c6c0fb88040e687bfc7950e.tar.xz | |
memfs: add method to dump files as Go generated source
If you familiar with go-bindata [1], this method is similar with that.
[1] github.com/shuLhan/go-bindata
Diffstat (limited to 'lib/bytes/bytes_test.go')
| -rw-r--r-- | lib/bytes/bytes_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/bytes/bytes_test.go b/lib/bytes/bytes_test.go index 2e1b3a24..5885eeb2 100644 --- a/lib/bytes/bytes_test.go +++ b/lib/bytes/bytes_test.go @@ -312,6 +312,22 @@ func TestTokenFind(t *testing.T) { testTokenFind(t, line, token, 0, exp) } +func TestInReplace(t *testing.T) { + cases := []struct { + in string + exp string + }{{ + in: "/a/path/to/file.ext", + exp: "_a_path_to_file_ext", + }} + + for _, c := range cases { + got := InReplace([]byte(c.in), []byte(ASCIILettersNumber), '_') + + test.Assert(t, "InReplace", c.exp, string(got), true) + } +} + func BenchmarkToLowerStd(b *testing.B) { randomInput256 := Random([]byte(HexaLetters), 256) |
