diff options
| author | Shulhan <ms@kilabit.info> | 2021-03-14 22:37:59 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2021-03-14 22:40:05 +0700 |
| commit | e7552ad0189f761875bc1c2ca3dd716d43a01e0d (patch) | |
| tree | fd68ec29d23fb9a807a7382088020e3b17d446fd /lib/bytes | |
| parent | 882727d89c8e7f9b9761009ccdca1af8c18d0a30 (diff) | |
| download | pakakeh.go-e7552ad0189f761875bc1c2ca3dd716d43a01e0d.tar.xz | |
all: refactoring the test.Assert and test.AssertBench signature
Previously, the test.Assert and test.AssertBench functions has the
boolean parameter to print the stack trace of test in case its not equal.
Since this parameter is not mandatory and its usually always set to
"true", we remove them from function signature to simplify the call
to Assert and AssertBench.
Diffstat (limited to 'lib/bytes')
| -rw-r--r-- | lib/bytes/bytes_test.go | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/bytes/bytes_test.go b/lib/bytes/bytes_test.go index 2f8df54d..a4a3ae2a 100644 --- a/lib/bytes/bytes_test.go +++ b/lib/bytes/bytes_test.go @@ -11,32 +11,32 @@ func TestConcat(t *testing.T) { var exp []byte t.Log("With one parameter") got := Concat([]byte{}) - test.Assert(t, "Concat", exp, got, true) + test.Assert(t, "Concat", exp, got) t.Log("With first parameter is empty") got = Concat([]byte{}, []byte("B")) exp = []byte("B") - test.Assert(t, "Concat", exp, got, true) + test.Assert(t, "Concat", exp, got) t.Log("With two parameters") got = Concat([]byte("A"), []byte("B")) exp = []byte("AB") - test.Assert(t, "Concat", exp, got, true) + test.Assert(t, "Concat", exp, got) t.Log("With three parameters") got = Concat([]byte("A"), []byte("B"), []byte("C")) exp = []byte("ABC") - test.Assert(t, "Concat", exp, got, true) + test.Assert(t, "Concat", exp, got) t.Log("With one parameter is string") got = Concat([]byte("A"), "B", []byte("C")) exp = []byte("ABC") - test.Assert(t, "Concat", exp, got, true) + test.Assert(t, "Concat", exp, got) t.Log("With some parameter is not []byte or string") got = Concat([]byte("A"), 1, []int{2}, []byte{}, []byte("C")) exp = []byte("AC") - test.Assert(t, "Concat", exp, got, true) + test.Assert(t, "Concat", exp, got) } func TestCutUntilToken(t *testing.T) { @@ -79,9 +79,9 @@ func TestCutUntilToken(t *testing.T) { got, idx, found := CutUntilToken(line, c.token, c.startAt, c.checkEsc) - test.Assert(t, "cut", c.exp, string(got), true) - test.Assert(t, "idx", c.expIdx, idx, true) - test.Assert(t, "found", c.expFound, found, true) + test.Assert(t, "cut", c.exp, string(got)) + test.Assert(t, "idx", c.expIdx, idx) + test.Assert(t, "found", c.expFound, found) } } @@ -118,7 +118,7 @@ func TestEncloseRemove(t *testing.T) { for _, c := range cases { got, _ := EncloseRemove(c.line, c.leftcap, c.rightcap) - test.Assert(t, "", c.exp, string(got), true) + test.Assert(t, "", c.exp, string(got)) } } @@ -158,8 +158,8 @@ func TestEncloseToken(t *testing.T) { for _, c := range cases { got, changed := EncloseToken(line, c.token, c.leftcap, c.rightcap) - test.Assert(t, "newline", c.exp, string(got), true) - test.Assert(t, "changed", c.changed, changed, true) + test.Assert(t, "newline", c.exp, string(got)) + test.Assert(t, "changed", c.changed, changed) } } @@ -192,7 +192,7 @@ func TestIsTokenAt(t *testing.T) { for _, c := range cases { got := IsTokenAt(line, c.token, c.p) - test.Assert(t, "IsTokenAt", c.exp, got, true) + test.Assert(t, "IsTokenAt", c.exp, got) } } @@ -237,8 +237,8 @@ func TestReadHexByte(t *testing.T) { got, ok := ReadHexByte(c.in, 0) - test.Assert(t, "b", c.exp, got, true) - test.Assert(t, "ok", c.expOK, ok, true) + test.Assert(t, "b", c.exp, got) + test.Assert(t, "ok", c.expOK, ok) } } @@ -254,7 +254,7 @@ func TestMergeSpaces(t *testing.T) { }} for _, c := range cases { got := MergeSpaces([]byte(c.in)) - test.Assert(t, c.in, c.exp, string(got), true) + test.Assert(t, c.in, c.exp, string(got)) } } @@ -291,8 +291,8 @@ func TestSkipAfterToken(t *testing.T) { for x, c := range cases { t.Logf("#%d\n", x) got, found := SkipAfterToken(line, c.token, c.startAt, c.checkEsc) - test.Assert(t, "Index", c.exp, got, true) - test.Assert(t, "Found", c.expFound, found, true) + test.Assert(t, "Index", c.exp, got) + test.Assert(t, "Found", c.expFound, found) } } @@ -311,7 +311,7 @@ func testTokenFind(t *testing.T, line, token []byte, startat int, exp []int) { startat = foundat + tokenlen } - test.Assert(t, "TokenFind", exp, got, true) + test.Assert(t, "TokenFind", exp, got) } func TestTokenFind(t *testing.T) { @@ -345,7 +345,7 @@ func TestInReplace(t *testing.T) { for _, c := range cases { got := InReplace([]byte(c.in), []byte(ascii.LettersNumber), '_') - test.Assert(t, "InReplace", c.exp, string(got), true) + test.Assert(t, "InReplace", c.exp, string(got)) } } @@ -373,6 +373,6 @@ func TestIndexes(t *testing.T) { got := Indexes(c.s, c.token) - test.Assert(t, "Indexes", c.exp, got, true) + test.Assert(t, "Indexes", c.exp, got) } } |
