diff options
136 files changed, 993 insertions, 1157 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 5d0cbdb2..15bccb2f 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -3,6 +3,20 @@ This library is released every month, usually at the first week of month. +== share v0.25.0 (2021-04-xx) + +=== Breaking changes + +* 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. + + == share v0.24.0 (2021-03-06) === Breaking changes diff --git a/api/telegram/bot/command_test.go b/api/telegram/bot/command_test.go index 79bc5e34..d0fdab01 100644 --- a/api/telegram/bot/command_test.go +++ b/api/telegram/bot/command_test.go @@ -67,6 +67,6 @@ func TestCommand_validate(t *testing.T) { }} for _, c := range cases { - test.Assert(t, c.desc, c.exp, c.cmd.validate(), true) + test.Assert(t, c.desc, c.exp, c.cmd.validate()) } } diff --git a/api/telegram/bot/message_test.go b/api/telegram/bot/message_test.go index a1319839..b676a233 100644 --- a/api/telegram/bot/message_test.go +++ b/api/telegram/bot/message_test.go @@ -52,7 +52,7 @@ func TestMessage_parseCommandArgs(t *testing.T) { for _, c := range cases { c.msg.parseCommandArgs() - test.Assert(t, "Command", c.expCommand, c.msg.Command, true) - test.Assert(t, "CommandArgs", c.expArgs, c.msg.CommandArgs, true) + test.Assert(t, "Command", c.expCommand, c.msg.Command) + test.Assert(t, "CommandArgs", c.expArgs, c.msg.CommandArgs) } } 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) } } diff --git a/lib/contact/google/contact_test.go b/lib/contact/google/contact_test.go index b4f3cc0e..2e518f45 100644 --- a/lib/contact/google/contact_test.go +++ b/lib/contact/google/contact_test.go @@ -96,13 +96,13 @@ func TestDecode(t *testing.T) { gotContact := parseContact(t) - test.Assert(t, "Name", exp.Name, gotContact.Name, true) - test.Assert(t, "Birthday", exp.Birthday, gotContact.Birthday, true) - test.Assert(t, "Addresses", exp.Addresses, gotContact.Addresses, true) - test.Assert(t, "Anniversary", exp.Anniversary, gotContact.Anniversary, true) - test.Assert(t, "Emails", exp.Emails, gotContact.Emails, true) - test.Assert(t, "Phones", exp.Phones, gotContact.Phones, true) - test.Assert(t, "Links", exp.Links, gotContact.Links, true) - test.Assert(t, "Company", exp.Company, gotContact.Company, true) - test.Assert(t, "JobTitle", exp.JobTitle, gotContact.JobTitle, true) + test.Assert(t, "Name", exp.Name, gotContact.Name) + test.Assert(t, "Birthday", exp.Birthday, gotContact.Birthday) + test.Assert(t, "Addresses", exp.Addresses, gotContact.Addresses) + test.Assert(t, "Anniversary", exp.Anniversary, gotContact.Anniversary) + test.Assert(t, "Emails", exp.Emails, gotContact.Emails) + test.Assert(t, "Phones", exp.Phones, gotContact.Phones) + test.Assert(t, "Links", exp.Links, gotContact.Links) + test.Assert(t, "Company", exp.Company, gotContact.Company) + test.Assert(t, "JobTitle", exp.JobTitle, gotContact.JobTitle) } diff --git a/lib/contact/google/google_test.go b/lib/contact/google/google_test.go index 94dfbcbd..8a5aa884 100644 --- a/lib/contact/google/google_test.go +++ b/lib/contact/google/google_test.go @@ -26,5 +26,5 @@ func TestImportFromJSON(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Len", 55, len(contacts), true) + test.Assert(t, "Len", 55, len(contacts)) } diff --git a/lib/contact/microsoft/microsoft_test.go b/lib/contact/microsoft/microsoft_test.go index ff1f1009..b5f5a33f 100644 --- a/lib/contact/microsoft/microsoft_test.go +++ b/lib/contact/microsoft/microsoft_test.go @@ -76,9 +76,9 @@ func TestImportFromJSON(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Len", 1, len(contacts), true) + test.Assert(t, "Len", 1, len(contacts)) got := contacts[0] - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/contact/yahoo/contact_test.go b/lib/contact/yahoo/contact_test.go index b9bd161f..88ddfcaf 100644 --- a/lib/contact/yahoo/contact_test.go +++ b/lib/contact/yahoo/contact_test.go @@ -64,13 +64,13 @@ func TestParseJSON(t *testing.T) { gotContact := parseSampleJSON(t, sampleContact) - test.Assert(t, "Name", exp.Name, gotContact.Name, true) - test.Assert(t, "Birthday", exp.Birthday, gotContact.Birthday, true) - test.Assert(t, "Addresses", exp.Addresses, gotContact.Addresses, true) - test.Assert(t, "Anniversary", exp.Anniversary, gotContact.Anniversary, true) - test.Assert(t, "Emails", exp.Emails, gotContact.Emails, true) - test.Assert(t, "Phones", exp.Phones, gotContact.Phones, true) - test.Assert(t, "Links", exp.Links, gotContact.Links, true) - test.Assert(t, "Company", exp.Company, gotContact.Company, true) - test.Assert(t, "JobTitle", exp.JobTitle, gotContact.JobTitle, true) + test.Assert(t, "Name", exp.Name, gotContact.Name) + test.Assert(t, "Birthday", exp.Birthday, gotContact.Birthday) + test.Assert(t, "Addresses", exp.Addresses, gotContact.Addresses) + test.Assert(t, "Anniversary", exp.Anniversary, gotContact.Anniversary) + test.Assert(t, "Emails", exp.Emails, gotContact.Emails) + test.Assert(t, "Phones", exp.Phones, gotContact.Phones) + test.Assert(t, "Links", exp.Links, gotContact.Links) + test.Assert(t, "Company", exp.Company, gotContact.Company) + test.Assert(t, "JobTitle", exp.JobTitle, gotContact.JobTitle) } diff --git a/lib/contact/yahoo/contacts_test.go b/lib/contact/yahoo/contacts_test.go index b97c06b6..ab7dbc27 100644 --- a/lib/contact/yahoo/contacts_test.go +++ b/lib/contact/yahoo/contacts_test.go @@ -26,5 +26,5 @@ func TestImportFromJSON(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Len", 54, len(contacts), true) + test.Assert(t, "Len", 54, len(contacts)) } diff --git a/lib/dns/answer_test.go b/lib/dns/answer_test.go index 1bd8069f..140bdb33 100644 --- a/lib/dns/answer_test.go +++ b/lib/dns/answer_test.go @@ -78,22 +78,22 @@ func TestNewAnswer(t *testing.T) { got := newAnswer(c.msg, c.isLocal) if got == nil { - test.Assert(t, "newAnswer", got, c.exp, true) + test.Assert(t, "newAnswer", got, c.exp) continue } if c.isLocal { - test.Assert(t, "newAnswer.ReceivedAt", int64(0), got.ReceivedAt, true) - test.Assert(t, "newAnswer.AccessedAt", int64(0), got.AccessedAt, true) + test.Assert(t, "newAnswer.ReceivedAt", int64(0), got.ReceivedAt) + test.Assert(t, "newAnswer.AccessedAt", int64(0), got.AccessedAt) } else { - test.Assert(t, "newAnswer.ReceivedAt", true, got.ReceivedAt >= at, true) - test.Assert(t, "newAnswer.AccessedAt", true, got.AccessedAt >= at, true) + test.Assert(t, "newAnswer.ReceivedAt", true, got.ReceivedAt >= at) + test.Assert(t, "newAnswer.AccessedAt", true, got.AccessedAt >= at) } - test.Assert(t, "newAnswer.QName", c.expQName, got.QName, true) - test.Assert(t, "newAnswer.QType", c.expQType, got.QType, true) - test.Assert(t, "newAnswer.QClass", c.expQClass, got.QClass, true) - test.Assert(t, "newAnswer.msg", c.expMsg, got.msg, true) + test.Assert(t, "newAnswer.QName", c.expQName, got.QName) + test.Assert(t, "newAnswer.QType", c.expQType, got.QType) + test.Assert(t, "newAnswer.QClass", c.expQClass, got.QClass) + test.Assert(t, "newAnswer.msg", c.expMsg, got.msg) } } @@ -113,8 +113,8 @@ func TestAnswerClear(t *testing.T) { var expMsg *Message var expEl *list.Element - test.Assert(t, "answer.msg", expMsg, an.msg, true) - test.Assert(t, "answer.el", expEl, an.el, true) + test.Assert(t, "answer.msg", expMsg, an.msg) + test.Assert(t, "answer.el", expEl, an.el) } func TestAnswerGet(t *testing.T) { @@ -174,14 +174,14 @@ func TestAnswerGet(t *testing.T) { gotPacket := an.get() if c.isLocal { - test.Assert(t, "ReceivedAt", int64(0), an.ReceivedAt, true) - test.Assert(t, "AccessedAt", int64(0), an.AccessedAt, true) - test.Assert(t, "packet", c.msg.packet, gotPacket, true) + test.Assert(t, "ReceivedAt", int64(0), an.ReceivedAt) + test.Assert(t, "AccessedAt", int64(0), an.AccessedAt) + test.Assert(t, "packet", c.msg.packet, gotPacket) continue } - test.Assert(t, "ReceivedAt", an.ReceivedAt >= at-5, true, true) - test.Assert(t, "AccessedAt", an.AccessedAt >= at, true, true) + test.Assert(t, "ReceivedAt", an.ReceivedAt >= at-5, true) + test.Assert(t, "AccessedAt", an.AccessedAt >= at, true) got := &Message{ Header: SectionHeader{}, Question: SectionQuestion{}, @@ -191,9 +191,9 @@ func TestAnswerGet(t *testing.T) { if err != nil { t.Fatal(err) } - test.Assert(t, "Message.Header", c.msg.Header, got.Header, true) - test.Assert(t, "Message.Question", c.msg.Question, got.Question, true) - test.Assert(t, "Answer.TTL", c.msg.Answer[0].TTL, got.Answer[0].TTL, true) + test.Assert(t, "Message.Header", c.msg.Header, got.Header) + test.Assert(t, "Message.Question", c.msg.Question, got.Question) + test.Assert(t, "Answer.TTL", c.msg.Answer[0].TTL, got.Answer[0].TTL) } } @@ -264,10 +264,10 @@ func TestAnswerUpdate(t *testing.T) { c.an.update(c.nu) - test.Assert(t, "ReceivedAt", c.expReceivedAt, c.an.ReceivedAt, true) - test.Assert(t, "AccessedAt", c.expAccessedAt, c.an.AccessedAt, true) + test.Assert(t, "ReceivedAt", c.expReceivedAt, c.an.ReceivedAt) + test.Assert(t, "AccessedAt", c.expAccessedAt, c.an.AccessedAt) if c.nu != nil { - test.Assert(t, "c.nu.msg", c.expMsg, c.nu.msg, true) + test.Assert(t, "c.nu.msg", c.expMsg, c.nu.msg) } } } diff --git a/lib/dns/answers_test.go b/lib/dns/answers_test.go index 546ec069..c01ce4e6 100644 --- a/lib/dns/answers_test.go +++ b/lib/dns/answers_test.go @@ -40,8 +40,8 @@ func TestNewAnswers(t *testing.T) { got := newAnswers(c.an) - test.Assert(t, "len(answers.v)", len(got.v), c.expLen, true) - test.Assert(t, "answers.v", got.v, c.expV, true) + test.Assert(t, "len(answers.v)", len(got.v), c.expLen) + test.Assert(t, "answers.v", got.v, c.expV) } } @@ -91,8 +91,8 @@ func TestAnswersGet(t *testing.T) { got, x := ans.get(c.QType, c.QClass) - test.Assert(t, "answers.get", c.exp, got, true) - test.Assert(t, "answers.get index", c.expIndex, x, true) + test.Assert(t, "answers.get", c.exp, got) + test.Assert(t, "answers.get index", c.expIndex, x) } } @@ -147,9 +147,9 @@ func TestAnswersRemove(t *testing.T) { ans.remove(c.QType, c.QClass) - test.Assert(t, "len(answers.v)", c.expLen, len(ans.v), true) - test.Assert(t, "cap(answers.v)", 1, cap(ans.v), true) - test.Assert(t, "answers", c.exp, ans, true) + test.Assert(t, "len(answers.v)", c.expLen, len(ans.v)) + test.Assert(t, "cap(answers.v)", 1, cap(ans.v)) + test.Assert(t, "answers", c.exp, ans) } } @@ -232,6 +232,6 @@ func TestAnswersUpdate(t *testing.T) { ans.upsert(c.nu) - test.Assert(t, "answers.upsert", c.exp, ans, true) + test.Assert(t, "answers.upsert", c.exp, ans) } } diff --git a/lib/dns/caches_test.go b/lib/dns/caches_test.go index 5d44806b..af0f3090 100644 --- a/lib/dns/caches_test.go +++ b/lib/dns/caches_test.go @@ -35,10 +35,8 @@ func TestNewCaches(t *testing.T) { got := newCaches(c.pruneDelay, c.pruneThreshold) - test.Assert(t, "caches.pruneDelay", c.expDelay, - got.pruneDelay, true) - test.Assert(t, "caches.pruneThreshold", c.expThreshold, - got.pruneThreshold, true) + test.Assert(t, "caches.pruneDelay", c.expDelay, got.pruneDelay) + test.Assert(t, "caches.pruneThreshold", c.expThreshold, got.pruneThreshold) } } @@ -112,8 +110,8 @@ func TestCachesGet(t *testing.T) { _, got := ca.get(c.QName, c.QType, c.QClass) gotList := ca.list() - test.Assert(t, "caches.get", c.exp, got, true) - test.Assert(t, "caches.list", c.expList, gotList, true) + test.Assert(t, "caches.get", c.exp, got) + test.Assert(t, "caches.list", c.expList, gotList) } } @@ -182,7 +180,7 @@ func TestCachesPrune(t *testing.T) { gotList := ca.list() - test.Assert(t, "caches.list", c.expList, gotList, true) + test.Assert(t, "caches.list", c.expList, gotList) } } @@ -274,10 +272,10 @@ func TestCachesUpsert(t *testing.T) { gotList := ca.list() - test.Assert(t, "len(caches.list)", c.expLen, len(gotList), true) + test.Assert(t, "len(caches.list)", c.expLen, len(gotList)) for x := 0; x < len(gotList); x++ { - test.Assert(t, "caches.list", c.expList[x], gotList[x], true) + test.Assert(t, "caches.list", c.expList[x], gotList[x]) } } } diff --git a/lib/dns/dns_test.go b/lib/dns/dns_test.go index fbb04a58..38ae3f37 100644 --- a/lib/dns/dns_test.go +++ b/lib/dns/dns_test.go @@ -63,8 +63,8 @@ func TestMain(m *testing.M) { } func TestQueryType(t *testing.T) { - test.Assert(t, "QueryTypeA", QueryTypeA, uint16(1), true) - test.Assert(t, "QueryTypeTXT", QueryTypeTXT, uint16(16), true) - test.Assert(t, "QueryTypeAXFR", QueryTypeAXFR, uint16(252), true) - test.Assert(t, "QueryTypeALL", QueryTypeALL, uint16(255), true) + test.Assert(t, "QueryTypeA", QueryTypeA, uint16(1)) + test.Assert(t, "QueryTypeTXT", QueryTypeTXT, uint16(16)) + test.Assert(t, "QueryTypeAXFR", QueryTypeAXFR, uint16(252)) + test.Assert(t, "QueryTypeALL", QueryTypeALL, uint16(255)) } diff --git a/lib/dns/dohclient_test.go b/lib/dns/dohclient_test.go index bf96d408..af69ec0e 100644 --- a/lib/dns/dohclient_test.go +++ b/lib/dns/dohclient_test.go @@ -151,7 +151,7 @@ func TestDoHClient_Lookup(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Packet", c.exp.packet, got.packet, true) + test.Assert(t, "Packet", c.exp.packet, got.packet) } } @@ -308,7 +308,7 @@ func TestDoHClient_Post(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Packet", c.exp.packet, got.packet, true) + test.Assert(t, "Packet", c.exp.packet, got.packet) } } @@ -357,7 +357,7 @@ func TestDoHClient_Get(t *testing.T) { got, err := cl.Get(msg) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } @@ -366,6 +366,6 @@ func TestDoHClient_Get(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Packet", c.exp.packet, got.packet, true) + test.Assert(t, "Packet", c.exp.packet, got.packet) } } diff --git a/lib/dns/dotclient_test.go b/lib/dns/dotclient_test.go index 8be805a9..d6f62598 100644 --- a/lib/dns/dotclient_test.go +++ b/lib/dns/dotclient_test.go @@ -130,6 +130,6 @@ func TestDoTClient_Lookup(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Packet", c.exp.packet, got.packet, true) + test.Assert(t, "Packet", c.exp.packet, got.packet) } } diff --git a/lib/dns/funcs_test.go b/lib/dns/funcs_test.go index 56699c9f..4510de38 100644 --- a/lib/dns/funcs_test.go +++ b/lib/dns/funcs_test.go @@ -27,7 +27,7 @@ func TestGetSystemNameServers(t *testing.T) { got := GetSystemNameServers(c.path) - test.Assert(t, "NameServers", c.exp, got, true) + test.Assert(t, "NameServers", c.exp, got) } } @@ -52,8 +52,8 @@ func TestReverseIP(t *testing.T) { gotIP, gotIsIPv4 := reverseIP(ip) - test.Assert(t, "reverseIP", c.exp, gotIP, true) - test.Assert(t, "isIPv4", c.expIsIPv4, gotIsIPv4, true) + test.Assert(t, "reverseIP", c.exp, gotIP) + test.Assert(t, "isIPv4", c.expIsIPv4, gotIsIPv4) } } @@ -88,10 +88,10 @@ func TestLookupPTR(t *testing.T) { got, err := LookupPTR(cl, c.ip) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "LookupPTR", c.exp, got, true) + test.Assert(t, "LookupPTR", c.exp, got) } } diff --git a/lib/dns/hosts_file_test.go b/lib/dns/hosts_file_test.go index a921432b..73071f4a 100644 --- a/lib/dns/hosts_file_test.go +++ b/lib/dns/hosts_file_test.go @@ -12,7 +12,7 @@ func TestParseHostsFile(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Length", 10, len(hostsFile.Records), true) + test.Assert(t, "Length", 10, len(hostsFile.Records)) } func TestHostsLoad2(t *testing.T) { diff --git a/lib/dns/idpool_test.go b/lib/dns/idpool_test.go index a2c442f7..ba2eaa5c 100644 --- a/lib/dns/idpool_test.go +++ b/lib/dns/idpool_test.go @@ -11,8 +11,8 @@ import ( ) func TestIDPool(t *testing.T) { - test.Assert(t, "getNextID()=8", getNextID(), uint16(8), true) - test.Assert(t, "getNextID()=9", getNextID(), uint16(9), true) - test.Assert(t, "getNextID()=10", getNextID(), uint16(10), true) - test.Assert(t, "getNextID()=11", getNextID(), uint16(11), true) + test.Assert(t, "getNextID()=8", getNextID(), uint16(8)) + test.Assert(t, "getNextID()=9", getNextID(), uint16(9)) + test.Assert(t, "getNextID()=10", getNextID(), uint16(10)) + test.Assert(t, "getNextID()=11", getNextID(), uint16(11)) } diff --git a/lib/dns/message_test.go b/lib/dns/message_test.go index 517d4969..7082cf94 100644 --- a/lib/dns/message_test.go +++ b/lib/dns/message_test.go @@ -38,7 +38,7 @@ func TestMessageIsExpired(t *testing.T) { got := c.msg.IsExpired() - test.Assert(t, "IsExpired", c.exp, got, true) + test.Assert(t, "IsExpired", c.exp, got) } } @@ -72,7 +72,7 @@ func TestMessagePackDomainName(t *testing.T) { msg.packDomainName(c.in, false) - test.Assert(t, "packDomainName", c.exp, msg.packet, true) + test.Assert(t, "packDomainName", c.exp, msg.packet) } } @@ -147,7 +147,7 @@ func TestMessagePackQuestion(t *testing.T) { c.msg.packQuestion() - test.Assert(t, "packet", c.exp, c.msg.packet, true) + test.Assert(t, "packet", c.exp, c.msg.packet) } } @@ -831,7 +831,7 @@ func TestMessagePack(t *testing.T) { got, _ := c.msg.Pack() t.Logf("Message: %+v\n", c.msg) - test.Assert(t, c.desc, c.exp, got, true) + test.Assert(t, c.desc, c.exp, got) } } @@ -900,7 +900,7 @@ func TestMessageSetAuthoritativeAnswer(t *testing.T) { c.msg.SetAuthorativeAnswer(c.isAA) - test.Assert(t, "Message.packet header", c.exp, c.msg.packet[:4], true) + test.Assert(t, "Message.packet header", c.exp, c.msg.packet[:4]) } } @@ -943,7 +943,7 @@ func TestMessageSetQuery(t *testing.T) { c.msg.SetQuery(c.isQuery) - test.Assert(t, "Message.packet header", c.exp, c.msg.packet[:4], true) + test.Assert(t, "Message.packet header", c.exp, c.msg.packet[:4]) } } @@ -986,7 +986,7 @@ func TestMessageSetRecursionDesired(t *testing.T) { c.msg.SetRecursionDesired(c.isRD) - test.Assert(t, "Message.packet header", c.exp, c.msg.packet[:4], true) + test.Assert(t, "Message.packet header", c.exp, c.msg.packet[:4]) } } @@ -1030,7 +1030,7 @@ func TestMessageSetResponseCode(t *testing.T) { c.msg.SetResponseCode(c.code) - test.Assert(t, "Message.packet header", c.exp, c.msg.packet[:4], true) + test.Assert(t, "Message.packet header", c.exp, c.msg.packet[:4]) } } @@ -1859,38 +1859,38 @@ func TestMessageUnpack(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Header", c.exp.Header, msg.Header, true) - test.Assert(t, "Question", c.exp.Question, msg.Question, true) - test.Assert(t, "Answer Length", len(c.exp.Answer), len(msg.Answer), true) - test.Assert(t, "Authority Length", len(c.exp.Authority), len(msg.Authority), true) - test.Assert(t, "Additional Length", len(c.exp.Additional), len(msg.Additional), true) + test.Assert(t, "Header", c.exp.Header, msg.Header) + test.Assert(t, "Question", c.exp.Question, msg.Question) + test.Assert(t, "Answer Length", len(c.exp.Answer), len(msg.Answer)) + test.Assert(t, "Authority Length", len(c.exp.Authority), len(msg.Authority)) + test.Assert(t, "Additional Length", len(c.exp.Additional), len(msg.Additional)) for x := 0; x < len(c.exp.Answer); x++ { - test.Assert(t, "Answer.Name", c.exp.Answer[x].Name, msg.Answer[x].Name, true) - test.Assert(t, "Answer.Type", c.exp.Answer[x].Type, msg.Answer[x].Type, true) - test.Assert(t, "Answer.Class", c.exp.Answer[x].Class, msg.Answer[x].Class, true) - test.Assert(t, "Answer.TTL", c.exp.Answer[x].TTL, msg.Answer[x].TTL, true) - test.Assert(t, "Answer.rdlen", c.exp.Answer[x].rdlen, msg.Answer[x].rdlen, true) - test.Assert(t, "Answer.rdata", c.exp.Answer[x].rdata, msg.Answer[x].rdata, true) - test.Assert(t, "Answer.Value", c.exp.Answer[x].Value, msg.Answer[x].Value, true) + test.Assert(t, "Answer.Name", c.exp.Answer[x].Name, msg.Answer[x].Name) + test.Assert(t, "Answer.Type", c.exp.Answer[x].Type, msg.Answer[x].Type) + test.Assert(t, "Answer.Class", c.exp.Answer[x].Class, msg.Answer[x].Class) + test.Assert(t, "Answer.TTL", c.exp.Answer[x].TTL, msg.Answer[x].TTL) + test.Assert(t, "Answer.rdlen", c.exp.Answer[x].rdlen, msg.Answer[x].rdlen) + test.Assert(t, "Answer.rdata", c.exp.Answer[x].rdata, msg.Answer[x].rdata) + test.Assert(t, "Answer.Value", c.exp.Answer[x].Value, msg.Answer[x].Value) } for x := 0; x < len(c.exp.Authority); x++ { - test.Assert(t, "Authority.Name", c.exp.Authority[x].Name, msg.Authority[x].Name, true) - test.Assert(t, "Authority.Type", c.exp.Authority[x].Type, msg.Authority[x].Type, true) - test.Assert(t, "Authority.Class", c.exp.Authority[x].Class, msg.Authority[x].Class, true) - test.Assert(t, "Authority.TTL", c.exp.Authority[x].TTL, msg.Authority[x].TTL, true) - test.Assert(t, "Authority.rdlen", c.exp.Authority[x].rdlen, msg.Authority[x].rdlen, true) - test.Assert(t, "Authority.rdata", c.exp.Authority[x].rdata, msg.Authority[x].rdata, true) - test.Assert(t, "Authority.Value", c.exp.Authority[x].Value, msg.Authority[x].Value, true) + test.Assert(t, "Authority.Name", c.exp.Authority[x].Name, msg.Authority[x].Name) + test.Assert(t, "Authority.Type", c.exp.Authority[x].Type, msg.Authority[x].Type) + test.Assert(t, "Authority.Class", c.exp.Authority[x].Class, msg.Authority[x].Class) + test.Assert(t, "Authority.TTL", c.exp.Authority[x].TTL, msg.Authority[x].TTL) + test.Assert(t, "Authority.rdlen", c.exp.Authority[x].rdlen, msg.Authority[x].rdlen) + test.Assert(t, "Authority.rdata", c.exp.Authority[x].rdata, msg.Authority[x].rdata) + test.Assert(t, "Authority.Value", c.exp.Authority[x].Value, msg.Authority[x].Value) } for x := 0; x < len(c.exp.Additional); x++ { - test.Assert(t, "Additional.Name", c.exp.Additional[x].Name, msg.Additional[x].Name, true) - test.Assert(t, "Additional.Type", c.exp.Additional[x].Type, msg.Additional[x].Type, true) - test.Assert(t, "Additional.Class", c.exp.Additional[x].Class, msg.Additional[x].Class, true) - test.Assert(t, "Additional.TTL", c.exp.Additional[x].TTL, msg.Additional[x].TTL, true) - test.Assert(t, "Additional.rdlen", c.exp.Additional[x].rdlen, msg.Additional[x].rdlen, true) - test.Assert(t, "Additional.rdata", c.exp.Additional[x].rdata, msg.Additional[x].rdata, true) - test.Assert(t, "Additional.Value", c.exp.Additional[x].Value, msg.Additional[x].Value, true) + test.Assert(t, "Additional.Name", c.exp.Additional[x].Name, msg.Additional[x].Name) + test.Assert(t, "Additional.Type", c.exp.Additional[x].Type, msg.Additional[x].Type) + test.Assert(t, "Additional.Class", c.exp.Additional[x].Class, msg.Additional[x].Class) + test.Assert(t, "Additional.TTL", c.exp.Additional[x].TTL, msg.Additional[x].TTL) + test.Assert(t, "Additional.rdlen", c.exp.Additional[x].rdlen, msg.Additional[x].rdlen) + test.Assert(t, "Additional.rdata", c.exp.Additional[x].rdata, msg.Additional[x].rdata) + test.Assert(t, "Additional.Value", c.exp.Additional[x].Value, msg.Additional[x].Value) } } } diff --git a/lib/dns/serveroptions_test.go b/lib/dns/serveroptions_test.go index 93b33ee8..4b4d023a 100644 --- a/lib/dns/serveroptions_test.go +++ b/lib/dns/serveroptions_test.go @@ -76,11 +76,11 @@ func TestServerOptionsInit(t *testing.T) { err := c.so.init() if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } - test.Assert(t, "ServerOptions", c.exp, c.so, true) + test.Assert(t, "ServerOptions", c.exp, c.so) } } @@ -147,8 +147,8 @@ func TestServerOptionsParseNameServers(t *testing.T) { so.parseNameServers() - test.Assert(t, "primaryUDP", c.expUDPServers, so.primaryUDP, true) - test.Assert(t, "primaryTCP", c.expTCPServers, so.primaryTCP, true) - test.Assert(t, "primaryDoh", c.expDoHServers, so.primaryDoh, true) + test.Assert(t, "primaryUDP", c.expUDPServers, so.primaryUDP) + test.Assert(t, "primaryTCP", c.expTCPServers, so.primaryTCP) + test.Assert(t, "primaryDoh", c.expDoHServers, so.primaryDoh) } } diff --git a/lib/dns/tcpclient_test.go b/lib/dns/tcpclient_test.go index 91edeced..45712ed3 100644 --- a/lib/dns/tcpclient_test.go +++ b/lib/dns/tcpclient_test.go @@ -130,6 +130,6 @@ func TestTCPClientLookup(t *testing.T) { t.Fatal(err) } - test.Assert(t, "packet", c.exp.packet, got.packet, true) + test.Assert(t, "packet", c.exp.packet, got.packet) } } diff --git a/lib/dns/udpclient_test.go b/lib/dns/udpclient_test.go index 26917fd0..3ea3b90f 100644 --- a/lib/dns/udpclient_test.go +++ b/lib/dns/udpclient_test.go @@ -164,7 +164,7 @@ func TestUDPClientLookup(t *testing.T) { t.Fatal(err) } - test.Assert(t, "packet", c.exp.packet, got.packet, true) + test.Assert(t, "packet", c.exp.packet, got.packet) } else { t.Logf("Got recursive answer: %+v\n", got) } diff --git a/lib/dns/udpclientpool_test.go b/lib/dns/udpclientpool_test.go index 5a175bed..b68f7f9b 100644 --- a/lib/dns/udpclientpool_test.go +++ b/lib/dns/udpclientpool_test.go @@ -38,7 +38,7 @@ func TestNewUDPClientPool(t *testing.T) { ucp, err := NewUDPClientPool(c.ns) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } diff --git a/lib/dns/zone_file_test.go b/lib/dns/zone_file_test.go index 36421a2e..82658f9d 100644 --- a/lib/dns/zone_file_test.go +++ b/lib/dns/zone_file_test.go @@ -43,11 +43,11 @@ func TestZoneParseDirectiveOrigin(t *testing.T) { err := m.parse() if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) continue } - test.Assert(t, "origin", c.exp, m.origin, true) + test.Assert(t, "origin", c.exp, m.origin) } } @@ -81,7 +81,7 @@ func TestZoneParseDirectiveInclude(t *testing.T) { err := m.parse() if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) continue } } @@ -120,11 +120,11 @@ func TestZoneParseDirectiveTTL(t *testing.T) { err := m.parse() if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) continue } - test.Assert(t, "ttl", c.exp, m.ttl, true) + test.Assert(t, "ttl", c.exp, m.ttl) } } @@ -327,68 +327,37 @@ VAXA A 10.2.0.27 err := m.parse() if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) continue } test.Assert(t, "messages length:", - len(c.exp), len(m.zone.messages), true) + len(c.exp), len(m.zone.messages)) for x, msg := range m.zone.messages { - test.Assert(t, "Message.Header", - c.exp[x].Header, msg.Header, true) - test.Assert(t, "Message.Question", - c.exp[x].Question, msg.Question, true) + test.Assert(t, "Message.Header", c.exp[x].Header, msg.Header) + test.Assert(t, "Message.Question", c.exp[x].Question, msg.Question) for y, answer := range msg.Answer { - test.Assert(t, "Answer.Name", - c.exp[x].Answer[y].Name, - answer.Name, true) - test.Assert(t, "Answer.Type", - c.exp[x].Answer[y].Type, - answer.Type, true) - test.Assert(t, "Answer.Class", - c.exp[x].Answer[y].Class, - answer.Class, true) - test.Assert(t, "Answer.TTL", - c.exp[x].Answer[y].TTL, - answer.TTL, true) - test.Assert(t, "Answer.Value", - c.exp[x].Answer[y].Value, - answer.Value, true) + test.Assert(t, "Answer.Name", c.exp[x].Answer[y].Name, answer.Name) + test.Assert(t, "Answer.Type", c.exp[x].Answer[y].Type, answer.Type) + test.Assert(t, "Answer.Class", c.exp[x].Answer[y].Class, answer.Class) + test.Assert(t, "Answer.TTL", c.exp[x].Answer[y].TTL, answer.TTL) + test.Assert(t, "Answer.Value", c.exp[x].Answer[y].Value, answer.Value) } for y, auth := range msg.Authority { - test.Assert(t, "Authority.Name", - c.exp[x].Authority[y].Name, - auth.Name, true) - test.Assert(t, "Authority.Type", - c.exp[x].Authority[y].Type, - auth.Type, true) - test.Assert(t, "Authority.Class", - c.exp[x].Authority[y].Class, - auth.Class, true) - test.Assert(t, "Authority.TTL", - c.exp[x].Authority[y].TTL, - auth.TTL, true) - test.Assert(t, "Authority.Value", - c.exp[x].Authority[y].Value, auth.Value, true) + test.Assert(t, "Authority.Name", c.exp[x].Authority[y].Name, auth.Name) + test.Assert(t, "Authority.Type", c.exp[x].Authority[y].Type, auth.Type) + test.Assert(t, "Authority.Class", c.exp[x].Authority[y].Class, auth.Class) + test.Assert(t, "Authority.TTL", c.exp[x].Authority[y].TTL, auth.TTL) + test.Assert(t, "Authority.Value", c.exp[x].Authority[y].Value, auth.Value) } for y, add := range msg.Additional { - test.Assert(t, "Additional.Name", - c.exp[x].Additional[y].Name, - add.Name, true) - test.Assert(t, "Additional.Type", - c.exp[x].Additional[y].Type, - add.Type, true) - test.Assert(t, "Additional.Class", - c.exp[x].Additional[y].Class, - add.Class, true) - test.Assert(t, "Additional.TTL", - c.exp[x].Additional[y].TTL, - add.TTL, true) - test.Assert(t, "Additional.Value", - c.exp[x].Additional[y].Value, - add.Value, true) + test.Assert(t, "Additional.Name", c.exp[x].Additional[y].Name, add.Name) + test.Assert(t, "Additional.Type", c.exp[x].Additional[y].Type, add.Type) + test.Assert(t, "Additional.Class", c.exp[x].Additional[y].Class, add.Class) + test.Assert(t, "Additional.TTL", c.exp[x].Additional[y].TTL, add.TTL) + test.Assert(t, "Additional.Value", c.exp[x].Additional[y].Value, add.Value) } } } @@ -616,69 +585,37 @@ relay IN CNAME relay.pair.com. err := m.parse() if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) continue } test.Assert(t, "messages length:", len(c.exp), - len(m.zone.messages), true) + len(m.zone.messages)) for x, msg := range m.zone.messages { - test.Assert(t, "Message.Header", - c.exp[x].Header, msg.Header, true) - test.Assert(t, "Message.Question", - c.exp[x].Question, msg.Question, true) + test.Assert(t, "Message.Header", c.exp[x].Header, msg.Header) + test.Assert(t, "Message.Question", c.exp[x].Question, msg.Question) for y, answer := range msg.Answer { - test.Assert(t, "Answer.Name", - c.exp[x].Answer[y].Name, answer.Name, - true) - test.Assert(t, "Answer.Type", - c.exp[x].Answer[y].Type, answer.Type, - true) - test.Assert(t, "Answer.Class", - c.exp[x].Answer[y].Class, - answer.Class, true) - test.Assert(t, "Answer.TTL", - c.exp[x].Answer[y].TTL, - answer.TTL, true) - test.Assert(t, "Answer.Value", - c.exp[x].Answer[y].Value, - answer.Value, true) + test.Assert(t, "Answer.Name", c.exp[x].Answer[y].Name, answer.Name) + test.Assert(t, "Answer.Type", c.exp[x].Answer[y].Type, answer.Type) + test.Assert(t, "Answer.Class", c.exp[x].Answer[y].Class, answer.Class) + test.Assert(t, "Answer.TTL", c.exp[x].Answer[y].TTL, answer.TTL) + test.Assert(t, "Answer.Value", c.exp[x].Answer[y].Value, answer.Value) } for y, auth := range msg.Authority { - test.Assert(t, "Authority.Name", - c.exp[x].Authority[y].Name, - auth.Name, true) - test.Assert(t, "Authority.Type", - c.exp[x].Authority[y].Type, - auth.Type, true) - test.Assert(t, "Authority.Class", - c.exp[x].Authority[y].Class, - auth.Class, true) - test.Assert(t, "Authority.TTL", - c.exp[x].Authority[y].TTL, - auth.TTL, true) - test.Assert(t, "Authority.Value", - c.exp[x].Authority[y].Value, - auth.Value, true) + test.Assert(t, "Authority.Name", c.exp[x].Authority[y].Name, auth.Name) + test.Assert(t, "Authority.Type", c.exp[x].Authority[y].Type, auth.Type) + test.Assert(t, "Authority.Class", c.exp[x].Authority[y].Class, auth.Class) + test.Assert(t, "Authority.TTL", c.exp[x].Authority[y].TTL, auth.TTL) + test.Assert(t, "Authority.Value", c.exp[x].Authority[y].Value, auth.Value) } for y, add := range msg.Additional { - test.Assert(t, "Additional.Name", - c.exp[x].Additional[y].Name, - add.Name, true) - test.Assert(t, "Additional.Type", - c.exp[x].Additional[y].Type, - add.Type, true) - test.Assert(t, "Additional.Class", - c.exp[x].Additional[y].Class, - add.Class, true) - test.Assert(t, "Additional.TTL", - c.exp[x].Additional[y].TTL, - add.TTL, true) - test.Assert(t, "Additional.Value", - c.exp[x].Additional[y].Value, - add.Value, true) + test.Assert(t, "Additional.Name", c.exp[x].Additional[y].Name, add.Name) + test.Assert(t, "Additional.Type", c.exp[x].Additional[y].Type, add.Type) + test.Assert(t, "Additional.Class", c.exp[x].Additional[y].Class, add.Class) + test.Assert(t, "Additional.TTL", c.exp[x].Additional[y].TTL, add.TTL) + test.Assert(t, "Additional.Value", c.exp[x].Additional[y].Value, add.Value) } } } @@ -769,69 +706,37 @@ angularjs.doc A 127.0.0.1 err := m.parse() if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) continue } test.Assert(t, "messages length:", len(c.exp), - len(m.zone.messages), true) + len(m.zone.messages)) for x, msg := range m.zone.messages { - test.Assert(t, "Message.Header", c.exp[x].Header, - msg.Header, true) - test.Assert(t, "Message.Question", - c.exp[x].Question, msg.Question, true) + test.Assert(t, "Message.Header", c.exp[x].Header, msg.Header) + test.Assert(t, "Message.Question", c.exp[x].Question, msg.Question) for y, answer := range msg.Answer { - test.Assert(t, "Answer.Name", - c.exp[x].Answer[y].Name, answer.Name, - true) - test.Assert(t, "Answer.Type", - c.exp[x].Answer[y].Type, answer.Type, - true) - test.Assert(t, "Answer.Class", - c.exp[x].Answer[y].Class, - answer.Class, true) - test.Assert(t, "Answer.TTL", - c.exp[x].Answer[y].TTL, answer.TTL, - true) - test.Assert(t, "Answer.Value", - c.exp[x].Answer[y].Value, - answer.Value, true) + test.Assert(t, "Answer.Name", c.exp[x].Answer[y].Name, answer.Name) + test.Assert(t, "Answer.Type", c.exp[x].Answer[y].Type, answer.Type) + test.Assert(t, "Answer.Class", c.exp[x].Answer[y].Class, answer.Class) + test.Assert(t, "Answer.TTL", c.exp[x].Answer[y].TTL, answer.TTL) + test.Assert(t, "Answer.Value", c.exp[x].Answer[y].Value, answer.Value) } for y, auth := range msg.Authority { - test.Assert(t, "Authority.Name", - c.exp[x].Authority[y].Name, - auth.Name, true) - test.Assert(t, "Authority.Type", - c.exp[x].Authority[y].Type, - auth.Type, true) - test.Assert(t, "Authority.Class", - c.exp[x].Authority[y].Class, - auth.Class, true) - test.Assert(t, "Authority.TTL", - c.exp[x].Authority[y].TTL, auth.TTL, - true) - test.Assert(t, "Authority.Value", - c.exp[x].Authority[y].Value, - auth.Value, true) + test.Assert(t, "Authority.Name", c.exp[x].Authority[y].Name, auth.Name) + test.Assert(t, "Authority.Type", c.exp[x].Authority[y].Type, auth.Type) + test.Assert(t, "Authority.Class", c.exp[x].Authority[y].Class, auth.Class) + test.Assert(t, "Authority.TTL", c.exp[x].Authority[y].TTL, auth.TTL) + test.Assert(t, "Authority.Value", c.exp[x].Authority[y].Value, auth.Value) } for y, add := range msg.Additional { - test.Assert(t, "Additional.Name", - c.exp[x].Additional[y].Name, - add.Name, true) - test.Assert(t, "Additional.Type", - c.exp[x].Additional[y].Type, - add.Type, true) - test.Assert(t, "Additional.Class", - c.exp[x].Additional[y].Class, - add.Class, true) - test.Assert(t, "Additional.TTL", - c.exp[x].Additional[y].TTL, add.TTL, - true) - test.Assert(t, "Additional.Value", - c.exp[x].Additional[y].Value, - add.Value, true) + test.Assert(t, "Additional.Name", c.exp[x].Additional[y].Name, add.Name) + test.Assert(t, "Additional.Type", c.exp[x].Additional[y].Type, add.Type) + test.Assert(t, "Additional.Class", c.exp[x].Additional[y].Class, add.Class) + test.Assert(t, "Additional.TTL", c.exp[x].Additional[y].TTL, add.TTL) + test.Assert(t, "Additional.Value", c.exp[x].Additional[y].Value, add.Value) } } } @@ -872,69 +777,36 @@ func TestZoneParseTXT(t *testing.T) { err := m.parse() if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } - test.Assert(t, "messages length:", len(c.exp), - len(m.zone.messages), true) + test.Assert(t, "messages length:", len(c.exp), len(m.zone.messages)) for x, msg := range m.zone.messages { - test.Assert(t, "Message.Header", c.exp[x].Header, - msg.Header, true) - test.Assert(t, "Message.Question", c.exp[x].Question, - msg.Question, true) + test.Assert(t, "Message.Header", c.exp[x].Header, msg.Header) + test.Assert(t, "Message.Question", c.exp[x].Question, msg.Question) for y, answer := range msg.Answer { - test.Assert(t, "Answer.Name", - c.exp[x].Answer[y].Name, answer.Name, - true) - test.Assert(t, "Answer.Type", - c.exp[x].Answer[y].Type, answer.Type, - true) - test.Assert(t, "Answer.Class", - c.exp[x].Answer[y].Class, - answer.Class, true) - test.Assert(t, "Answer.TTL", - c.exp[x].Answer[y].TTL, answer.TTL, - true) - test.Assert(t, "Answer.Value", - c.exp[x].Answer[y].Value, - answer.Value, true) + test.Assert(t, "Answer.Name", c.exp[x].Answer[y].Name, answer.Name) + test.Assert(t, "Answer.Type", c.exp[x].Answer[y].Type, answer.Type) + test.Assert(t, "Answer.Class", c.exp[x].Answer[y].Class, answer.Class) + test.Assert(t, "Answer.TTL", c.exp[x].Answer[y].TTL, answer.TTL) + test.Assert(t, "Answer.Value", c.exp[x].Answer[y].Value, answer.Value) } for y, auth := range msg.Authority { - test.Assert(t, "Authority.Name", - c.exp[x].Authority[y].Name, auth.Name, - true) - test.Assert(t, "Authority.Type", - c.exp[x].Authority[y].Type, auth.Type, - true) - test.Assert(t, "Authority.Class", - c.exp[x].Authority[y].Class, - auth.Class, true) - test.Assert(t, "Authority.TTL", - c.exp[x].Authority[y].TTL, auth.TTL, - true) - test.Assert(t, "Authority.Value", - c.exp[x].Authority[y].Value, - auth.Value, true) + test.Assert(t, "Authority.Name", c.exp[x].Authority[y].Name, auth.Name) + test.Assert(t, "Authority.Type", c.exp[x].Authority[y].Type, auth.Type) + test.Assert(t, "Authority.Class", c.exp[x].Authority[y].Class, auth.Class) + test.Assert(t, "Authority.TTL", c.exp[x].Authority[y].TTL, auth.TTL) + test.Assert(t, "Authority.Value", c.exp[x].Authority[y].Value, auth.Value) } for y, add := range msg.Additional { - test.Assert(t, "Additional.Name", - c.exp[x].Additional[y].Name, - add.Name, true) - test.Assert(t, "Additional.Type", - c.exp[x].Additional[y].Type, - add.Type, true) - test.Assert(t, "Additional.Class", - c.exp[x].Additional[y].Class, - add.Class, true) - test.Assert(t, "Additional.TTL", - c.exp[x].Additional[y].TTL, - add.TTL, true) - test.Assert(t, "Additional.Value", - c.exp[x].Additional[y].Value, - add.Value, true) + test.Assert(t, "Additional.Name", c.exp[x].Additional[y].Name, add.Name) + test.Assert(t, "Additional.Type", c.exp[x].Additional[y].Type, add.Type) + test.Assert(t, "Additional.Class", c.exp[x].Additional[y].Class, add.Class) + test.Assert(t, "Additional.TTL", c.exp[x].Additional[y].TTL, add.TTL) + test.Assert(t, "Additional.Value", c.exp[x].Additional[y].Value, add.Value) } } } diff --git a/lib/dsv/claset_test.go b/lib/dsv/claset_test.go index 21ed197c..a38e0cdb 100644 --- a/lib/dsv/claset_test.go +++ b/lib/dsv/claset_test.go @@ -21,14 +21,14 @@ func TestReaderWithClaset(t *testing.T) { t.Fatal(e) } - test.Assert(t, "", 3, claset.GetClassIndex(), true) + test.Assert(t, "", 3, claset.GetClassIndex()) claset.SetMajorityClass("regular") claset.SetMinorityClass("vandalism") clone := claset.Clone().(tabula.ClasetInterface) - test.Assert(t, "", 3, clone.GetClassIndex(), true) - test.Assert(t, "", "regular", clone.MajorityClass(), true) - test.Assert(t, "", "vandalism", clone.MinorityClass(), true) + test.Assert(t, "", 3, clone.GetClassIndex()) + test.Assert(t, "", "regular", clone.MajorityClass()) + test.Assert(t, "", "vandalism", clone.MinorityClass()) } diff --git a/lib/dsv/common_test.go b/lib/dsv/common_test.go index 89321ea1..2133708d 100644 --- a/lib/dsv/common_test.go +++ b/lib/dsv/common_test.go @@ -63,7 +63,7 @@ func checkDataset(t *testing.T, r *Reader, exp string) { fmt.Println("data type unknown") } - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } // diff --git a/lib/dsv/reader_test.go b/lib/dsv/reader_test.go index 308ac757..a62e67fe 100644 --- a/lib/dsv/reader_test.go +++ b/lib/dsv/reader_test.go @@ -210,7 +210,7 @@ func doRead(t *testing.T, dsvReader *Reader, exp []string) { GetDataset().(tabula.DatasetInterface). GetDataAsRows()) - test.Assert(t, "", exp[i], r, true) + test.Assert(t, "", exp[i], r) i++ } else if e == io.EOF { @@ -332,7 +332,7 @@ func TestReaderToColumns(t *testing.T) { r := fmt.Sprint(ds.GetData()) - test.Assert(t, "", expectation[i], r, true) + test.Assert(t, "", expectation[i], r) i++ } else if e == io.EOF { @@ -382,7 +382,7 @@ func TestTransposeToColumns(t *testing.T) { got := fmt.Sprint(*columns) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) e = reader.Close() if e != nil { @@ -419,7 +419,7 @@ func TestSortColumnsByIndex(t *testing.T) { exp := strings.Join(expReverse, "") got := fmt.Sprint(ds.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) exp = "[" + strings.Join(expSkipColumnsAllRev, " ") + "]" @@ -427,7 +427,7 @@ func TestSortColumnsByIndex(t *testing.T) { got = fmt.Sprint(*columns) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) e = reader.Close() if e != nil { @@ -464,7 +464,7 @@ func TestSplitRowsByValue(t *testing.T) { got := fmt.Sprint(splitL.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // test right split exp = "" @@ -474,7 +474,7 @@ func TestSplitRowsByValue(t *testing.T) { got = fmt.Sprint(splitR.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) e = reader.Close() if e != nil { diff --git a/lib/email/body_test.go b/lib/email/body_test.go index 560c885f..409765dc 100644 --- a/lib/email/body_test.go +++ b/lib/email/body_test.go @@ -90,15 +90,15 @@ func TestParseBody(t *testing.T) { body, rest, err := ParseBody([]byte(c.in), []byte(c.boundary)) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } if body == nil { continue } - test.Assert(t, "rest", c.expRest, string(rest), true) - test.Assert(t, "body", c.exp, body.String(), true) + test.Assert(t, "rest", c.expRest, string(rest)) + test.Assert(t, "body", c.exp, body.String()) } } @@ -145,7 +145,7 @@ func TestBodyRelaxed(t *testing.T) { body.raw = []byte(c.in) got := body.Relaxed() - test.Assert(t, "Relaxed", c.exp, string(got), true) + test.Assert(t, "Relaxed", c.exp, string(got)) } } @@ -184,6 +184,6 @@ func TestBodySimple(t *testing.T) { body.raw = []byte(c.in) got := body.Simple() - test.Assert(t, "Simple", []byte(c.exp), got, true) + test.Assert(t, "Simple", []byte(c.exp), got) } } diff --git a/lib/email/contenttype_test.go b/lib/email/contenttype_test.go index d74cc458..8ebf7198 100644 --- a/lib/email/contenttype_test.go +++ b/lib/email/contenttype_test.go @@ -54,11 +54,11 @@ func TestParseContentType(t *testing.T) { got, err := ParseContentType(c.in) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "ContentType", c.exp, got.String(), true) + test.Assert(t, "ContentType", c.exp, got.String()) } } @@ -84,6 +84,6 @@ func TestGetParamValue(t *testing.T) { got := ct.GetParamValue(c.in) - test.Assert(t, "GetParamValue", c.exp, got, true) + test.Assert(t, "GetParamValue", c.exp, got) } } diff --git a/lib/email/dkim/dns_test.go b/lib/email/dkim/dns_test.go index 241e401f..084367f7 100644 --- a/lib/email/dkim/dns_test.go +++ b/lib/email/dkim/dns_test.go @@ -45,8 +45,7 @@ func TestNewDNSClientPool(t *testing.T) { if strings.Contains(err.Error(), c.expErrLookup) { continue } - test.Assert(t, "error lookup", c.expErrLookup, - err.Error(), true) + test.Assert(t, "error lookup", c.expErrLookup, err.Error()) } } diff --git a/lib/email/dkim/func_test.go b/lib/email/dkim/func_test.go index e74d7210..7c699cb0 100644 --- a/lib/email/dkim/func_test.go +++ b/lib/email/dkim/func_test.go @@ -41,7 +41,7 @@ func TestDecodeQP(t *testing.T) { got := DecodeQP(c.in) - test.Assert(t, "DecodeQP", c.exp, got, true) + test.Assert(t, "DecodeQP", c.exp, got) } } @@ -117,6 +117,6 @@ func TestCanonicalize(t *testing.T) { got := Canonicalize([]byte(c.in)) - test.Assert(t, "Canonicalize", c.exp, string(got), true) + test.Assert(t, "Canonicalize", c.exp, string(got)) } } diff --git a/lib/email/dkim/hashalg_test.go b/lib/email/dkim/hashalg_test.go index 67b12a90..e680f962 100644 --- a/lib/email/dkim/hashalg_test.go +++ b/lib/email/dkim/hashalg_test.go @@ -32,6 +32,6 @@ func TestUnpackHashAlg(t *testing.T) { algs := unpackHashAlgs([]byte(c.in)) got := packHashAlgs(algs) - test.Assert(t, "unpackHashAlgs", c.exp, string(got), true) + test.Assert(t, "unpackHashAlgs", c.exp, string(got)) } } diff --git a/lib/email/dkim/key_test.go b/lib/email/dkim/key_test.go index 156259e4..037b3eaa 100644 --- a/lib/email/dkim/key_test.go +++ b/lib/email/dkim/key_test.go @@ -22,7 +22,7 @@ func TestKeyLookupKey(t *testing.T) { expErr: "dkim: LookupKey: empty domain name", }, { domainName: "ug7nbtf4gccmlpwj322ax3p6ow6yfsug._domainkey.amazonses.com", - exp: "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCKkjP6XucgQ06cVZ89Ue/sQDu4v1/AJVd6mMK4bS2YmXk5PzWw4KWtWNUZlg77hegAChx1pG85lUbJ+x4awp28VXqRi3/jZoC6W+3ELysDvVohZPMRMadc+KVtyTiTH4BL38/8ZV9zkj4ZIaaYyiLAiYX+c3+lZQEF3rKDptRcpwIDAQAB", + exp: "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCT2DfRYLx3jUqqznIMCy08Zq2OahJC9i//ps0eF9AW3lPogTOI1cs5OntMVKJJ/THdkEZ2E0rLoYAcP2FaRs9ytw4VT6zgx+nYUAoh3O5wn1yVp9Z9VnUpglsiNerYxahiyR5C/0HJu4PfT8GZuJ6cOEToyBxOVrXcAfJ6Igu1jwIDAQAB", }, { domainName: "20150623._domainkey.wikimedia-or-id.20150623.gappssmtp.com", exp: "v=DKIM1; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2UMfREvlgajdSp3jv1tJ9nLpi/mRYnGyKC3inEQ9a7zqUjLq/yXukgpXs9AEHlvBvioxlgAVCPQQsuc1xp9+KXQGgJ8jTsn5OtKm8u+YBCt6OfvpeCpvt0l9JXMMHBNYV4c0XiPE5RHX2ltI0Av20CfEy+vMecpFtVDg4rMngjLws/ro6qT63S20A4zyVs/V19WW5F2Lulgv+l+EJzz9XummIJHOlU5n5ChcWU3Rw5RVGTtNjTZnFUaNXly3fW0ahKcG5Qc3e0Rhztp57JJQTl3OmHiMR5cHsCnrl1VnBi3kaOoQBYsSuBm+KRhMIw/X9wkLY67VLdkrwlX3xxsp6wIDAQAB; k=rsa", @@ -37,14 +37,14 @@ func TestKeyLookupKey(t *testing.T) { if strings.Contains(serr, "timeout") { continue } - test.Assert(t, "error", c.expErr, serr, true) + test.Assert(t, "error", c.expErr, serr) continue } if got == nil { continue } - test.Assert(t, "Key", c.exp, got.Pack(), true) + test.Assert(t, "Key", c.exp, got.Pack()) } } @@ -83,14 +83,14 @@ func TestKeyParseTXT(t *testing.T) { got, err := ParseTXT([]byte(c.txt), c.ttl) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } if got == nil { continue } - test.Assert(t, "ParseTXT", c.exp, got.Pack(), true) + test.Assert(t, "ParseTXT", c.exp, got.Pack()) } } @@ -107,9 +107,6 @@ func TestKeyLookupDNSTXT(t *testing.T) { }, { dname: "www.amazon.com", expErr: "dkim: LookupKey: no TXT record on 'www.amazon.com'", - }, { - dname: "www.google.com", - expErr: "dkim: LookupKey: empty answer on 'www.google.com'", }} for _, c := range cases { @@ -121,14 +118,14 @@ func TestKeyLookupDNSTXT(t *testing.T) { if strings.Contains(serr, "timeout") { continue } - test.Assert(t, "error", c.expErr, serr, true) + test.Assert(t, "error", c.expErr, serr) continue } if got == nil { continue } - test.Assert(t, "ParseTXT", c.exp, got.Pack(), true) + test.Assert(t, "ParseTXT", c.exp, got.Pack()) } } @@ -157,7 +154,7 @@ func TestKeyPack(t *testing.T) { for _, c := range cases { got := c.key.Pack() - test.Assert(t, "Key.Pack", c.exp, got, true) + test.Assert(t, "Key.Pack", c.exp, got) } } @@ -214,12 +211,12 @@ func TestKeySet(t *testing.T) { key := &Key{} err := key.set(c.in) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } got := key.Pack() - test.Assert(t, "Key.set", c.exp, got, true) + test.Assert(t, "Key.set", c.exp, got) } } diff --git a/lib/email/dkim/keypool_test.go b/lib/email/dkim/keypool_test.go index 47813759..37f7f529 100644 --- a/lib/email/dkim/keypool_test.go +++ b/lib/email/dkim/keypool_test.go @@ -14,12 +14,12 @@ import ( func TestKeyPoolClear(t *testing.T) { DefaultKeyPool.Put("example.com", &Key{ExpiredAt: 1}) got := DefaultKeyPool.String() - test.Assert(t, "DefaultKeyPool.Clear", "[{example.com 1}]", got, true) + test.Assert(t, "DefaultKeyPool.Clear", "[{example.com 1}]", got) DefaultKeyPool.Clear() got = DefaultKeyPool.String() - test.Assert(t, "DefaultKeyPool.Clear", "[]", got, true) + test.Assert(t, "DefaultKeyPool.Clear", "[]", got) } func TestKeyPoolPut(t *testing.T) { @@ -62,7 +62,7 @@ func TestKeyPoolPut(t *testing.T) { DefaultKeyPool.Put(c.dname, c.key) got := DefaultKeyPool.String() - test.Assert(t, "DefaultKeyPool", c.exp, got, true) + test.Assert(t, "DefaultKeyPool", c.exp, got) } } @@ -97,7 +97,7 @@ func TestKeyPoolGet(t *testing.T) { if strings.Contains(serr, "timeout") { continue } - test.Assert(t, "error", c.expErr, serr, true) + test.Assert(t, "error", c.expErr, serr) continue } if key == nil { @@ -105,6 +105,6 @@ func TestKeyPoolGet(t *testing.T) { } got := key.Pack() - test.Assert(t, "DefaultKeyPool.Get", c.exp, got, true) + test.Assert(t, "DefaultKeyPool.Get", c.exp, got) } } diff --git a/lib/email/dkim/signature_test.go b/lib/email/dkim/signature_test.go index 606e168a..c9a3f625 100644 --- a/lib/email/dkim/signature_test.go +++ b/lib/email/dkim/signature_test.go @@ -196,19 +196,19 @@ func TestSignatureParse(t *testing.T) { sig, err := Parse([]byte(c.in)) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } if sig == nil { continue } - test.Assert(t, "Signature.Relaxed", c.expRelaxed, string(sig.Relaxed()), true) - test.Assert(t, "Signature.Simple", c.expSimple, string(sig.Simple()), true) + test.Assert(t, "Signature.Relaxed", c.expRelaxed, string(sig.Relaxed())) + test.Assert(t, "Signature.Simple", c.expSimple, string(sig.Simple())) err = sig.Validate() if err != nil { - test.Assert(t, "Validate error", c.expValidateErr, err.Error(), true) + test.Assert(t, "Validate error", c.expValidateErr, err.Error()) } } } @@ -233,7 +233,7 @@ func TestNewSignature(t *testing.T) { got := NewSignature([]byte(c.sdid), []byte(c.selector)) - test.Assert(t, "Signature", c.exp, string(got.Relaxed()), true) + test.Assert(t, "Signature", c.exp, string(got.Relaxed())) } } @@ -272,7 +272,7 @@ func TestSignatureHash(t *testing.T) { _, got64 := sig.Hash([]byte(c.in)) - test.Assert(t, "Hash", c.exp, string(got64), true) + test.Assert(t, "Hash", c.exp, string(got64)) } } @@ -346,11 +346,11 @@ func TestSignatureSign(t *testing.T) { err := sig.Sign(c.pk, hashed) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "Signature", c.exp, string(sig.Value), true) + test.Assert(t, "Signature", c.exp, string(sig.Value)) } } @@ -481,13 +481,13 @@ func TestSignatureValidate(t *testing.T) { err := c.sig.Validate() if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } got := c.sig.Simple() - test.Assert(t, "Signature", c.exp, string(got), true) + test.Assert(t, "Signature", c.exp, string(got)) } } @@ -564,7 +564,7 @@ func TestSignatureVerify(t *testing.T) { err := sig.Verify(c.key, bhash) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) } } } @@ -587,12 +587,12 @@ func TestSignatureSet(t *testing.T) { sig := &Signature{} err := sig.set(c.t) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } got := sig.Simple() - test.Assert(t, "Signature", c.expSimple, string(got), true) + test.Assert(t, "Signature", c.expSimple, string(got)) } } diff --git a/lib/email/dkim/tag_test.go b/lib/email/dkim/tag_test.go index 3644f46a..eed60330 100644 --- a/lib/email/dkim/tag_test.go +++ b/lib/email/dkim/tag_test.go @@ -30,13 +30,13 @@ func TestNewTag(t *testing.T) { got, err := newTag([]byte(c.key)) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } if got == nil { continue } - test.Assert(t, "tag", c.exp, got, true) + test.Assert(t, "tag", c.exp, got) } } diff --git a/lib/email/field_test.go b/lib/email/field_test.go index 958f47d2..ee08dffc 100644 --- a/lib/email/field_test.go +++ b/lib/email/field_test.go @@ -123,20 +123,20 @@ func TestParseField(t *testing.T) { got, rest, err := ParseField(c.raw) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } if got == nil { - test.Assert(t, "Field", c.exp, got, true) + test.Assert(t, "Field", c.exp, got) continue } - test.Assert(t, "Field.oriName", c.exp.oriName, got.oriName, true) - test.Assert(t, "Field.oriValue", c.exp.oriValue, got.oriValue, true) - test.Assert(t, "Field.Name", c.exp.Name, got.Name, true) - test.Assert(t, "Field.Value", c.exp.Value, got.Value, true) + test.Assert(t, "Field.oriName", c.exp.oriName, got.oriName) + test.Assert(t, "Field.oriValue", c.exp.oriValue, got.oriValue) + test.Assert(t, "Field.Name", c.exp.Name, got.Name) + test.Assert(t, "Field.Value", c.exp.Value, got.Value) - test.Assert(t, "rest", c.expRest, rest, true) + test.Assert(t, "rest", c.expRest, rest) } } @@ -246,11 +246,11 @@ func TestUnpackDate(t *testing.T) { err := field.unpack() if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "date", c.exp.String(), field.date.String(), true) + test.Assert(t, "date", c.exp.String(), field.date.String()) } } @@ -275,17 +275,17 @@ func TestUnpackMailbox(t *testing.T) { field, _, err := ParseField(c.in) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } err = field.unpack() if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "Sender:", []byte(c.exp), field.Relaxed(), true) + test.Assert(t, "Sender:", []byte(c.exp), field.Relaxed()) } } @@ -307,17 +307,17 @@ func TestUnpackMailboxList(t *testing.T) { field, _, err := ParseField(c.in) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } err = field.unpack() if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "From:", []byte(c.exp), field.Relaxed(), true) + test.Assert(t, "From:", []byte(c.exp), field.Relaxed()) } } @@ -339,26 +339,26 @@ func TestUnpackContentType(t *testing.T) { field, _, err := ParseField(c.in) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } err = field.unpack() if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "Content-Type", c.exp, field.ContentType.String(), true) - test.Assert(t, "field.unpacked", true, field.unpacked, true) + test.Assert(t, "Content-Type", c.exp, field.ContentType.String()) + test.Assert(t, "field.unpacked", true, field.unpacked) err = field.unpack() if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "Content-Type", c.exp, field.ContentType.String(), true) - test.Assert(t, "field.unpacked", true, field.unpacked, true) + test.Assert(t, "Content-Type", c.exp, field.ContentType.String()) + test.Assert(t, "field.unpacked", true, field.unpacked) } } diff --git a/lib/email/header_test.go b/lib/email/header_test.go index f7104cf2..f0b8c86a 100644 --- a/lib/email/header_test.go +++ b/lib/email/header_test.go @@ -51,7 +51,7 @@ func TestHeaderBoundary(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Boundary", c.exp, header.Boundary(), true) + test.Assert(t, "Boundary", c.exp, header.Boundary()) } } @@ -115,17 +115,17 @@ func TestParseHeader(t *testing.T) { header, rest, err := ParseHeader(c.raw) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } if header == nil { continue } - test.Assert(t, "Header.Relaxed", []byte(c.exp), header.Relaxed(), true) - test.Assert(t, "rest", c.expRest, rest, true) + test.Assert(t, "Header.Relaxed", []byte(c.exp), header.Relaxed()) + test.Assert(t, "rest", c.expRest, rest) - test.Assert(t, "Header.Relaxed", []byte(c.expRelaxed), header.Relaxed(), true) - test.Assert(t, "Header.Simple", []byte(c.expSimple), header.Simple(), true) + test.Assert(t, "Header.Relaxed", []byte(c.expRelaxed), header.Relaxed()) + test.Assert(t, "Header.Simple", []byte(c.expSimple), header.Simple()) } } diff --git a/lib/email/is_test.go b/lib/email/is_test.go index 60fc73e4..a649f143 100644 --- a/lib/email/is_test.go +++ b/lib/email/is_test.go @@ -36,7 +36,7 @@ func TestIsValidLocal(t *testing.T) { got := IsValidLocal(c.in) - test.Assert(t, "IsValidLocal", c.exp, got, true) + test.Assert(t, "IsValidLocal", c.exp, got) } for k := range specialChars { @@ -48,6 +48,6 @@ func TestIsValidLocal(t *testing.T) { got := IsValidLocal(local) - test.Assert(t, "IsValidLocal", false, got, true) + test.Assert(t, "IsValidLocal", false, got) } } diff --git a/lib/email/mailbox_test.go b/lib/email/mailbox_test.go index 62038d52..3cd64dd0 100644 --- a/lib/email/mailbox_test.go +++ b/lib/email/mailbox_test.go @@ -40,10 +40,10 @@ func TestParseMailbox(t *testing.T) { for _, c := range cases { got, err := ParseMailbox([]byte(c.in)) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } - test.Assert(t, "ParseMailbox", c.exp, got, true) + test.Assert(t, "ParseMailbox", c.exp, got) } } @@ -211,12 +211,12 @@ func TestParseMailboxes(t *testing.T) { mboxes, err := ParseMailboxes([]byte(c.in)) if err != nil { exp := fmt.Sprintf(c.expErr, c.in) - test.Assert(t, "error", exp, err.Error(), true) + test.Assert(t, "error", exp, err.Error()) continue } got := fmt.Sprintf("%+v", mboxes) - test.Assert(t, "Mailboxes", c.exp, got, true) + test.Assert(t, "Mailboxes", c.exp, got) } } @@ -268,13 +268,13 @@ func TestSkipComment(t *testing.T) { r.SkipN(1) _, err := skipComment(r) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } got := string(r.Rest()) - test.Assert(t, "rest", c.exp, got, true) + test.Assert(t, "rest", c.exp, got) } } @@ -301,7 +301,7 @@ func TestMailbox_UnmarshalJSON(t *testing.T) { }, } - test.Assert(t, "UnmarshalJSON", exp, got, true) + test.Assert(t, "UnmarshalJSON", exp, got) } func TestMailbox_MarshalJSON(t *testing.T) { @@ -322,7 +322,7 @@ func TestMailbox_MarshalJSON(t *testing.T) { exp := `{"address":"Name \u003clocal@domain\u003e"}` - test.Assert(t, "MarshalJSON", exp, string(got), true) + test.Assert(t, "MarshalJSON", exp, string(got)) un := &ADT{} @@ -331,5 +331,5 @@ func TestMailbox_MarshalJSON(t *testing.T) { t.Fatal(err) } - test.Assert(t, "UnmarshalJSON", adt, un, true) + test.Assert(t, "UnmarshalJSON", adt, un) } diff --git a/lib/email/maildir/manager_test.go b/lib/email/maildir/manager_test.go index c4b2a2d9..3ad013f3 100644 --- a/lib/email/maildir/manager_test.go +++ b/lib/email/maildir/manager_test.go @@ -60,13 +60,13 @@ func TestOutQueue(t *testing.T) { err = mg.OutQueue(c.email) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } ls := lsDir(mg.dirOut) - test.Assert(t, "n List", c.expNList, len(ls), true) + test.Assert(t, "n List", c.expNList, len(ls)) } } @@ -78,7 +78,7 @@ func TestDeleteOutQueue(t *testing.T) { listOut := lsDir(mg.dirOut) - test.Assert(t, "n List", 1, len(listOut), true) + test.Assert(t, "n List", 1, len(listOut)) cases := []struct { desc string @@ -100,13 +100,13 @@ func TestDeleteOutQueue(t *testing.T) { err := mg.DeleteOutQueue(c.fname) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } ls := lsDir(mg.dirOut) - test.Assert(t, "n List", c.expNList, len(ls), true) + test.Assert(t, "n List", c.expNList, len(ls)) } } @@ -140,14 +140,14 @@ func TestIncoming(t *testing.T) { err := mg.Incoming(c.email) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } lsTmp := lsDir(mg.dirTmp) lsNew := lsDir(mg.dirNew) - test.Assert(t, "n list tmp", c.expNTmp, len(lsTmp), true) - test.Assert(t, "n list new", c.expNNew, len(lsNew), true) + test.Assert(t, "n list tmp", c.expNTmp, len(lsTmp)) + test.Assert(t, "n list new", c.expNNew, len(lsNew)) } } diff --git a/lib/email/message_test.go b/lib/email/message_test.go index 02720bb4..5822d5b1 100644 --- a/lib/email/message_test.go +++ b/lib/email/message_test.go @@ -95,15 +95,15 @@ func TestMessageParseMessage(t *testing.T) { msg, rest, err := ParseMessage(in) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } if msg == nil { continue } - test.Assert(t, "rest", c.expRest, string(rest), true) - test.Assert(t, "Message", c.exp, msg.String(), true) + test.Assert(t, "rest", c.expRest, string(rest)) + test.Assert(t, "Message", c.exp, msg.String()) } } @@ -141,11 +141,11 @@ func TestMessageDKIMVerify(t *testing.T) { gotStatus, err := msg.DKIMVerify() if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "dkim.Status", c.expStatus, gotStatus, true) + test.Assert(t, "dkim.Status", c.expStatus, gotStatus) } } @@ -193,16 +193,14 @@ func TestMessageDKIMSign(t *testing.T) { t.Fatal(err) } - test.Assert(t, "BodyHash", c.expBodyHash, - string(msg.DKIMSignature.BodyHash), true) - test.Assert(t, "Signature", c.expSignature, - string(msg.DKIMSignature.Value), true) + test.Assert(t, "BodyHash", c.expBodyHash, string(msg.DKIMSignature.BodyHash)) + test.Assert(t, "Signature", c.expSignature, string(msg.DKIMSignature.Value)) gotStatus, err := msg.DKIMVerify() if err != nil { t.Fatal(err) } - test.Assert(t, "dkim.Status", c.expStatus, gotStatus, true) + test.Assert(t, "dkim.Status", c.expStatus, gotStatus) } } diff --git a/lib/email/mime_test.go b/lib/email/mime_test.go index 591807ed..51826004 100644 --- a/lib/email/mime_test.go +++ b/lib/email/mime_test.go @@ -93,14 +93,14 @@ func TestParseBodyPart(t *testing.T) { got, rest, err := ParseBodyPart([]byte(c.in), []byte(c.boundary)) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } if got == nil { continue } - test.Assert(t, "Rest", c.expRest, string(rest), true) - test.Assert(t, "MIME", c.exp, got.String(), true) + test.Assert(t, "Rest", c.expRest, string(rest)) + test.Assert(t, "MIME", c.exp, got.String()) } } diff --git a/lib/floats64/floats64_test.go b/lib/floats64/floats64_test.go index 5f8a1c67..a2876eeb 100644 --- a/lib/floats64/floats64_test.go +++ b/lib/floats64/floats64_test.go @@ -36,61 +36,61 @@ var ( func TestMaxEmpty(t *testing.T) { gotv, goti, gotok := Max(d[0]) - test.Assert(t, "", float64(0), gotv, true) - test.Assert(t, "", 0, goti, true) - test.Assert(t, "", false, gotok, true) + test.Assert(t, "", float64(0), gotv) + test.Assert(t, "", 0, goti) + test.Assert(t, "", false, gotok) } func TestMax(t *testing.T) { gotv, goti, gotok := Max(d[1]) - test.Assert(t, "", float64(0.9), gotv, true) - test.Assert(t, "", 4, goti, true) - test.Assert(t, "", true, gotok, true) + test.Assert(t, "", float64(0.9), gotv) + test.Assert(t, "", 4, goti) + test.Assert(t, "", true, gotok) } func TestMinEmpty(t *testing.T) { gotv, goti, gotok := Min(d[0]) - test.Assert(t, "", gotv, float64(0), true) - test.Assert(t, "", goti, 0, true) - test.Assert(t, "", gotok, false, true) + test.Assert(t, "", gotv, float64(0)) + test.Assert(t, "", goti, 0) + test.Assert(t, "", gotok, false) } func TestMin(t *testing.T) { gotv, goti, gotok := Min(d[1]) - test.Assert(t, "", gotv, float64(0.0), true) - test.Assert(t, "", goti, 5, true) - test.Assert(t, "", gotok, true, true) + test.Assert(t, "", gotv, float64(0.0)) + test.Assert(t, "", goti, 5) + test.Assert(t, "", gotok, true) } func TestSum(t *testing.T) { got := Sum(d[1]) - test.Assert(t, "", float64(4.5), numbers.Float64Round(got, 1), true) + test.Assert(t, "", float64(4.5), numbers.Float64Round(got, 1)) } func TestCount(t *testing.T) { got := Count(d[0], 0) - test.Assert(t, "", 0, got, true) + test.Assert(t, "", 0, got) got = Count(d[1], 0.1) - test.Assert(t, "", 1, got, true) + test.Assert(t, "", 1, got) got = Count(d[2], 0.1) - test.Assert(t, "", 4, got, true) + test.Assert(t, "", 4, got) got = Count(d[3], 0.1) - test.Assert(t, "", 0, got, true) + test.Assert(t, "", 0, got) got = Count(d[3], 3) - test.Assert(t, "", 1, got, true) + test.Assert(t, "", 1, got) } func TestCountsEmpty(t *testing.T) { @@ -99,7 +99,7 @@ func TestCountsEmpty(t *testing.T) { got := Counts(d[0], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestCountsEmptyClasses(t *testing.T) { @@ -108,7 +108,7 @@ func TestCountsEmptyClasses(t *testing.T) { got := Counts(d[1], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestCounts(t *testing.T) { @@ -117,7 +117,7 @@ func TestCounts(t *testing.T) { got := Counts(d[3], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestMaxCountOf(t *testing.T) { @@ -125,13 +125,13 @@ func TestMaxCountOf(t *testing.T) { exp := float64(0) got, _ := MaxCountOf(d[2], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Swap the class values. classes = []float64{1, 0} got, _ = MaxCountOf(d[2], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestSwapEmpty(t *testing.T) { @@ -139,7 +139,7 @@ func TestSwapEmpty(t *testing.T) { Swap(d[0], 1, 6) - test.Assert(t, "", exp, d[0], true) + test.Assert(t, "", exp, d[0]) } func TestSwapEqual(t *testing.T) { @@ -151,7 +151,7 @@ func TestSwapEqual(t *testing.T) { Swap(in, 1, 1) - test.Assert(t, "", exp, in, true) + test.Assert(t, "", exp, in) } func TestSwapOutOfRange(t *testing.T) { @@ -163,7 +163,7 @@ func TestSwapOutOfRange(t *testing.T) { Swap(in, 1, 100) - test.Assert(t, "", exp, in, true) + test.Assert(t, "", exp, in) } func TestSwap(t *testing.T) { @@ -179,21 +179,21 @@ func TestSwap(t *testing.T) { exp[0] = exp[len(exp)-1] exp[len(exp)-1] = tmp - test.Assert(t, "", exp, in, true) + test.Assert(t, "", exp, in) } func TestIsExist(t *testing.T) { got := IsExist(d[0], 0) - test.Assert(t, "", false, got, true) + test.Assert(t, "", false, got) got = IsExist(d[1], float64(0)) - test.Assert(t, "", true, got, true) + test.Assert(t, "", true, got) got = IsExist(d[1], float64(0.01)) - test.Assert(t, "", false, got, true) + test.Assert(t, "", false, got) } func TestInplaceInsertionSort(t *testing.T) { @@ -209,7 +209,7 @@ func TestInplaceInsertionSort(t *testing.T) { InplaceInsertionSort(data, ids, 0, len(ids), true) - test.Assert(t, "", dSorted[x], data, true) + test.Assert(t, "", dSorted[x], data) } } @@ -226,7 +226,7 @@ func TestInplaceInsertionSortDesc(t *testing.T) { InplaceInsertionSort(data, ids, 0, len(ids), false) - test.Assert(t, "", dSortedDesc[x], data, true) + test.Assert(t, "", dSortedDesc[x], data) } } @@ -245,7 +245,7 @@ func TestSortByIndex(t *testing.T) { SortByIndex(&data, ids[x]) - test.Assert(t, "", dSorted[x], data, true) + test.Assert(t, "", dSorted[x], data) } } @@ -317,7 +317,7 @@ func TestIndirectSort(t *testing.T) { res = fmt.Sprint(inSorts[i]) exp = fmt.Sprint(expSorts[i]) - test.Assert(t, "", exp, res, true) + test.Assert(t, "", exp, res) } } @@ -330,7 +330,7 @@ func TestIndirectSortDesc(t *testing.T) { res = fmt.Sprint(inSorts[i]) exp = fmt.Sprint(expSortsDesc[i]) - test.Assert(t, "", exp, res, true) + test.Assert(t, "", exp, res) } } @@ -338,14 +338,14 @@ func TestIndirectSort_Stability(t *testing.T) { exp := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} got := IndirectSort(inSorts[5], true) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestIndirectSortDesc_Stability(t *testing.T) { exp := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} got := IndirectSort(inSorts[5], false) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestInplaceMergesort(t *testing.T) { @@ -354,7 +354,7 @@ func TestInplaceMergesort(t *testing.T) { InplaceMergesort(inSorts[6], idx, 0, size, true) - test.Assert(t, "", expSorts[6], inSorts[6], true) + test.Assert(t, "", expSorts[6], inSorts[6]) } func TestIndirectSort_SortByIndex(t *testing.T) { @@ -366,12 +366,12 @@ func TestIndirectSort_SortByIndex(t *testing.T) { sortedIds := IndirectSort(in1, true) - test.Assert(t, "", expIds, sortedIds, true) + test.Assert(t, "", expIds, sortedIds) // Reverse the sort. SortByIndex(&in2, sortedIds) got := fmt.Sprint(in2) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/git/git_test.go b/lib/git/git_test.go index 07bdb735..0e9bfaeb 100644 --- a/lib/git/git_test.go +++ b/lib/git/git_test.go @@ -38,11 +38,11 @@ func TestClone(t *testing.T) { err := Clone(_testRemoteURL, c.dest) if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) } - test.Assert(t, "stderr", c.expStderr, mock.Error(), true) - test.Assert(t, "stdout", c.expStdout, mock.Output(), true) + test.Assert(t, "stderr", c.expStderr, mock.Error()) + test.Assert(t, "stdout", c.expStdout, mock.Output()) } } @@ -78,11 +78,11 @@ Use '--' to separate paths from revisions, like this: err := CheckoutRevision(_testRepoDir, c.remote, c.branch, c.revision) if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) } - test.Assert(t, "stderr", c.expStderr, mock.Error(), true) - test.Assert(t, "stdout", c.expStdout, mock.Output(), true) + test.Assert(t, "stderr", c.expStderr, mock.Error()) + test.Assert(t, "stdout", c.expStdout, mock.Output()) } } @@ -108,12 +108,12 @@ func TestGetRemoteURL(t *testing.T) { got, err := GetRemoteURL(_testRepoDir, c.remoteName) if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) } - test.Assert(t, "url", c.exp, got, true) - test.Assert(t, "stderr", c.expStderr, mock.Error(), true) - test.Assert(t, "stdout", c.expStdout, mock.Output(), true) + test.Assert(t, "url", c.exp, got) + test.Assert(t, "stderr", c.expStderr, mock.Error()) + test.Assert(t, "stdout", c.expStdout, mock.Output()) } } @@ -144,11 +144,11 @@ func TestGetTag(t *testing.T) { got, err := GetTag(_testRepoDir, c.revision) if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) } - test.Assert(t, "stderr", c.expStderr, mock.Error(), true) - test.Assert(t, "stdout", c.expStdout, got, true) + test.Assert(t, "stderr", c.expStderr, mock.Error()) + test.Assert(t, "stdout", c.expStdout, got) } } @@ -175,11 +175,11 @@ func TestLatestCommit(t *testing.T) { got, err := LatestCommit(_testRepoDir, c.ref) if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) } - test.Assert(t, "stderr", c.expStderr, mock.Error(), true) - test.Assert(t, "stdout", c.expStdout, got, true) + test.Assert(t, "stderr", c.expStderr, mock.Error()) + test.Assert(t, "stdout", c.expStdout, got) } } @@ -200,11 +200,11 @@ func TestLatestTag(t *testing.T) { got, err := LatestTag(_testRepoDir) if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) } - test.Assert(t, "stderr", c.expStderr, mock.Error(), true) - test.Assert(t, "stdout", c.expStdout, got, true) + test.Assert(t, "stderr", c.expStderr, mock.Error()) + test.Assert(t, "stdout", c.expStdout, got) } } @@ -226,12 +226,12 @@ func TestLatestVersion(t *testing.T) { got, err := LatestVersion(_testRepoDir) if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) } - test.Assert(t, "version", c.exp, got, true) - test.Assert(t, "stderr", c.expStderr, mock.Error(), true) - test.Assert(t, "stdout", c.expStdout, mock.Output(), true) + test.Assert(t, "version", c.exp, got) + test.Assert(t, "stderr", c.expStderr, mock.Error()) + test.Assert(t, "stdout", c.expStdout, mock.Output()) } } @@ -251,11 +251,11 @@ func TestListTag(t *testing.T) { got, err := ListTags(_testRepoDir) if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) continue } - test.Assert(t, "tags", c.exp, got, true) + test.Assert(t, "tags", c.exp, got) } } @@ -295,11 +295,11 @@ ec65455 Add feature A. err := LogRevisions(_testRepoDir, c.prevRevision, c.nextRevision) if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) } - test.Assert(t, "stderr", c.expStderr, mock.Error(), true) - test.Assert(t, "stdout", c.expStdout, mock.Output(), true) + test.Assert(t, "stderr", c.expStderr, mock.Error()) + test.Assert(t, "stdout", c.expStdout, mock.Output()) } } @@ -333,8 +333,8 @@ func TestRemoteChange(t *testing.T) { t.Fatalf("expecting error like %q, got %q", c.expErr, err.Error()) } - test.Assert(t, "stderr", c.expStderr, mock.Error(), true) - test.Assert(t, "stdout", c.expStdout, mock.Output(), true) + test.Assert(t, "stderr", c.expStderr, mock.Error()) + test.Assert(t, "stdout", c.expStdout, mock.Output()) } } diff --git a/lib/http/requestmethod_test.go b/lib/http/requestmethod_test.go index dde4b0fd..e0ef4cae 100644 --- a/lib/http/requestmethod_test.go +++ b/lib/http/requestmethod_test.go @@ -37,6 +37,6 @@ func TestRequestMethod_String(t *testing.T) { } for _, c := range cases { - test.Assert(t, "RequestMethod.String", c.exp, c.m.String(), true) + test.Assert(t, "RequestMethod.String", c.exp, c.m.String()) } } diff --git a/lib/http/requesttype_test.go b/lib/http/requesttype_test.go index 52aaef36..85f30f3e 100644 --- a/lib/http/requesttype_test.go +++ b/lib/http/requesttype_test.go @@ -23,6 +23,6 @@ func TestRequestType_String(t *testing.T) { } for _, c := range cases { - test.Assert(t, "RequestMethod.String", c.exp, c.rt.String(), true) + test.Assert(t, "RequestMethod.String", c.exp, c.rt.String()) } } diff --git a/lib/http/response_test.go b/lib/http/response_test.go index ffd57388..4625b35d 100644 --- a/lib/http/response_test.go +++ b/lib/http/response_test.go @@ -107,12 +107,12 @@ func TestParseResponseHeader(t *testing.T) { got, rest, err := ParseResponseHeader(c.raw) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "http.Response", c.expResp, got, true) - test.Assert(t, "rest", c.expRest, rest, true) + test.Assert(t, "http.Response", c.expResp, got) + test.Assert(t, "rest", c.expRest, rest) } } @@ -176,11 +176,11 @@ func TestParseHeaders(t *testing.T) { header, rest, err := parseHeaders(c.raw) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "header", c.exp, header, true) - test.Assert(t, "rest", c.expRest, rest, true) + test.Assert(t, "header", c.exp, header) + test.Assert(t, "rest", c.expRest, rest) } } diff --git a/lib/http/responsetype_test.go b/lib/http/responsetype_test.go index 030fc8f8..2a2926c3 100644 --- a/lib/http/responsetype_test.go +++ b/lib/http/responsetype_test.go @@ -30,6 +30,6 @@ func TestResponseType_String(t *testing.T) { } for _, c := range cases { - test.Assert(t, "ResponseType.String", c.exp, c.restype.String(), true) + test.Assert(t, "ResponseType.String", c.exp, c.restype.String()) } } diff --git a/lib/http/route_test.go b/lib/http/route_test.go index 83cfc491..1a84c447 100644 --- a/lib/http/route_test.go +++ b/lib/http/route_test.go @@ -106,11 +106,11 @@ func TestNewRoute(t *testing.T) { got, err := newRoute(c.ep) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } - test.Assert(t, "newRoute", c.exp, got, true) + test.Assert(t, "newRoute", c.exp, got) } } @@ -242,8 +242,8 @@ func TestRoute_parse(t *testing.T) { for _, tp := range c.paths { gotVals, gotOK := rute.parse(tp.path) - test.Assert(t, "vals", tp.expVals, gotVals, true) - test.Assert(t, "ok", tp.expOK, gotOK, true) + test.Assert(t, "vals", tp.expVals, gotVals) + test.Assert(t, "ok", tp.expOK, gotOK) } } } diff --git a/lib/http/server_test.go b/lib/http/server_test.go index 91564f27..1f87fa45 100644 --- a/lib/http/server_test.go +++ b/lib/http/server_test.go @@ -129,7 +129,7 @@ func TestRegisterDelete(t *testing.T) { err := testServer.RegisterEndpoint(c.ep) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } @@ -157,17 +157,17 @@ func TestRegisterDelete(t *testing.T) { t.Fatal(e) } - test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode, - true) + test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode) + if c.expStatusCode != http.StatusOK { continue } - test.Assert(t, "Body", c.expBody, string(body), true) + test.Assert(t, "Body", c.expBody, string(body)) gotContentType := res.Header.Get(HeaderContentType) - test.Assert(t, "Content-Type", c.expContentType, gotContentType, true) + test.Assert(t, "Content-Type", c.expContentType, gotContentType) } } @@ -235,8 +235,7 @@ func TestRegisterEvaluator(t *testing.T) { t.Fatal(e) } - test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode, - true) + test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode) } } @@ -304,8 +303,8 @@ func TestRegisterGet(t *testing.T) { t.Fatal(e) } - test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode, true) - test.Assert(t, "Body", c.expBody, string(body), true) + test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode) + test.Assert(t, "Body", c.expBody, string(body)) } } @@ -371,13 +370,10 @@ func TestRegisterHead(t *testing.T) { t.Fatal(e) } - test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode, - true) - test.Assert(t, "Body", c.expBody, string(body), true) - test.Assert(t, "Header.ContentType", c.expContentType, - res.Header[HeaderContentType], true) - test.Assert(t, "Header.ContentLength", c.expContentLength, - res.Header[HeaderContentLength], true) + test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode) + test.Assert(t, "Body", c.expBody, string(body)) + test.Assert(t, "Header.ContentType", c.expContentType, res.Header[HeaderContentType]) + test.Assert(t, "Header.ContentLength", c.expContentLength, res.Header[HeaderContentLength]) } } @@ -438,9 +434,8 @@ func TestRegisterPatch(t *testing.T) { t.Fatal(e) } - test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode, - true) - test.Assert(t, "Body", c.expBody, string(body), true) + test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode) + test.Assert(t, "Body", c.expBody, string(body)) } } @@ -511,9 +506,8 @@ k=vv`, t.Fatal(e) } - test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode, - true) - test.Assert(t, "Body", c.expBody, string(body), true) + test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode) + test.Assert(t, "Body", c.expBody, string(body)) } } @@ -571,9 +565,8 @@ func TestRegisterPut(t *testing.T) { t.Fatal(e) } - test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode, - true) - test.Assert(t, "Body", c.expBody, string(body), true) + test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode) + test.Assert(t, "Body", c.expBody, string(body)) } } @@ -637,9 +630,8 @@ func TestServeHTTPOptions(t *testing.T) { gotAllow := res.Header.Get("Allow") - test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode, - true) - test.Assert(t, "Allow", c.expAllow, gotAllow, true) + test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode) + test.Assert(t, "Allow", c.expAllow, gotAllow) } } @@ -791,8 +783,7 @@ func TestStatusError(t *testing.T) { t.Fatal(e) } - test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode, - true) - test.Assert(t, "Body", c.expBody, string(body), true) + test.Assert(t, "StatusCode", c.expStatusCode, res.StatusCode) + test.Assert(t, "Body", c.expBody, string(body)) } } diff --git a/lib/hunspell/affix_rule_test.go b/lib/hunspell/affix_rule_test.go index a7f4cfd6..fcd2ca9c 100644 --- a/lib/hunspell/affix_rule_test.go +++ b/lib/hunspell/affix_rule_test.go @@ -56,6 +56,6 @@ func TestNewAffixRule_prefix(t *testing.T) { t.Fatal(err) } - test.Assert(t, "newAffixRule", c.exp, got, true) + test.Assert(t, "newAffixRule", c.exp, got) } } diff --git a/lib/hunspell/affix_test.go b/lib/hunspell/affix_test.go index 39eecb78..deb2401c 100644 --- a/lib/hunspell/affix_test.go +++ b/lib/hunspell/affix_test.go @@ -58,7 +58,7 @@ func TestPrefix_apply(t *testing.T) { got = append(got, stem.Word) } - test.Assert(t, "Prefix.apply", c.exp, got, true) + test.Assert(t, "Prefix.apply", c.exp, got) } } @@ -110,6 +110,6 @@ func TestSuffix_apply(t *testing.T) { got = append(got, stem.Word) } - test.Assert(t, "Suffix.apply", c.exp, got, true) + test.Assert(t, "Suffix.apply", c.exp, got) } } diff --git a/lib/hunspell/hunspell_test.go b/lib/hunspell/hunspell_test.go index 45880cf6..70e7101e 100644 --- a/lib/hunspell/hunspell_test.go +++ b/lib/hunspell/hunspell_test.go @@ -55,7 +55,7 @@ work/B } if n == 0 { - test.Assert(t, c.desc, c.expN, n, true) + test.Assert(t, c.desc, c.expN, n) continue } @@ -64,6 +64,6 @@ work/B t.Fatalf("%s: %s", c.desc, err) } - test.Assert(t, c.desc, c.exp, string(got), true) + test.Assert(t, c.desc, c.exp, string(got)) } } diff --git a/lib/hunspell/spell_test.go b/lib/hunspell/spell_test.go index f2af359d..4bbebb41 100644 --- a/lib/hunspell/spell_test.go +++ b/lib/hunspell/spell_test.go @@ -46,6 +46,6 @@ func TestSpell_parseMap(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Map", c.exp, spell.opts.charsMaps, true) + test.Assert(t, "Map", c.exp, spell.opts.charsMaps) } } diff --git a/lib/hunspell/stem_test.go b/lib/hunspell/stem_test.go index dd555db3..fbf368c5 100644 --- a/lib/hunspell/stem_test.go +++ b/lib/hunspell/stem_test.go @@ -150,11 +150,11 @@ func TestParseStem(t *testing.T) { got, err := parseStem(c.line) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } - test.Assert(t, "stem", c.exp, got, true) + test.Assert(t, "stem", c.exp, got) } } @@ -343,7 +343,7 @@ func TestStem_unpack(t *testing.T) { for _, c := range cases { gotDerivatives, err := c.in.unpack(opts) if err != nil { - test.Assert(t, "unpack error", c.expError, err.Error(), true) + test.Assert(t, "unpack error", c.expError, err.Error()) } got := make([]string, 0, len(gotDerivatives)) @@ -351,7 +351,7 @@ func TestStem_unpack(t *testing.T) { got = append(got, der.Word) } - test.Assert(t, c.desc+" derivatives", c.expDerivatives, got, true) - test.Assert(t, c.desc+" after", c.expStem, c.in, true) + test.Assert(t, c.desc+" derivatives", c.expDerivatives, got) + test.Assert(t, c.desc+" after", c.expStem, c.in) } } diff --git a/lib/hunspell/tests/all_test.go b/lib/hunspell/tests/all_test.go index 3d56a833..ef85b871 100644 --- a/lib/hunspell/tests/all_test.go +++ b/lib/hunspell/tests/all_test.go @@ -60,14 +60,11 @@ func TestHunspell(t *testing.T) { for _, morph := range expMorphs { gotAnalyze := spell.Analyze(morph.word) - test.Assert(t, "Analyze("+morph.word+")", - morph.analyze.String(), gotAnalyze.String(), - true) + test.Assert(t, "Analyze("+morph.word+")", morph.analyze.String(), gotAnalyze.String()) gotStem := spell.Stem(morph.word) - test.Assert(t, "Stem("+morph.word+")", - morph.stem, gotStem.Word, true) + test.Assert(t, "Stem("+morph.word+")", morph.stem, gotStem.Word) } } } diff --git a/lib/hunspell/tests/morphology_test.go b/lib/hunspell/tests/morphology_test.go index 65da711d..06aafa32 100644 --- a/lib/hunspell/tests/morphology_test.go +++ b/lib/hunspell/tests/morphology_test.go @@ -46,11 +46,11 @@ func TestMorphology_parseAnalyze(t *testing.T) { err := got.parseAnalyze(c.line) if err != nil { - test.Assert(t, c.line, c.expError, err.Error(), true) + test.Assert(t, c.line, c.expError, err.Error()) continue } - test.Assert(t, c.line, c.exp, got.analyze, true) + test.Assert(t, c.line, c.exp, got.analyze) } } @@ -74,9 +74,9 @@ func TestMorphology_parseStem(t *testing.T) { for _, c := range cases { err := got.parseStem(c.line) if err != nil { - test.Assert(t, c.line+" error", c.expError, err.Error(), true) + test.Assert(t, c.line+" error", c.expError, err.Error()) continue } - test.Assert(t, c.line, c.exp, got.stem, true) + test.Assert(t, c.line, c.exp, got.stem) } } diff --git a/lib/ini/common_test.go b/lib/ini/common_test.go index 7e5059b8..09dd33ee 100644 --- a/lib/ini/common_test.go +++ b/lib/ini/common_test.go @@ -48,6 +48,6 @@ func TestIsValueBoolTrue(t *testing.T) { got := IsValueBoolTrue(c.v) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } diff --git a/lib/ini/ini_test.go b/lib/ini/ini_test.go index 3b543080..16b7d4d3 100644 --- a/lib/ini/ini_test.go +++ b/lib/ini/ini_test.go @@ -56,7 +56,7 @@ func TestOpen(t *testing.T) { _, err := Open(c.inFile) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } } @@ -90,13 +90,13 @@ func TestSave(t *testing.T) { cfg, err := Open(c.inFile) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } err = cfg.Save(c.outFile) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) } } } @@ -132,7 +132,7 @@ func TestAddSection(t *testing.T) { in.addSection(c.sec) - test.Assert(t, "ini", c.expIni, in, true) + test.Assert(t, "ini", c.expIni, in) } } @@ -193,11 +193,11 @@ func TestGet(t *testing.T) { got, ok = inputIni.Get(c.sec, c.sub, c.key, "") if !ok { - test.Assert(t, "ok", c.expOk, ok, true) + test.Assert(t, "ok", c.expOk, ok) continue } - test.Assert(t, "value", c.expVal, got, true) + test.Assert(t, "value", c.expVal, got) } } @@ -234,7 +234,7 @@ func TestGetDefault(t *testing.T) { got, _ := cfg.Get(c.sec, c.sub, c.key, c.def) - test.Assert(t, "string", c.exp, got, true) + test.Assert(t, "string", c.exp, got) } } @@ -449,11 +449,11 @@ func TestGetInputIni(t *testing.T) { got, ok = inputIni.Get(c.sec, c.sub, k, "") if !ok { t.Logf("Get: %s > %s > %s", c.sec, c.sub, k) - test.Assert(t, "ok", true, ok, true) + test.Assert(t, "ok", true, ok) t.FailNow() } - test.Assert(t, "value", c.expVals[x], got, true) + test.Assert(t, "value", c.expVals[x], got) } } } @@ -500,11 +500,11 @@ func TestGetSectionDup(t *testing.T) { got, ok := cfg.Get(c.sec, c.sub, k, "") if !ok { - test.Assert(t, "ok", c.expOK[x], ok, true) + test.Assert(t, "ok", c.expOK[x], ok) continue } - test.Assert(t, k, c.expVals[x], got, true) + test.Assert(t, k, c.expVals[x], got) } } } @@ -559,11 +559,11 @@ func TestGetVarMultiEmpty(t *testing.T) { got, ok := cfg.Get(c.sec, c.sub, k, "") if !ok { - test.Assert(t, "ok", c.expOK[x], ok, true) + test.Assert(t, "ok", c.expOK[x], ok) continue } - test.Assert(t, k, c.expVals[x], got, true) + test.Assert(t, k, c.expVals[x], got) } } } @@ -615,11 +615,11 @@ func TestGetVarMultiSection(t *testing.T) { got, ok := cfg.Get(c.sec, c.sub, k, "") if !ok { - test.Assert(t, "ok", c.expOK[x], ok, true) + test.Assert(t, "ok", c.expOK[x], ok) continue } - test.Assert(t, k, c.expVals[x], got, true) + test.Assert(t, k, c.expVals[x], got) } } } @@ -651,7 +651,7 @@ xx = 4 t.Fatal(err) } - test.Assert(t, "TestMarshal_embedded", exp, string(got), true) + test.Assert(t, "TestMarshal_embedded", exp, string(got)) } func TestUnmarshal_embedded(t *testing.T) { @@ -680,5 +680,5 @@ xx = 4 t.Fatal(err) } - test.Assert(t, "TestUnmarshal_embedded", exp, got, true) + test.Assert(t, "TestUnmarshal_embedded", exp, got) } diff --git a/lib/ini/ini_unmarshal_test.go b/lib/ini/ini_unmarshal_test.go index e64d68dd..abfdaecd 100644 --- a/lib/ini/ini_unmarshal_test.go +++ b/lib/ini/ini_unmarshal_test.go @@ -119,7 +119,7 @@ time = 2021-02-28 00:12:05 PtrTime: &ptrTime, } - test.Assert(t, "Unmarshal", exp, got, true) + test.Assert(t, "Unmarshal", exp, got) } func TestIni_Unmarshal_sliceOfStruct(t *testing.T) { @@ -149,7 +149,7 @@ int = 2 }}, } - test.Assert(t, "Unmarshal slice of struct", exp, got, true) + test.Assert(t, "Unmarshal slice of struct", exp, got) } func TestIni_Unmarshal_sliceOfPrimitive(t *testing.T) { @@ -191,7 +191,7 @@ time = 2021-02-28 03:56:02 }, } - test.Assert(t, "Unmarshal slice of primitive", exp, got, true) + test.Assert(t, "Unmarshal slice of primitive", exp, got) } func TestIni_Unmarshal_sliceOfPointer(t *testing.T) { @@ -250,5 +250,5 @@ time = 2021-02-28 03:56:02 SlicePtrTime: []*time.Time{&time0, &time1}, } - test.Assert(t, "Unmarshal slice of pointer", exp, got, true) + test.Assert(t, "Unmarshal slice of pointer", exp, got) } diff --git a/lib/ini/reader_test.go b/lib/ini/reader_test.go index d79e56f8..e1d3a4e4 100644 --- a/lib/ini/reader_test.go +++ b/lib/ini/reader_test.go @@ -108,17 +108,17 @@ func TestParseSectionHeader(t *testing.T) { err := reader.parseSectionHeader() if err != nil { - test.Assert(t, "error", c.expErr, err, true) + test.Assert(t, "error", c.expErr, err) if err != io.EOF { continue } } - test.Assert(t, "mode", c.expMode, reader._var.mode, true) - test.Assert(t, "format", c.expFormat, reader._var.format, true) - test.Assert(t, "section", c.expSecName, reader._var.secName, true) - test.Assert(t, "subsection", c.expSubName, reader._var.subName, true) - test.Assert(t, "comment", c.expComment, reader._var.others, true) + test.Assert(t, "mode", c.expMode, reader._var.mode) + test.Assert(t, "format", c.expFormat, reader._var.format) + test.Assert(t, "section", c.expSecName, reader._var.secName) + test.Assert(t, "subsection", c.expSubName, reader._var.subName) + test.Assert(t, "comment", c.expComment, reader._var.others) } } @@ -163,16 +163,16 @@ func TestParseSubsection(t *testing.T) { err := reader.parseSubsection() if err != nil { - test.Assert(t, "error", c.expErr, err, true) + test.Assert(t, "error", c.expErr, err) if err != io.EOF { continue } } - test.Assert(t, "mode", c.expMode, reader._var.mode, true) - test.Assert(t, "format", c.expFormat, reader._var.format, true) - test.Assert(t, "subsection", c.expSub, reader._var.subName, true) - test.Assert(t, "comment", c.expComment, reader._var.others, true) + test.Assert(t, "mode", c.expMode, reader._var.mode) + test.Assert(t, "format", c.expFormat, reader._var.format) + test.Assert(t, "subsection", c.expSub, reader._var.subName) + test.Assert(t, "comment", c.expComment, reader._var.others) } } @@ -330,17 +330,17 @@ func TestParseVariable(t *testing.T) { err := reader.parseVariable() if err != nil { - test.Assert(t, "error", c.expErr, err, true) + test.Assert(t, "error", c.expErr, err) if err != io.EOF { continue } } - test.Assert(t, "mode", c.expMode, reader._var.mode, true) - test.Assert(t, "format", c.expFormat, reader._var.format, true) - test.Assert(t, "key", c.expKey, reader._var.key, true) - test.Assert(t, "value", c.expValue, reader._var.value, true) - test.Assert(t, "comment", c.expComment, reader._var.others, true) + test.Assert(t, "mode", c.expMode, reader._var.mode) + test.Assert(t, "format", c.expFormat, reader._var.format) + test.Assert(t, "key", c.expKey, reader._var.key) + test.Assert(t, "value", c.expValue, reader._var.value) + test.Assert(t, "comment", c.expComment, reader._var.others) } } @@ -482,14 +482,14 @@ func TestParseVarValue(t *testing.T) { err := reader.parseVarValue() if err != nil { - test.Assert(t, "error", c.expErr, err, true) + test.Assert(t, "error", c.expErr, err) if err != io.EOF { continue } } - test.Assert(t, "format", c.expFormat, reader._var.format, true) - test.Assert(t, "value", c.expValue, reader._var.value, true) - test.Assert(t, "comment", c.expComment, reader._var.others, true) + test.Assert(t, "format", c.expFormat, reader._var.format) + test.Assert(t, "value", c.expValue, reader._var.value) + test.Assert(t, "comment", c.expComment, reader._var.others) } } diff --git a/lib/ini/section_test.go b/lib/ini/section_test.go index 3f1af30b..c0de6534 100644 --- a/lib/ini/section_test.go +++ b/lib/ini/section_test.go @@ -46,7 +46,7 @@ func TestNewSection(t *testing.T) { got := newSection(c.name, c.sub) - test.Assert(t, "section", c.expSec, got, true) + test.Assert(t, "section", c.expSec, got) } } @@ -121,8 +121,8 @@ func TestSectionSet(t *testing.T) { ok := sec.set(c.k, c.v) - test.Assert(t, "ok", c.expOK, ok, true) - test.Assert(t, "section", c.expSec, sec, true) + test.Assert(t, "ok", c.expOK, ok) + test.Assert(t, "section", c.expSec, sec) } } @@ -221,7 +221,7 @@ func TestSection_add(t *testing.T) { sec.add(c.k, c.v) - test.Assert(t, "section", c.expSec, sec, true) + test.Assert(t, "section", c.expSec, sec) } } @@ -313,8 +313,8 @@ func TestSectionUnset(t *testing.T) { ok := sec.unset(c.k) - test.Assert(t, "ok", c.expOK, ok, true) - test.Assert(t, "section", c.expSec, sec, true) + test.Assert(t, "ok", c.expOK, ok) + test.Assert(t, "section", c.expSec, sec) } } @@ -400,7 +400,7 @@ func TestSectionUnsetAll(t *testing.T) { sec.unsetAll(c.k) - test.Assert(t, "section", c.expSec, sec, true) + test.Assert(t, "section", c.expSec, sec) } } @@ -511,7 +511,7 @@ func TestSection_replaceAll(t *testing.T) { sec.replaceAll(c.k, c.v) - test.Assert(t, "section", c.expSec, sec, true) + test.Assert(t, "section", c.expSec, sec) } } @@ -557,8 +557,8 @@ func TestSectionGet(t *testing.T) { got, ok := sec.get(c.k, c.def) - test.Assert(t, "ok", c.expOK, ok, true) - test.Assert(t, "value", c.expVal, got, true) + test.Assert(t, "ok", c.expOK, ok) + test.Assert(t, "value", c.expVal, got) } } @@ -609,7 +609,7 @@ func TestSectionGets(t *testing.T) { got, ok := sec.gets(c.key, c.defs) - test.Assert(t, "Gets value", c.exps, got, true) - test.Assert(t, "Gets ok", c.expOK, ok, true) + test.Assert(t, "Gets value", c.exps, got) + test.Assert(t, "Gets ok", c.expOK, ok) } } diff --git a/lib/ini/tag_struct_field_test.go b/lib/ini/tag_struct_field_test.go index 2c41ee8e..40c3a2fd 100644 --- a/lib/ini/tag_struct_field_test.go +++ b/lib/ini/tag_struct_field_test.go @@ -66,7 +66,7 @@ func TestUnpackStruct(t *testing.T) { "slice:OfStruct", } - test.Assert(t, "unpackStruct", exp, got.keys(), true) + test.Assert(t, "unpackStruct", exp, got.keys()) } func TestUnpackStruct_embedded(t *testing.T) { @@ -99,5 +99,5 @@ func TestUnpackStruct_embedded(t *testing.T) { "b::z", "c::xx", } - test.Assert(t, "unpackStruct embedded", exp, got.keys(), true) + test.Assert(t, "unpackStruct embedded", exp, got.keys()) } diff --git a/lib/ini/variable_test.go b/lib/ini/variable_test.go index 96f5c901..b53e5dc6 100644 --- a/lib/ini/variable_test.go +++ b/lib/ini/variable_test.go @@ -28,7 +28,7 @@ func TestVariableEscape(t *testing.T) { for _, c := range cases { t.Log(c.desc) got := escape(c.in) - test.Assert(t, "escape", c.exp, got, true) + test.Assert(t, "escape", c.exp, got) } } @@ -105,6 +105,6 @@ func TestVariableString(t *testing.T) { got := c.v.String() - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } diff --git a/lib/ints/ints_test.go b/lib/ints/ints_test.go index 6393cd01..b9179479 100644 --- a/lib/ints/ints_test.go +++ b/lib/ints/ints_test.go @@ -36,61 +36,61 @@ var ( func TestMaxEmpty(t *testing.T) { maxv, maxi, ok := Max(d[0]) - test.Assert(t, "", 0, maxv, true) - test.Assert(t, "", 0, maxi, true) - test.Assert(t, "", false, ok, true) + test.Assert(t, "", 0, maxv) + test.Assert(t, "", 0, maxi) + test.Assert(t, "", false, ok) } func TestMax(t *testing.T) { maxv, maxi, ok := Max(d[1]) - test.Assert(t, "", 9, maxv, true) - test.Assert(t, "", 4, maxi, true) - test.Assert(t, "", true, ok, true) + test.Assert(t, "", 9, maxv) + test.Assert(t, "", 4, maxi) + test.Assert(t, "", true, ok) } func TestMinEmpty(t *testing.T) { minv, mini, ok := Min(d[0]) - test.Assert(t, "", 0, minv, true) - test.Assert(t, "", 0, mini, true) - test.Assert(t, "", false, ok, true) + test.Assert(t, "", 0, minv) + test.Assert(t, "", 0, mini) + test.Assert(t, "", false, ok) } func TestMin(t *testing.T) { minv, mini, ok := Min(d[1]) - test.Assert(t, "", 0, minv, true) - test.Assert(t, "", 5, mini, true) - test.Assert(t, "", true, ok, true) + test.Assert(t, "", 0, minv) + test.Assert(t, "", 5, mini) + test.Assert(t, "", true, ok) } func TestSum(t *testing.T) { got := Sum(d[1]) - test.Assert(t, "", 45, got, true) + test.Assert(t, "", 45, got) } func TestCount(t *testing.T) { got := Count(d[0], 0) - test.Assert(t, "", 0, got, true) + test.Assert(t, "", 0, got) got = Count(d[1], 1) - test.Assert(t, "", 1, got, true) + test.Assert(t, "", 1, got) got = Count(d[2], 1) - test.Assert(t, "", 4, got, true) + test.Assert(t, "", 4, got) got = Count(d[3], 0) - test.Assert(t, "", 0, got, true) + test.Assert(t, "", 0, got) got = Count(d[3], 3) - test.Assert(t, "", 1, got, true) + test.Assert(t, "", 1, got) } func TestCountsEmpty(t *testing.T) { @@ -99,7 +99,7 @@ func TestCountsEmpty(t *testing.T) { got := Counts(d[0], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestCountsEmptyClasses(t *testing.T) { @@ -108,7 +108,7 @@ func TestCountsEmptyClasses(t *testing.T) { got := Counts(d[1], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestCounts(t *testing.T) { @@ -117,7 +117,7 @@ func TestCounts(t *testing.T) { got := Counts(d[3], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestMaxCountOf(t *testing.T) { @@ -125,13 +125,13 @@ func TestMaxCountOf(t *testing.T) { exp := int(0) got, _ := MaxCountOf(d[2], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Swap the class values. classes = []int{1, 0} got, _ = MaxCountOf(d[2], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestSwapEmpty(t *testing.T) { @@ -139,7 +139,7 @@ func TestSwapEmpty(t *testing.T) { Swap(d[0], 1, 6) - test.Assert(t, "", exp, d[0], true) + test.Assert(t, "", exp, d[0]) } func TestSwapEqual(t *testing.T) { @@ -151,7 +151,7 @@ func TestSwapEqual(t *testing.T) { Swap(in, 1, 1) - test.Assert(t, "", exp, in, true) + test.Assert(t, "", exp, in) } func TestSwapOutOfRange(t *testing.T) { @@ -163,7 +163,7 @@ func TestSwapOutOfRange(t *testing.T) { Swap(in, 1, 100) - test.Assert(t, "", exp, in, true) + test.Assert(t, "", exp, in) } func TestSwap(t *testing.T) { @@ -179,7 +179,7 @@ func TestSwap(t *testing.T) { exp[0] = exp[len(exp)-1] exp[len(exp)-1] = tmp - test.Assert(t, "", exp, in, true) + test.Assert(t, "", exp, in) } func TestIsExist(t *testing.T) { @@ -190,16 +190,16 @@ func TestIsExist(t *testing.T) { for _, v := range d { s = IsExist(d, v) - test.Assert(t, "", true, s, true) + test.Assert(t, "", true, s) } } // False positive. for _, d := range d { s = IsExist(d, -1) - test.Assert(t, "", false, s, true) + test.Assert(t, "", false, s) s = IsExist(d, 10) - test.Assert(t, "", false, s, true) + test.Assert(t, "", false, s) } } @@ -216,7 +216,7 @@ func TestInplaceInsertionSort(t *testing.T) { InplaceInsertionSort(data, ids, 0, len(ids), true) - test.Assert(t, "", dSorted[x], data, true) + test.Assert(t, "", dSorted[x], data) } } @@ -233,7 +233,7 @@ func TestInplaceInsertionSortDesc(t *testing.T) { InplaceInsertionSort(data, ids, 0, len(ids), false) - test.Assert(t, "", dSortedDesc[x], data, true) + test.Assert(t, "", dSortedDesc[x], data) } } @@ -252,7 +252,7 @@ func TestSortByIndex(t *testing.T) { SortByIndex(&data, ids[x]) - test.Assert(t, "", dSorted[x], data, true) + test.Assert(t, "", dSorted[x], data) } } @@ -325,7 +325,7 @@ func TestCompareSort(t *testing.T) { sort.Ints(d1) IndirectSort(d2, true) - test.Assert(t, "Compare sort", d1, d2, true) + test.Assert(t, "Compare sort", d1, d2) } func TestIndirectSort2(t *testing.T) { @@ -337,7 +337,7 @@ func TestIndirectSort2(t *testing.T) { res = fmt.Sprint(intsInSorts[i]) exp = fmt.Sprint(intsExpSorts[i]) - test.Assert(t, "", exp, res, true) + test.Assert(t, "", exp, res) } } @@ -350,7 +350,7 @@ func TestIndirectSortDesc(t *testing.T) { res = fmt.Sprint(intsInSorts[i]) exp = fmt.Sprint(intsExpSortsDesc[i]) - test.Assert(t, "", exp, res, true) + test.Assert(t, "", exp, res) } } @@ -358,14 +358,14 @@ func TestIndirectSort_Stability(t *testing.T) { exp := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} got := IndirectSort(intsInSorts[5], true) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestIndirectSortDesc_Stability(t *testing.T) { exp := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} got := IndirectSort(intsInSorts[5], false) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestInplaceMergesort(t *testing.T) { @@ -374,7 +374,7 @@ func TestInplaceMergesort(t *testing.T) { InplaceMergesort(intsInSorts[6], idx, 0, size, true) - test.Assert(t, "", intsExpSorts[6], intsInSorts[6], true) + test.Assert(t, "", intsExpSorts[6], intsInSorts[6]) } func TestIndirectSort_SortByIndex(t *testing.T) { @@ -386,14 +386,14 @@ func TestIndirectSort_SortByIndex(t *testing.T) { sortedIds := IndirectSort(in1, true) - test.Assert(t, "", expIds, sortedIds, true) + test.Assert(t, "", expIds, sortedIds) // Reverse the sort. SortByIndex(&in2, sortedIds) got := fmt.Sprint(in2) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestRemove(t *testing.T) { @@ -422,6 +422,6 @@ func TestRemove(t *testing.T) { for _, c := range cases { got, _ := Remove(c.d, c.v) - test.Assert(t, "Remove", c.exp, got, true) + test.Assert(t, "Remove", c.exp, got) } } diff --git a/lib/ints64/ints64_test.go b/lib/ints64/ints64_test.go index e0af44ca..56747bcc 100644 --- a/lib/ints64/ints64_test.go +++ b/lib/ints64/ints64_test.go @@ -35,61 +35,61 @@ var ( func TestMaxEmpty(t *testing.T) { gotv, goti, gotok := Max(d[0]) - test.Assert(t, "", int64(0), gotv, true) - test.Assert(t, "", 0, goti, true) - test.Assert(t, "", false, gotok, true) + test.Assert(t, "", int64(0), gotv) + test.Assert(t, "", 0, goti) + test.Assert(t, "", false, gotok) } func TestMax(t *testing.T) { gotv, goti, gotok := Max(d[1]) - test.Assert(t, "", int64(9), gotv, true) - test.Assert(t, "", 4, goti, true) - test.Assert(t, "", true, gotok, true) + test.Assert(t, "", int64(9), gotv) + test.Assert(t, "", 4, goti) + test.Assert(t, "", true, gotok) } func TestMinEmpty(t *testing.T) { gotv, goti, gotok := Min(d[0]) - test.Assert(t, "", int64(0), gotv, true) - test.Assert(t, "", 0, goti, true) - test.Assert(t, "", false, gotok, true) + test.Assert(t, "", int64(0), gotv) + test.Assert(t, "", 0, goti) + test.Assert(t, "", false, gotok) } func TestMin(t *testing.T) { gotv, goti, gotok := Min(d[1]) - test.Assert(t, "", int64(0), gotv, true) - test.Assert(t, "", 5, goti, true) - test.Assert(t, "", true, gotok, true) + test.Assert(t, "", int64(0), gotv) + test.Assert(t, "", 5, goti) + test.Assert(t, "", true, gotok) } func TestSum(t *testing.T) { got := Sum(d[1]) - test.Assert(t, "", int64(45), got, true) + test.Assert(t, "", int64(45), got) } func TestCount(t *testing.T) { got := Count(d[0], 0) - test.Assert(t, "", 0, got, true) + test.Assert(t, "", 0, got) got = Count(d[1], 1) - test.Assert(t, "", 1, got, true) + test.Assert(t, "", 1, got) got = Count(d[2], 1) - test.Assert(t, "", 4, got, true) + test.Assert(t, "", 4, got) got = Count(d[3], 0) - test.Assert(t, "", 0, got, true) + test.Assert(t, "", 0, got) got = Count(d[3], 3) - test.Assert(t, "", 1, got, true) + test.Assert(t, "", 1, got) } func TestCountsEmpty(t *testing.T) { @@ -98,7 +98,7 @@ func TestCountsEmpty(t *testing.T) { got := Counts(d[0], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestCountsEmptyClasses(t *testing.T) { @@ -107,7 +107,7 @@ func TestCountsEmptyClasses(t *testing.T) { got := Counts(d[1], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestCounts(t *testing.T) { @@ -116,7 +116,7 @@ func TestCounts(t *testing.T) { got := Counts(d[3], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func Test64MaxCountOf(t *testing.T) { @@ -124,13 +124,13 @@ func Test64MaxCountOf(t *testing.T) { exp := int64(0) got, _ := MaxCountOf(d[2], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Swap the class values. classes = []int64{1, 0} got, _ = MaxCountOf(d[2], classes) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestSwapEmpty(t *testing.T) { @@ -138,7 +138,7 @@ func TestSwapEmpty(t *testing.T) { Swap(d[0], 1, 6) - test.Assert(t, "", exp, d[0], true) + test.Assert(t, "", exp, d[0]) } func TestSwapEqual(t *testing.T) { @@ -150,7 +150,7 @@ func TestSwapEqual(t *testing.T) { Swap(in, 1, 1) - test.Assert(t, "", exp, in, true) + test.Assert(t, "", exp, in) } func TestSwapOutOfRange(t *testing.T) { @@ -162,7 +162,7 @@ func TestSwapOutOfRange(t *testing.T) { Swap(in, 1, 100) - test.Assert(t, "", exp, in, true) + test.Assert(t, "", exp, in) } func TestSwap(t *testing.T) { @@ -178,7 +178,7 @@ func TestSwap(t *testing.T) { exp[0] = exp[len(exp)-1] exp[len(exp)-1] = tmp - test.Assert(t, "", exp, in, true) + test.Assert(t, "", exp, in) } func TestIsExist(t *testing.T) { @@ -189,16 +189,16 @@ func TestIsExist(t *testing.T) { for _, v := range d { s = IsExist(d, v) - test.Assert(t, "", true, s, true) + test.Assert(t, "", true, s) } } // False positive. for _, d := range d { s = IsExist(d, -1) - test.Assert(t, "", false, s, true) + test.Assert(t, "", false, s) s = IsExist(d, 10) - test.Assert(t, "", false, s, true) + test.Assert(t, "", false, s) } } @@ -215,7 +215,7 @@ func TestInsertionSortWithIndices(t *testing.T) { InsertionSortWithIndices(data, ids, 0, len(ids), true) - test.Assert(t, "", dSorted[x], data, true) + test.Assert(t, "", dSorted[x], data) } } @@ -232,7 +232,7 @@ func TestInsertionSortWithIndicesDesc(t *testing.T) { InsertionSortWithIndices(data, ids, 0, len(ids), false) - test.Assert(t, "", dSortedDesc[x], data, true) + test.Assert(t, "", dSortedDesc[x], data) } } @@ -251,7 +251,7 @@ func TestSortByIndex(t *testing.T) { SortByIndex(&data, ids[x]) - test.Assert(t, "", dSorted[x], data, true) + test.Assert(t, "", dSorted[x], data) } } @@ -324,7 +324,7 @@ func TestIndirectSort(t *testing.T) { res = fmt.Sprint(ints64InSorts[i]) exp = fmt.Sprint(ints64ExpSorts[i]) - test.Assert(t, "", exp, res, true) + test.Assert(t, "", exp, res) } } @@ -337,7 +337,7 @@ func TestIndirectSortDesc(t *testing.T) { res = fmt.Sprint(ints64InSorts[i]) exp = fmt.Sprint(ints64ExpSortsDesc[i]) - test.Assert(t, "", exp, res, true) + test.Assert(t, "", exp, res) } } @@ -345,14 +345,14 @@ func TestIndirectSort_Stability(t *testing.T) { exp := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} got := IndirectSort(ints64InSorts[5], true) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestIndirectSortDesc_Stability(t *testing.T) { exp := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} got := IndirectSort(ints64InSorts[5], false) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestInplaceMergesort(t *testing.T) { @@ -361,7 +361,7 @@ func TestInplaceMergesort(t *testing.T) { InplaceMergesort(ints64InSorts[6], idx, 0, size, true) - test.Assert(t, "", ints64ExpSorts[6], ints64InSorts[6], true) + test.Assert(t, "", ints64ExpSorts[6], ints64InSorts[6]) } func TestIndirectSort_SortByIndex(t *testing.T) { @@ -373,12 +373,12 @@ func TestIndirectSort_SortByIndex(t *testing.T) { sortedIds := IndirectSort(in1, true) - test.Assert(t, "", expIds, sortedIds, true) + test.Assert(t, "", expIds, sortedIds) // Reverse the sort. SortByIndex(&in2, sortedIds) got := fmt.Sprint(in2) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/io/confirm_test.go b/lib/io/confirm_test.go index e46598be..ab082ac1 100644 --- a/lib/io/confirm_test.go +++ b/lib/io/confirm_test.go @@ -67,7 +67,7 @@ func TestConfirmYesNo(t *testing.T) { got := ConfirmYesNo(in, "confirm", c.defIsYes) - test.Assert(t, "answer", c.exp, got, true) + test.Assert(t, "answer", c.exp, got) mock.ResetStdin(true) } diff --git a/lib/io/io_test.go b/lib/io/io_test.go index 3175b11a..75c1ab8b 100644 --- a/lib/io/io_test.go +++ b/lib/io/io_test.go @@ -81,7 +81,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. for _, c := range cases { err := Copy(c.out, c.in) if err != nil { - test.Assert(t, c.desc, c.expErr, err.Error(), true) + test.Assert(t, c.desc, c.expErr, err.Error()) continue } @@ -90,6 +90,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. t.Fatal(err) } - test.Assert(t, c.desc, c.exp, string(got), true) + test.Assert(t, c.desc, c.exp, string(got)) } } diff --git a/lib/io/is_test.go b/lib/io/is_test.go index 542ebb5b..145695d2 100644 --- a/lib/io/is_test.go +++ b/lib/io/is_test.go @@ -40,7 +40,7 @@ func TestIsDirEmpty(t *testing.T) { got := IsDirEmpty(c.path) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -76,6 +76,6 @@ func TestIsFileExist(t *testing.T) { got := IsFileExist(c.parent, c.relpath) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } diff --git a/lib/io/reader_test.go b/lib/io/reader_test.go index 48b6b5a0..bd005e3e 100644 --- a/lib/io/reader_test.go +++ b/lib/io/reader_test.go @@ -63,7 +63,7 @@ func TestReaderScanInt64(t *testing.T) { got, gotc := r.ScanInt64() - test.Assert(t, "n", c.exp, got, true) - test.Assert(t, "c", c.expc, gotc, true) + test.Assert(t, "n", c.exp, got) + test.Assert(t, "c", c.expc, gotc) } } diff --git a/lib/json/json_test.go b/lib/json/json_test.go index 2e898072..faab6899 100644 --- a/lib/json/json_test.go +++ b/lib/json/json_test.go @@ -14,7 +14,7 @@ func TestEscape(t *testing.T) { in := []byte("\"\\/\b\f\n\r\t") exp := []byte(`\"\\\/\b\f\n\r\t`) got := Escape(in) - test.Assert(t, "Escape", exp, got, true) + test.Assert(t, "Escape", exp, got) } func TestEscapeString(t *testing.T) { @@ -39,7 +39,7 @@ func TestEscapeString(t *testing.T) { got = EscapeString(c.in) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -62,7 +62,7 @@ func TestToMapStringFloat64(t *testing.T) { t.Fatal(err) } - test.Assert(t, "ToMapStringFloat64", exp, got, true) + test.Assert(t, "ToMapStringFloat64", exp, got) } func TestUnescape(t *testing.T) { @@ -72,7 +72,7 @@ func TestUnescape(t *testing.T) { if err != nil { t.Fatal(err) } - test.Assert(t, "Unescape", exp, got, true) + test.Assert(t, "Unescape", exp, got) } func TestUnescapeString(t *testing.T) { @@ -112,10 +112,10 @@ func TestUnescapeString(t *testing.T) { got, err = UnescapeString(c.in, c.strict) if err != nil { - test.Assert(t, "err", c.expErr, err.Error(), true) + test.Assert(t, "err", c.expErr, err.Error()) continue } - test.Assert(t, "value", c.exp, got, true) + test.Assert(t, "value", c.exp, got) } } diff --git a/lib/math/big/float_test.go b/lib/math/big/float_test.go index aed8f21e..9876e7fc 100644 --- a/lib/math/big/float_test.go +++ b/lib/math/big/float_test.go @@ -23,7 +23,7 @@ func TestFloat_Clone(t *testing.T) { got := f.Clone() - test.Assert(t, "Clone", f.String(), got.String(), true) + test.Assert(t, "Clone", f.String(), got.String()) } func TestFloat_IsEqual(t *testing.T) { @@ -57,7 +57,7 @@ func TestFloat_IsEqual(t *testing.T) { for _, c := range cases { got := f.IsEqual(c.g) - test.Assert(t, "IsEqual", c.exp, got, true) + test.Assert(t, "IsEqual", c.exp, got) } } @@ -91,7 +91,7 @@ func TestFloat_Mul(t *testing.T) { f.Mul(g) got := f.String() - test.Assert(t, "Mul", c.exp, got, true) + test.Assert(t, "Mul", c.exp, got) } } @@ -120,7 +120,7 @@ func TestFloat_MulFloat64(t *testing.T) { f.Mul(c.g) got := f.String() - test.Assert(t, "MulFloat64", c.exp, got, true) + test.Assert(t, "MulFloat64", c.exp, got) } } @@ -158,7 +158,7 @@ func TestFloat_Quo(t *testing.T) { got := f.String() - test.Assert(t, "Quo", c.exp, got, true) + test.Assert(t, "Quo", c.exp, got) } } @@ -196,7 +196,7 @@ func TestFloat_QuoFloat64(t *testing.T) { got := f.String() - test.Assert(t, "Quo", c.exp, got, true) + test.Assert(t, "Quo", c.exp, got) } } @@ -246,7 +246,7 @@ func TestFloat_String_fromString(t *testing.T) { if err != nil { t.Fatal(err) } - test.Assert(t, c.in, c.exp, bf.String(), true) + test.Assert(t, c.in, c.exp, bf.String()) } } @@ -290,7 +290,7 @@ func TestFloat_String_fromFloat(t *testing.T) { for _, c := range cases { bf.SetFloat64(c.in) - test.Assert(t, c.exp, c.exp, bf.String(), true) + test.Assert(t, c.exp, c.exp, bf.String()) } } @@ -321,6 +321,6 @@ func TestFloat_UnmarshalJSON(t *testing.T) { t.Fatal(err) } - test.Assert(t, "", c.exp, got.V, true) + test.Assert(t, "", c.exp, got.V) } } diff --git a/lib/math/big/rat_test.go b/lib/math/big/rat_test.go index 6f2800b4..799c12df 100644 --- a/lib/math/big/rat_test.go +++ b/lib/math/big/rat_test.go @@ -32,7 +32,7 @@ func TestAddRat(t *testing.T) { for _, c := range cases { got := AddRat(c.ins...) - test.Assert(t, "AddRat", c.exp, got, true) + test.Assert(t, "AddRat", c.exp, got) } } @@ -58,7 +58,7 @@ func TestMulRat(t *testing.T) { for _, c := range cases { got := MulRat(c.ins...) - test.Assert(t, "MulRat", c.exp, got, true) + test.Assert(t, "MulRat", c.exp, got) } } @@ -103,10 +103,10 @@ func TestQuoRat(t *testing.T) { for _, c := range cases { got := QuoRat(c.ins...) if got == nil { - test.Assert(t, "QuoRat", c.exp, "", true) + test.Assert(t, "QuoRat", c.exp, "") continue } - test.Assert(t, "QuoRat", c.exp, got.String(), true) + test.Assert(t, "QuoRat", c.exp, got.String()) } } @@ -132,7 +132,7 @@ func TestSubRat(t *testing.T) { for _, c := range cases { got := SubRat(c.ins...) - test.Assert(t, "SubRat", c.exp, got, true) + test.Assert(t, "SubRat", c.exp, got) } } @@ -171,7 +171,7 @@ func TestNewRat(t *testing.T) { for _, c := range cases { got := NewRat(c.v) test.Assert(t, fmt.Sprintf("NewRat: %T(%v)", c.v, c.v), - c.exp, got, true) + c.exp, got) } } @@ -191,7 +191,7 @@ func TestRat_Abs(t *testing.T) { }} for _, c := range cases { - test.Assert(t, "Abs()", c.exp, c.r.Abs().String(), true) + test.Assert(t, "Abs()", c.exp, c.r.Abs().String()) } } @@ -215,7 +215,7 @@ func TestRat_Add(t *testing.T) { c.got.Add(c.in) - test.Assert(t, "Add", c.exp, c.got, true) + test.Assert(t, "Add", c.exp, c.got) } } @@ -248,7 +248,7 @@ func TestRat_Int64(t *testing.T) { for _, c := range cases { got := c.r.Int64() - test.Assert(t, fmt.Sprintf("Int64 of %s", c.r), c.exp, got, true) + test.Assert(t, fmt.Sprintf("Int64 of %s", c.r), c.exp, got) } } @@ -284,7 +284,7 @@ func TestRat_IsEqual(t *testing.T) { for _, c := range cases { got := f.IsEqual(c.g) - test.Assert(t, "IsEqual", c.exp, got, true) + test.Assert(t, "IsEqual", c.exp, got) } } @@ -306,7 +306,7 @@ func TestRat_IsEqual_unexported(t *testing.T) { }} for x, c := range cases { - test.Assert(t, fmt.Sprintf("unexported field %d", x), exp, c.got, false) + test.Assert(t, fmt.Sprintf("unexported field %d", x), exp, c.got) } } @@ -327,7 +327,7 @@ func TestRat_IsGreater(t *testing.T) { for _, c := range cases { got := r.IsGreater(c.in) test.Assert(t, fmt.Sprintf("IsGreater %s", c.in), - c.exp, got, true) + c.exp, got) } } @@ -351,7 +351,7 @@ func TestRat_IsGreaterOrEqual(t *testing.T) { for _, c := range cases { got := r.IsGreaterOrEqual(c.in) test.Assert(t, fmt.Sprintf("IsGreaterOrEqual %s", c.in), - c.exp, got, true) + c.exp, got) } } @@ -373,7 +373,7 @@ func TestRat_IsGreaterThanZero(t *testing.T) { for _, c := range cases { got := NewRat(c.in).IsGreaterThanZero() test.Assert(t, fmt.Sprintf("IsGreaterThanZero %s", c.in), - c.exp, got, true) + c.exp, got) } } @@ -396,7 +396,7 @@ func TestRat_IsLess(t *testing.T) { for _, c := range cases { got := r.IsLess(c.in) test.Assert(t, fmt.Sprintf("IsLess %s", c.in), - c.exp, got, true) + c.exp, got) } } @@ -420,7 +420,7 @@ func TestRat_IsLessOrEqual(t *testing.T) { for _, c := range cases { got := r.IsLessOrEqual(c.in) test.Assert(t, fmt.Sprintf("IsLessOrEqual %s", c.in), - c.exp, got, true) + c.exp, got) } } @@ -441,7 +441,7 @@ func TestRat_IsLessThanZero(t *testing.T) { for _, c := range cases { got := NewRat(c.in).IsLessThanZero() test.Assert(t, fmt.Sprintf("IsLessThanZero %s", c.in), - c.exp, got, true) + c.exp, got) } } @@ -463,7 +463,7 @@ func TestRat_IsZero(t *testing.T) { for _, c := range cases { got := NewRat(c.in).IsZero() test.Assert(t, fmt.Sprintf("IsZero %s", c.in), - c.exp, got, true) + c.exp, got) } } @@ -518,7 +518,7 @@ func TestRat_MarshalJSON(t *testing.T) { t.Fatal(err) } test.Assert(t, fmt.Sprintf("MarshalJSON(%s)", c.in), - c.exp, string(got), true) + c.exp, string(got)) } } @@ -554,7 +554,7 @@ func TestRat_Mul(t *testing.T) { c.got.Mul(c.in) - test.Assert(t, "Mul", c.exp, c.got, true) + test.Assert(t, "Mul", c.exp, c.got) } } @@ -580,7 +580,7 @@ func TestRat_Quo(t *testing.T) { r := NewRat(defValue) got := r.Quo(c.g) - test.Assert(t, "Quo", c.exp, got, true) + test.Assert(t, "Quo", c.exp, got) } } @@ -617,7 +617,7 @@ func TestRat_RoundToZero(t *testing.T) { for _, c := range cases { got := c.r.RoundToZero(c.prec).String() - test.Assert(t, "RoundToZero", c.exp, got, true) + test.Assert(t, "RoundToZero", c.exp, got) } } @@ -644,11 +644,11 @@ func TestRat_Scan(t *testing.T) { r := NewRat(0) err := r.Scan(c.in) if err != nil { - test.Assert(t, "Scan error", c.expError, err.Error(), true) + test.Assert(t, "Scan error", c.expError, err.Error()) continue } test.Assert(t, fmt.Sprintf("Scan(%T(%v))", c.in, c.in), - c.exp, r, true) + c.exp, r) } } @@ -696,7 +696,7 @@ func TestRat_String_fromString(t *testing.T) { for _, c := range cases { got := MustRat(c.in) - test.Assert(t, c.in, c.exp, got.String(), true) + test.Assert(t, c.in, c.exp, got.String()) } } @@ -738,7 +738,7 @@ func TestRat_String_fromFloat64(t *testing.T) { for _, c := range cases { got := NewRat(c.in) - test.Assert(t, c.exp, c.exp, got.String(), true) + test.Assert(t, c.exp, c.exp, got.String()) } } @@ -762,7 +762,7 @@ func TestRat_Sub(t *testing.T) { c.got.Sub(c.in) - test.Assert(t, "Sub", c.exp, c.got, true) + test.Assert(t, "Sub", c.exp, c.got) } } @@ -806,6 +806,6 @@ func TestRat_UnmarshalJSON(t *testing.T) { t.Fatalf("expecting error like %q, got %q", c.expError, err.Error()) } - test.Assert(t, "", c.exp, got.V, true) + test.Assert(t, "", c.exp, got.V) } } diff --git a/lib/memfs/generate_test/memfs_generate_test.go b/lib/memfs/generate_test/memfs_generate_test.go index 21b504f7..73539cff 100644 --- a/lib/memfs/generate_test/memfs_generate_test.go +++ b/lib/memfs/generate_test/memfs_generate_test.go @@ -55,13 +55,13 @@ func TestGeneratePathNode(t *testing.T) { got, err := memFS.Get(c.path) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } childs := got.Childs got.Childs = nil - test.Assert(t, "Node", c.exp, got, true) + test.Assert(t, "Node", c.exp, got) got.Childs = childs } } @@ -129,6 +129,6 @@ func TestNode_Readdir(t *testing.T) { sort.Strings(got) - test.Assert(t, "Node.Readdir", c.exp, got, true) + test.Assert(t, "Node.Readdir", c.exp, got) } } diff --git a/lib/memfs/memfs_test.go b/lib/memfs/memfs_test.go index e158a9ef..fade66c9 100644 --- a/lib/memfs/memfs_test.go +++ b/lib/memfs/memfs_test.go @@ -70,7 +70,7 @@ func TestAddFile(t *testing.T) { got, err := mfs.AddFile(c.intPath, c.extPath) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } @@ -81,7 +81,7 @@ func TestAddFile(t *testing.T) { got.Childs = nil } - test.Assert(t, "AddFile", c.exp, got, true) + test.Assert(t, "AddFile", c.exp, got) if c.exp == nil { continue @@ -99,7 +99,7 @@ func TestAddFile(t *testing.T) { got.Childs = nil } - test.Assert(t, "Get", c.exp, got, true) + test.Assert(t, "Get", c.exp, got) } } @@ -178,16 +178,16 @@ func TestGet(t *testing.T) { got, err := mfs.Get(c.path) if err != nil { - test.Assert(t, "error", c.expErr, err, true) + test.Assert(t, "error", c.expErr, err) continue } if got.size <= opts.MaxFileSize { - test.Assert(t, "node.V", c.expV, got.V, true) + test.Assert(t, "node.V", c.expV, got.V) } test.Assert(t, "node.ContentType", c.expContentType, - got.ContentType, true) + got.ContentType) } } @@ -282,12 +282,12 @@ func TestMemFS_mount(t *testing.T) { mfs, err := New(&c.opts) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } gotListNames := mfs.ListNames() - test.Assert(t, "names", c.expMapKeys, gotListNames, true) + test.Assert(t, "names", c.expMapKeys, gotListNames) } } @@ -420,7 +420,7 @@ func TestFilter(t *testing.T) { got := mfs.isIncluded(sysPath, fi.Mode()) - test.Assert(t, sysPath, c.exp[x], got, true) + test.Assert(t, sysPath, c.exp[x], got) } } } diff --git a/lib/memfs/node_test.go b/lib/memfs/node_test.go index f2f899a8..5b6375e7 100644 --- a/lib/memfs/node_test.go +++ b/lib/memfs/node_test.go @@ -57,9 +57,9 @@ func TestNode_Read(t *testing.T) { n, err := node.Read(c.p) - test.Assert(t, "p", c.exp, c.p, true) - test.Assert(t, "n", c.expN, n, true) - test.Assert(t, "error", c.expError, err, true) + test.Assert(t, "p", c.exp, c.p) + test.Assert(t, "n", c.expN, n) + test.Assert(t, "error", c.expError, err) } } @@ -92,7 +92,7 @@ func TestNode_Readdir(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Readdir(0)", expFileNames, gotFileNames(fis), true) + test.Assert(t, "Readdir(0)", expFileNames, gotFileNames(fis)) // Test reading two nodes at a time. @@ -105,7 +105,7 @@ func TestNode_Readdir(t *testing.T) { allFis = append(allFis, fis...) } - test.Assert(t, "Readdir(2)", expFileNames, gotFileNames(allFis), true) + test.Assert(t, "Readdir(2)", expFileNames, gotFileNames(allFis)) } func gotFileNames(fis []os.FileInfo) (names []string) { @@ -159,7 +159,7 @@ func TestNode_Seek(t *testing.T) { got, err := node.Seek(c.offset, c.whence) - test.Assert(t, "Seek", c.exp, got, true) - test.Assert(t, "Seek error", c.expError, err, true) + test.Assert(t, "Seek", c.exp, got) + test.Assert(t, "Seek error", c.expError, err) } } diff --git a/lib/mining/classifier/cart/cart_test.go b/lib/mining/classifier/cart/cart_test.go index 5159e4c4..264efb6b 100644 --- a/lib/mining/classifier/cart/cart_test.go +++ b/lib/mining/classifier/cart/cart_test.go @@ -32,7 +32,7 @@ func TestCART(t *testing.T) { // copy target to be compared later. targetv := ds.GetClassAsStrings() - test.Assert(t, "", NRows, ds.GetNRow(), true) + test.Assert(t, "", NRows, ds.GetNRow()) // Build CART tree. CART, e := New(&ds, SplitMethodGini, 0) @@ -58,5 +58,5 @@ func TestCART(t *testing.T) { t.Fatal(e) } - test.Assert(t, "", targetv, testset.GetClassAsStrings(), true) + test.Assert(t, "", targetv, testset.GetClassAsStrings()) } diff --git a/lib/mining/classifier/cm_test.go b/lib/mining/classifier/cm_test.go index 6fd47d93..30041388 100644 --- a/lib/mining/classifier/cm_test.go +++ b/lib/mining/classifier/cm_test.go @@ -21,10 +21,10 @@ func TestComputeNumeric(t *testing.T) { cm.ComputeNumeric(vs, actuals, predics) - test.Assert(t, "", exp[0], cm.TP(), true) - test.Assert(t, "", exp[1], cm.FN(), true) - test.Assert(t, "", exp[2], cm.TN(), true) - test.Assert(t, "", exp[3], cm.FP(), true) + test.Assert(t, "", exp[0], cm.TP()) + test.Assert(t, "", exp[1], cm.FN()) + test.Assert(t, "", exp[2], cm.TN()) + test.Assert(t, "", exp[3], cm.FP()) fmt.Println(cm) } @@ -39,10 +39,10 @@ func TestComputeStrings(t *testing.T) { cm.ComputeStrings(vs, actuals, predics) - test.Assert(t, "", exp[0], cm.TP(), true) - test.Assert(t, "", exp[1], cm.FN(), true) - test.Assert(t, "", exp[2], cm.TN(), true) - test.Assert(t, "", exp[3], cm.FP(), true) + test.Assert(t, "", exp[0], cm.TP()) + test.Assert(t, "", exp[1], cm.FN()) + test.Assert(t, "", exp[2], cm.TN()) + test.Assert(t, "", exp[3], cm.FP()) fmt.Println(cm) } @@ -62,8 +62,8 @@ func TestGroupIndexPredictions(t *testing.T) { cm.GroupIndexPredictions(testIds, actuals, predics) - test.Assert(t, "", exp[0], cm.TPIndices(), true) - test.Assert(t, "", exp[1], cm.FNIndices(), true) - test.Assert(t, "", exp[2], cm.FPIndices(), true) - test.Assert(t, "", exp[3], cm.TNIndices(), true) + test.Assert(t, "", exp[0], cm.TPIndices()) + test.Assert(t, "", exp[1], cm.FNIndices()) + test.Assert(t, "", exp[2], cm.FPIndices()) + test.Assert(t, "", exp[3], cm.TNIndices()) } diff --git a/lib/mining/knn/knn_test.go b/lib/mining/knn/knn_test.go index 86ef75c0..a63794a5 100644 --- a/lib/mining/knn/knn_test.go +++ b/lib/mining/knn/knn_test.go @@ -54,9 +54,9 @@ func TestComputeEuclidianDistance(t *testing.T) { got += fmt.Sprint(*row) } - test.Assert(t, "", exp[1], got, true) + test.Assert(t, "", exp[1], got) distances := kneighbors.Distances() got = fmt.Sprint(*distances) - test.Assert(t, "", expDistances, got, true) + test.Assert(t, "", expDistances, got) } diff --git a/lib/mining/knn/neighbor_test.go b/lib/mining/knn/neighbor_test.go index 1e8488c9..7d5139db 100644 --- a/lib/mining/knn/neighbor_test.go +++ b/lib/mining/knn/neighbor_test.go @@ -65,15 +65,15 @@ func TestContain(t *testing.T) { isin, idx := neighbors.Contain(randSample) - test.Assert(t, "", true, isin, true) - test.Assert(t, "", pickIdx, idx, true) + test.Assert(t, "", true, isin) + test.Assert(t, "", pickIdx, idx) // change one of record value to check for false. (*randSample)[0].SetFloat(0) isin, _ = neighbors.Contain(randSample) - test.Assert(t, "", false, isin, true) + test.Assert(t, "", false, isin) } func TestSort(t *testing.T) { @@ -82,5 +82,5 @@ func TestSort(t *testing.T) { sort.Sort(&neighbors) - test.Assert(t, "", exp.Rows(), neighbors.Rows(), true) + test.Assert(t, "", exp.Rows(), neighbors.Rows()) } diff --git a/lib/net/is_test.go b/lib/net/is_test.go index 46d0726a..d49dbfd3 100644 --- a/lib/net/is_test.go +++ b/lib/net/is_test.go @@ -53,7 +53,7 @@ func TestIsHostnameValid(t *testing.T) { got := IsHostnameValid(c.in, c.isFQDN) - test.Assert(t, "IsHostnameValid", c.exp, got, true) + test.Assert(t, "IsHostnameValid", c.exp, got) } } @@ -75,7 +75,7 @@ func TestIsIPv4(t *testing.T) { for _, c := range cases { ip := net.ParseIP(c.ip) got := IsIPv4(ip) - test.Assert(t, "IsIPv4: "+c.ip, c.exp, got, true) + test.Assert(t, "IsIPv4: "+c.ip, c.exp, got) } } @@ -97,6 +97,6 @@ func TestIsIPv6(t *testing.T) { for _, c := range cases { ip := net.ParseIP(c.ip) got := IsIPv6(ip) - test.Assert(t, "IsIPv4", c.exp, got, true) + test.Assert(t, "IsIPv4", c.exp, got) } } diff --git a/lib/net/net_test.go b/lib/net/net_test.go index 4fe506a2..2444704b 100644 --- a/lib/net/net_test.go +++ b/lib/net/net_test.go @@ -66,7 +66,7 @@ func TestIsTypeUDP(t *testing.T) { got := IsTypeUDP(netType) - test.Assert(t, "IsTypeUDP", c.exp, got, true) + test.Assert(t, "IsTypeUDP", c.exp, got) } } @@ -125,7 +125,7 @@ func TestIsTypeTCP(t *testing.T) { got := IsTypeTCP(netType) - test.Assert(t, "IsTypeTCP", c.exp, got, true) + test.Assert(t, "IsTypeTCP", c.exp, got) } } @@ -187,7 +187,7 @@ func TestIsTypeTransport(t *testing.T) { got := IsTypeTransport(netType) - test.Assert(t, "IsTypeTransport", c.exp, got, true) + test.Assert(t, "IsTypeTransport", c.exp, got) } } @@ -205,6 +205,6 @@ func TestToDotIPv6(t *testing.T) { for _, c := range cases { got := ToDotIPv6(c.ip) - test.Assert(t, "ToDotIPv6", c.exp, got, true) + test.Assert(t, "ToDotIPv6", c.exp, got) } } diff --git a/lib/net/parser_test.go b/lib/net/parser_test.go index 5f622e81..cfed8c9a 100644 --- a/lib/net/parser_test.go +++ b/lib/net/parser_test.go @@ -70,8 +70,8 @@ func TestParseIPPort(t *testing.T) { hostname, ip, port := ParseIPPort(c.address, 1) - test.Assert(t, "hostname", c.expHostname, hostname, true) - test.Assert(t, "ip", c.expIP, ip, true) - test.Assert(t, "port", c.expPort, port, true) + test.Assert(t, "hostname", c.expHostname, hostname) + test.Assert(t, "ip", c.expIP, ip) + test.Assert(t, "port", c.expPort, port) } } diff --git a/lib/net/resolvconf_test.go b/lib/net/resolvconf_test.go index 50c88c07..52d1bbf4 100644 --- a/lib/net/resolvconf_test.go +++ b/lib/net/resolvconf_test.go @@ -42,10 +42,10 @@ func TestNewResolvConf(t *testing.T) { rc, err := NewResolvConf(c.path) if err != nil { - test.Assert(t, "expError", c.expErr, err.Error(), true) + test.Assert(t, "expError", c.expErr, err.Error()) } - test.Assert(t, "exp", c.exp, rc, true) + test.Assert(t, "exp", c.exp, rc) } } @@ -192,6 +192,6 @@ options ndots:33 } } - test.Assert(t, "ResolvConf", c.exp, rc, true) + test.Assert(t, "ResolvConf", c.exp, rc) } } diff --git a/lib/numbers/float64_test.go b/lib/numbers/float64_test.go index 01cf88c8..5b8487e5 100644 --- a/lib/numbers/float64_test.go +++ b/lib/numbers/float64_test.go @@ -24,7 +24,7 @@ func TestFloat64Round(t *testing.T) { for x := range data { for y, exp := range exps[x] { got := Float64Round(data[x], y) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } } } diff --git a/lib/numbers/int64_test.go b/lib/numbers/int64_test.go index d2f2a6f3..d48bacd6 100644 --- a/lib/numbers/int64_test.go +++ b/lib/numbers/int64_test.go @@ -14,5 +14,5 @@ func TestInt64CreateSeq(t *testing.T) { exp := []int64{-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5} got := Int64CreateSeq(-5, 5) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/numbers/int_test.go b/lib/numbers/int_test.go index c317a77a..833e3bc4 100644 --- a/lib/numbers/int_test.go +++ b/lib/numbers/int_test.go @@ -14,7 +14,7 @@ func TestIntCreateSeq(t *testing.T) { exp := []int{-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5} got := IntCreateSeq(-5, 5) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestIntPickRandPositive(t *testing.T) { @@ -25,9 +25,9 @@ func TestIntPickRandPositive(t *testing.T) { // Pick random without duplicate. got := IntPickRandPositive(7, false, pickedIds, nil) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Pick random with exclude indices. got = IntPickRandPositive(9, false, pickedIds, exsIds) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/os/exec/exec_test.go b/lib/os/exec/exec_test.go index ad0e82b0..90771dbb 100644 --- a/lib/os/exec/exec_test.go +++ b/lib/os/exec/exec_test.go @@ -46,7 +46,7 @@ func TestParseCommandArg(t *testing.T) { for _, c := range cases { t.Logf(c.in) gotCmd, gotArgs := ParseCommandArgs(c.in) - test.Assert(t, "cmd", c.expCmd, gotCmd, true) - test.Assert(t, "args", c.expArgs, gotArgs, true) + test.Assert(t, "cmd", c.expCmd, gotCmd) + test.Assert(t, "args", c.expArgs, gotArgs) } } diff --git a/lib/parser/parser_test.go b/lib/parser/parser_test.go index 35477717..8051f994 100644 --- a/lib/parser/parser_test.go +++ b/lib/parser/parser_test.go @@ -30,7 +30,7 @@ func TestParser_AddDelimiters(t *testing.T) { for _, c := range cases { p.AddDelimiters(c.delims) - test.Assert(t, "p.delims", c.exp, p.delims, true) + test.Assert(t, "p.delims", c.exp, p.delims) } } @@ -72,8 +72,8 @@ b`, for x := 0; x < len(c.exp); x++ { gotLine, gotC := p.Line() - test.Assert(t, "", c.exp[x].line, gotLine, true) - test.Assert(t, "", c.exp[x].c, gotC, true) + test.Assert(t, "", c.exp[x].line, gotLine) + test.Assert(t, "", c.exp[x].c, gotC) } } } @@ -132,7 +132,7 @@ func TestParser_Lines(t *testing.T) { got := p.Lines() - test.Assert(t, "Lines()", c.exp, got, true) + test.Assert(t, "Lines()", c.exp, got) } } @@ -157,7 +157,7 @@ func TestParser_Stop(t *testing.T) { for _, c := range cases { _, _ = p.Token() got, _ = p.Stop() - test.Assert(t, "Stop", c.exp, got, true) + test.Assert(t, "Stop", c.exp, got) p.Load(got, "") } } @@ -184,8 +184,8 @@ func TestParser_Token(t *testing.T) { for _, c := range cases { gotToken, gotDelim := p.Token() - test.Assert(t, "token", c.expToken, gotToken, true) - test.Assert(t, "delim", c.expDelim, gotDelim, true) + test.Assert(t, "token", c.expToken, gotToken) + test.Assert(t, "delim", c.expDelim, gotDelim) } } @@ -211,8 +211,8 @@ func TestParser_TokenEscaped(t *testing.T) { for _, c := range cases { gotToken, gotDelim := p.TokenEscaped('\\') - test.Assert(t, "token", c.expToken, gotToken, true) - test.Assert(t, "delim", c.expDelim, gotDelim, true) + test.Assert(t, "token", c.expToken, gotToken) + test.Assert(t, "delim", c.expDelim, gotDelim) } } @@ -250,8 +250,8 @@ func TestParser_SkipLine(t *testing.T) { gotToken, gotDelim := p.Token() - test.Assert(t, "token", c.expToken, gotToken, true) - test.Assert(t, "delim", c.expDelim, gotDelim, true) + test.Assert(t, "token", c.expToken, gotToken) + test.Assert(t, "delim", c.expDelim, gotDelim) } } @@ -276,11 +276,11 @@ func TestParser_Open(t *testing.T) { p, err := Open(c.file, "") if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } - test.Assert(t, "content", c.expContent, p.v, true) + test.Assert(t, "content", c.expContent, p.v) } } @@ -306,7 +306,7 @@ func TestParser_RemoveDelimiters(t *testing.T) { for _, c := range cases { p.RemoveDelimiters(c.delims) - test.Assert(t, "p.delims", c.exp, p.delims, true) + test.Assert(t, "p.delims", c.exp, p.delims) } } @@ -347,11 +347,11 @@ func TestParser_SkipHorizontalSpaces(t *testing.T) { got := p.SkipHorizontalSpaces() - test.Assert(t, "rune", c.expRune, got, true) + test.Assert(t, "rune", c.expRune, got) gotToken, gotDelim := p.Token() - test.Assert(t, "token", c.expToken, gotToken, true) - test.Assert(t, "delim", c.expDelim, gotDelim, true) + test.Assert(t, "token", c.expToken, gotToken) + test.Assert(t, "delim", c.expDelim, gotDelim) } } diff --git a/lib/paseto/json_token_test.go b/lib/paseto/json_token_test.go index 0e7678a9..d332c048 100644 --- a/lib/paseto/json_token_test.go +++ b/lib/paseto/json_token_test.go @@ -45,6 +45,6 @@ func TestJSONToken_Validate(t *testing.T) { gotErr = err.Error() } - test.Assert(t, c.desc, c.expErr, gotErr, true) + test.Assert(t, c.desc, c.expErr, gotErr) } } diff --git a/lib/paseto/paseto_test.go b/lib/paseto/paseto_test.go index 4d52121f..cecbfe2e 100644 --- a/lib/paseto/paseto_test.go +++ b/lib/paseto/paseto_test.go @@ -34,7 +34,7 @@ func TestPae(t *testing.T) { t.Fatal(err) } - test.Assert(t, "pae", c.exp, got, true) + test.Assert(t, "pae", c.exp, got) } } @@ -115,7 +115,7 @@ func TestEncrypt(t *testing.T) { t.Fatal(err) } - test.Assert(t, c.desc, c.exp, got, true) + test.Assert(t, c.desc, c.exp, got) } } @@ -180,8 +180,8 @@ func TestDecrypt(t *testing.T) { t.Fatal(err) } - test.Assert(t, c.desc, c.exp, got, true) - test.Assert(t, c.desc, c.expFooter, gotFooter, true) + test.Assert(t, c.desc, c.exp, got) + test.Assert(t, c.desc, c.expFooter, gotFooter) } } @@ -227,7 +227,7 @@ func TestSign(t *testing.T) { t.Fatal(err) } - test.Assert(t, c.desc, c.exp, got, true) + test.Assert(t, c.desc, c.exp, got) } } @@ -282,6 +282,6 @@ func TestVerify(t *testing.T) { t.Fatal(err) } - test.Assert(t, c.desc, c.exp, string(got), true) + test.Assert(t, c.desc, c.exp, string(got)) } } diff --git a/lib/paseto/public_mode_test.go b/lib/paseto/public_mode_test.go index 3e2c78cf..aa6b956b 100644 --- a/lib/paseto/public_mode_test.go +++ b/lib/paseto/public_mode_test.go @@ -91,10 +91,10 @@ func TestPublicMode_UnpackHTTPRequest(t *testing.T) { for _, c := range cases { got, err := auth.UnpackHTTPRequest(c.req) if err != nil { - test.Assert(t, c.desc, c.expError, err.Error(), true) + test.Assert(t, c.desc, c.expError, err.Error()) continue } - test.Assert(t, c.desc, c.expData, got.Data, true) + test.Assert(t, c.desc, c.expData, got.Data) } } diff --git a/lib/runes/runes_test.go b/lib/runes/runes_test.go index 9eeaa966..f290b4bc 100644 --- a/lib/runes/runes_test.go +++ b/lib/runes/runes_test.go @@ -36,7 +36,7 @@ func TestDiff(t *testing.T) { for _, c := range cases { got := Diff(c.l, c.r) - test.Assert(t, "", string(c.exp), string(got), true) + test.Assert(t, "", string(c.exp), string(got)) } } @@ -73,6 +73,6 @@ 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)) } } diff --git a/lib/smtp/client_test.go b/lib/smtp/client_test.go index 081f79e5..33f49baa 100644 --- a/lib/smtp/client_test.go +++ b/lib/smtp/client_test.go @@ -47,11 +47,9 @@ func TestEhlo(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Ehlo", c.exp, got, true) - test.Assert(t, "ServerInfo.Domain", c.expServerInfo.Domain, - testClient.ServerInfo.Domain, true) - test.Assert(t, "ServerInfo.Info", c.expServerInfo.Info, - testClient.ServerInfo.Info, true) + test.Assert(t, "Ehlo", c.exp, got) + test.Assert(t, "ServerInfo.Domain", c.expServerInfo.Domain, testClient.ServerInfo.Domain) + test.Assert(t, "ServerInfo.Info", c.expServerInfo.Info, testClient.ServerInfo.Info) } } @@ -102,11 +100,11 @@ func TestAuth(t *testing.T) { got, err := testClient.Authenticate(c.mech, c.username, c.password) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "Response", c.exp, got, true) + test.Assert(t, "Response", c.exp, got) } } @@ -125,7 +123,7 @@ func TestAuth2(t *testing.T) { exp := &Response{ Code: StatusAuthReady, } - test.Assert(t, "Response", exp, res, true) + test.Assert(t, "Response", exp, res) cred := []byte("\x00" + testAccountFirst.Short() + "\x00" + testPassword) cmd = base64.StdEncoding.EncodeToString(cred) @@ -139,7 +137,7 @@ func TestAuth2(t *testing.T) { Code: StatusAuthenticated, Message: "2.7.0 Authentication successful", } - test.Assert(t, "Response", exp, res, true) + test.Assert(t, "Response", exp, res) } func TestExpand(t *testing.T) { @@ -164,7 +162,7 @@ func TestExpand(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Expand", c.exp, got, true) + test.Assert(t, "Expand", c.exp, got) } } @@ -189,7 +187,7 @@ func TestHelp(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Help", c.exp, got, true) + test.Assert(t, "Help", c.exp, got) } } @@ -229,7 +227,7 @@ func TestSendCommand(t *testing.T) { t.Fatal(err) } - test.Assert(t, "SendCommand", c.exp, got, true) + test.Assert(t, "SendCommand", c.exp, got) } } @@ -270,11 +268,11 @@ func TestMailTx(t *testing.T) { got, err := testClient.MailTx(c.mail) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "Response", c.exp, got, true) + test.Assert(t, "Response", c.exp, got) } } @@ -307,7 +305,7 @@ func TestVerify(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Verify", c.exp, got, true) + test.Assert(t, "Verify", c.exp, got) } } @@ -322,5 +320,5 @@ func TestQuit(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Quit", exp, got, true) + test.Assert(t, "Quit", exp, got) } diff --git a/lib/smtp/command_test.go b/lib/smtp/command_test.go index 46a84cec..950bd4cf 100644 --- a/lib/smtp/command_test.go +++ b/lib/smtp/command_test.go @@ -298,12 +298,12 @@ func TestUnpack(t *testing.T) { cmd.reset() err := cmd.unpack([]byte(c.b)) if err != nil { - test.Assert(t, "error", c.expErr, err, true) + test.Assert(t, "error", c.expErr, err) continue } - test.Assert(t, "Command.Kind", c.expCmd.Kind, cmd.Kind, true) - test.Assert(t, "Command.Arg", c.expCmd.Arg, cmd.Arg, true) - test.Assert(t, "Command.Params", c.expCmd.Params, cmd.Params, true) + test.Assert(t, "Command.Kind", c.expCmd.Kind, cmd.Kind) + test.Assert(t, "Command.Arg", c.expCmd.Arg, cmd.Arg) + test.Assert(t, "Command.Params", c.expCmd.Params, cmd.Params) } } diff --git a/lib/smtp/localstorage_test.go b/lib/smtp/localstorage_test.go index dc0a5044..b65d6738 100644 --- a/lib/smtp/localstorage_test.go +++ b/lib/smtp/localstorage_test.go @@ -32,7 +32,7 @@ func TestStore(t *testing.T) { err := testFS.MailSave(c.mail) if err != nil { - test.Assert(t, "error", c.expErr, err, true) + test.Assert(t, "error", c.expErr, err) continue } @@ -44,7 +44,7 @@ func TestStore(t *testing.T) { } } - test.Assert(t, "mail", c.mail, got, true) + test.Assert(t, "mail", c.mail, got) } } diff --git a/lib/smtp/mail_test.go b/lib/smtp/mail_test.go index b3a3cb05..47992fad 100644 --- a/lib/smtp/mail_test.go +++ b/lib/smtp/mail_test.go @@ -37,6 +37,6 @@ func TestIsTerminated(t *testing.T) { for _, c := range cases { t.Log(c.desc) - test.Assert(t, "isTerminated", c.exp, c.mail.isTerminated(), true) + test.Assert(t, "isTerminated", c.exp, c.mail.isTerminated()) } } diff --git a/lib/smtp/response_test.go b/lib/smtp/response_test.go index ec41e070..96462dcb 100644 --- a/lib/smtp/response_test.go +++ b/lib/smtp/response_test.go @@ -81,10 +81,10 @@ func TestNewResponse(t *testing.T) { got, err := NewResponse([]byte(c.in)) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "Response", c.exp, got, true) + test.Assert(t, "Response", c.exp, got) } } diff --git a/lib/smtp/smtp_test.go b/lib/smtp/smtp_test.go index d12c4569..64090bb4 100644 --- a/lib/smtp/smtp_test.go +++ b/lib/smtp/smtp_test.go @@ -168,10 +168,10 @@ func TestParsePath(t *testing.T) { got, err := ParsePath([]byte(c.path)) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "mailbox", c.exp, string(got), true) + test.Assert(t, "mailbox", c.exp, string(got)) } } diff --git a/lib/spf/macro_test.go b/lib/spf/macro_test.go index 21a42080..ab535b5d 100644 --- a/lib/spf/macro_test.go +++ b/lib/spf/macro_test.go @@ -121,11 +121,11 @@ func TestMacroExpandIPv4(t *testing.T) { got, err := macroExpand(ref, c.mode, []byte(c.data)) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "macroExpand", c.exp, string(got), true) + test.Assert(t, "macroExpand", c.exp, string(got)) } } @@ -148,10 +148,10 @@ func TestMacroExpandIPv6(t *testing.T) { got, err := macroExpand(ref, c.mode, []byte(c.data)) if err != nil { - test.Assert(t, "error", c.expErr, string(got), true) + test.Assert(t, "error", c.expErr, string(got)) continue } - test.Assert(t, "macroExpand", c.exp, string(got), true) + test.Assert(t, "macroExpand", c.exp, string(got)) } } diff --git a/lib/ssh/config_parser_test.go b/lib/ssh/config_parser_test.go index 8672d3cc..5340dc34 100644 --- a/lib/ssh/config_parser_test.go +++ b/lib/ssh/config_parser_test.go @@ -31,7 +31,7 @@ func TestIsIncludeDirective(t *testing.T) { for _, c := range cases { got := isIncludeDirective(c.line) - test.Assert(t, "isIncludeDirective: "+c.line, c.exp, got, true) + test.Assert(t, "isIncludeDirective: "+c.line, c.exp, got) } } @@ -55,7 +55,7 @@ func TestParseInclude(t *testing.T) { for _, c := range cases { got := parseInclude(c.line) - test.Assert(t, "parseInclude: "+c.line, c.exp, got, true) + test.Assert(t, "parseInclude: "+c.line, c.exp, got) } } @@ -82,7 +82,7 @@ func TestReadLines(t *testing.T) { t.Fatal(err) } - test.Assert(t, "readLines", c.exp, got, true) + test.Assert(t, "readLines", c.exp, got) } } @@ -122,10 +122,10 @@ func TestConfigParser_load(t *testing.T) { got, err := parser.load(c.dir, c.pattern) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } - test.Assert(t, "load "+c.pattern, c.exp, got, true) + test.Assert(t, "load "+c.pattern, c.exp, got) } } @@ -158,6 +158,6 @@ func TestParseArgs(t *testing.T) { for _, c := range cases { got := parseArgs(c.raw, ' ') - test.Assert(t, "parseArgs "+c.raw, c.exp, got, true) + test.Assert(t, "parseArgs "+c.raw, c.exp, got) } } diff --git a/lib/ssh/config_section_test.go b/lib/ssh/config_section_test.go index 258478d5..22274864 100644 --- a/lib/ssh/config_section_test.go +++ b/lib/ssh/config_section_test.go @@ -31,7 +31,7 @@ func TestConfigSection_postConfig(t *testing.T) { for _, c := range cases { got := c.section(*testDefaultSection) got.postConfig(testParser.homeDir) - test.Assert(t, "postConfig", c.exp(*testDefaultSection), got, true) + test.Assert(t, "postConfig", c.exp(*testDefaultSection), got) } } @@ -54,7 +54,7 @@ func TestConfigSection_setEnv(t *testing.T) { for _, c := range cases { cfg.setEnv(c.value) - test.Assert(t, "setEnv: "+c.value, c.exp, cfg.Environments, true) + test.Assert(t, "setEnv: "+c.value, c.exp, cfg.Environments) } } @@ -88,7 +88,6 @@ func TestConfigSection_setSendEnv(t *testing.T) { for _, c := range cases { cfg.setSendEnv(envs, c.pattern) - test.Assert(t, "setSendEnv: "+c.pattern, - c.exp, cfg.Environments, true) + test.Assert(t, "setSendEnv: "+c.pattern, c.exp, cfg.Environments) } } diff --git a/lib/ssh/config_test.go b/lib/ssh/config_test.go index 0d77eacd..b076d9ca 100644 --- a/lib/ssh/config_test.go +++ b/lib/ssh/config_test.go @@ -71,7 +71,7 @@ func TestConfig_Get(t *testing.T) { if exp != nil { exp.postConfig(homeDir) } - test.Assert(t, "Get "+c.s, exp, got, true) + test.Assert(t, "Get "+c.s, exp, got) } } @@ -109,10 +109,10 @@ func TestParseKeyValue(t *testing.T) { for _, c := range cases { key, value, err := parseKeyValue(c.line) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } - test.Assert(t, "key:", c.expKey, key, true) - test.Assert(t, "value:", c.expValue, value, true) + test.Assert(t, "key:", c.expKey, key) + test.Assert(t, "value:", c.expValue, value) } } diff --git a/lib/ssh/section_host_test.go b/lib/ssh/section_host_test.go index 91cba1c6..75da857d 100644 --- a/lib/ssh/section_host_test.go +++ b/lib/ssh/section_host_test.go @@ -52,6 +52,6 @@ func TestNewSectionHost(t *testing.T) { for _, c := range cases { got := newSectionHost(c.rawPattern) got.postConfig(testParser.homeDir) - test.Assert(t, "newHost", c.exp(*testDefaultSection), got, true) + test.Assert(t, "newHost", c.exp(*testDefaultSection), got) } } diff --git a/lib/ssh/section_match_test.go b/lib/ssh/section_match_test.go index 06f67fc2..8d1a2a65 100644 --- a/lib/ssh/section_match_test.go +++ b/lib/ssh/section_match_test.go @@ -23,11 +23,11 @@ func TestNewSectionMatch(t *testing.T) { for _, c := range cases { got, err := newSectionMatch(c.raw) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } got.postConfig(testParser.homeDir) - test.Assert(t, "newSectionMatch", c.exp, got, true) + test.Assert(t, "newSectionMatch", c.exp, got) } } @@ -79,12 +79,12 @@ func TestParseCriteriaAll(t *testing.T) { for _, c := range cases { got, err := newSectionMatch(c.raw) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } got.postConfig(testParser.homeDir) test.Assert(t, "parseCriteriaAll", - c.exp(*testDefaultSection), got, true) + c.exp(*testDefaultSection), got) } } @@ -118,13 +118,13 @@ func TestNewSectionMatch_ParseCriteriaExec(t *testing.T) { for _, c := range cases { got, err := newSectionMatch(c.raw) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } got.postConfig(testParser.homeDir) t.Logf("got: %+v", got) test.Assert(t, "parseCriteriaExec", - c.exp(*testDefaultSection), got, true) + c.exp(*testDefaultSection), got) } } @@ -181,11 +181,10 @@ func TestParseCriteriaWithArg(t *testing.T) { for _, c := range cases { got, err := newSectionMatch(c.raw) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } got.postConfig(testParser.homeDir) - test.Assert(t, "parseCriteriaWithArg", - c.exp(*testDefaultSection), got, true) + test.Assert(t, "parseCriteriaWithArg", c.exp(*testDefaultSection), got) } } diff --git a/lib/ssh/ssh_test.go b/lib/ssh/ssh_test.go index 44c039ca..64970360 100644 --- a/lib/ssh/ssh_test.go +++ b/lib/ssh/ssh_test.go @@ -47,6 +47,6 @@ func TestPatternToRegex(t *testing.T) { for _, c := range cases { got := patternToRegex(c.in) - test.Assert(t, "patternToRegex", c.exp, got, true) + test.Assert(t, "patternToRegex", c.exp, got) } } diff --git a/lib/strings/row_test.go b/lib/strings/row_test.go index dc7c0519..b3ac097d 100644 --- a/lib/strings/row_test.go +++ b/lib/strings/row_test.go @@ -33,7 +33,7 @@ func TestRowIsEqual(t *testing.T) { for _, c := range cases { got := c.a.IsEqual(c.b) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -61,6 +61,6 @@ func TestRowJoin(t *testing.T) { for _, c := range cases { got := c.row.Join(c.lsep, c.ssep) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } diff --git a/lib/strings/statistic_test.go b/lib/strings/statistic_test.go index 5e498a83..c7d401b0 100644 --- a/lib/strings/statistic_test.go +++ b/lib/strings/statistic_test.go @@ -29,7 +29,7 @@ func TestCountAlnum(t *testing.T) { for _, c := range cases { got := CountAlnum(c.text) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -56,8 +56,8 @@ func TestCountAlnumDistribution(t *testing.T) { for _, c := range cases { gotChars, gotCounts := CountAlnumDistribution(c.text) - test.Assert(t, "chars", c.expChars, gotChars, true) - test.Assert(t, "counts", c.expCounts, gotCounts, true) + test.Assert(t, "chars", c.expChars, gotChars) + test.Assert(t, "counts", c.expCounts, gotCounts) } } @@ -97,8 +97,8 @@ func TestCountCharSequence(t *testing.T) { for _, c := range cases { gotChars, gotCounts := CountCharSequence(c.text) - test.Assert(t, "", c.expChars, gotChars, true) - test.Assert(t, "", c.expCounts, gotCounts, true) + test.Assert(t, "", c.expChars, gotChars) + test.Assert(t, "", c.expCounts, gotCounts) } } @@ -116,7 +116,7 @@ func TestCountDigit(t *testing.T) { for _, c := range cases { got := CountDigit(c.text) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -152,7 +152,7 @@ func TestCountNonAlnum(t *testing.T) { for _, c := range cases { got := CountNonAlnum(c.text, c.withspace) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -172,7 +172,7 @@ func TestCountUniqChar(t *testing.T) { for _, c := range cases { got := CountUniqChar(c.text) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -190,8 +190,8 @@ func TestCountUpperLower(t *testing.T) { for _, c := range cases { gotup, gotlo := CountUpperLower(c.text) - test.Assert(t, "", c.expUpper, gotup, true) - test.Assert(t, "", c.expLower, gotlo, true) + test.Assert(t, "", c.expUpper, gotup) + test.Assert(t, "", c.expLower, gotlo) } } @@ -219,8 +219,8 @@ func TestMaxCharSequence(t *testing.T) { for _, c := range cases { gotv, gotc := MaxCharSequence(c.text) - test.Assert(t, "", c.char, gotv, true) - test.Assert(t, "", c.count, gotc, true) + test.Assert(t, "", c.char, gotv) + test.Assert(t, "", c.count, gotc) } } @@ -240,7 +240,7 @@ func TestRatioAlnum(t *testing.T) { for _, c := range cases { got := RatioAlnum(c.text) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -260,7 +260,7 @@ func TestRatioDigit(t *testing.T) { for _, c := range cases { got := RatioDigit(c.text) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -289,7 +289,7 @@ func TestRatioNonAlnum(t *testing.T) { for _, c := range cases { got := RatioNonAlnum(c.text, c.withspace) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -306,7 +306,7 @@ func TestRatioUpper(t *testing.T) { for _, c := range cases { got := RatioUpper(c.text) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -328,7 +328,7 @@ func TestRatioUpperLower(t *testing.T) { for _, c := range cases { got := RatioUpperLower(c.text) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -365,7 +365,7 @@ func TestTextSumCountTokens(t *testing.T) { for _, c := range cases { got := TextSumCountTokens(c.text, c.tokens, c.sensitive) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -390,6 +390,6 @@ func TestTextFrequencyOfTokens(t *testing.T) { for _, c := range cases { got := TextFrequencyOfTokens(c.text, c.tokens, c.sensitive) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } diff --git a/lib/strings/string_test.go b/lib/strings/string_test.go index 1d404a24..62433dd2 100644 --- a/lib/strings/string_test.go +++ b/lib/strings/string_test.go @@ -24,7 +24,7 @@ func TestCleanURI(t *testing.T) { for _, c := range cases { got := CleanURI(c.text) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -72,7 +72,7 @@ func TestCleanWikiMarkup(t *testing.T) { for _, c := range cases { got := CleanWikiMarkup(c.text) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -96,7 +96,7 @@ func TestMergeSpaces(t *testing.T) { for _, c := range cases { got := MergeSpaces(c.text, c.withline) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -112,7 +112,7 @@ func TestReverse(t *testing.T) { for _, c := range cases { got := Reverse(c.input) - test.Assert(t, "Reverse", c.exp, got, true) + test.Assert(t, "Reverse", c.exp, got) } } @@ -128,7 +128,7 @@ func TestSingleSpace(t *testing.T) { }} for _, c := range cases { got := SingleSpace(c.in) - test.Assert(t, c.in, c.exp, got, true) + test.Assert(t, c.in, c.exp, got) } } @@ -160,7 +160,7 @@ func TestSplit(t *testing.T) { for _, c := range cases { got := Split(c.text, true, true) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -182,6 +182,6 @@ func TestTrimNonAlnum(t *testing.T) { for _, c := range cases { got := TrimNonAlnum(c.text) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } diff --git a/lib/strings/strings_test.go b/lib/strings/strings_test.go index 778a7122..6984b7c1 100644 --- a/lib/strings/strings_test.go +++ b/lib/strings/strings_test.go @@ -46,7 +46,7 @@ func TestCountMissRate(t *testing.T) { for _, c := range cases { got, _, _ := CountMissRate(c.src, c.target) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -72,7 +72,7 @@ func TestCountTokens(t *testing.T) { for _, c := range cases { got := CountTokens(c.words, c.tokens, c.sensitive) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -93,8 +93,8 @@ func TestDelete(t *testing.T) { for _, c := range cases { var ok bool c.in, ok = Delete(c.in, value) - test.Assert(t, "Delete OK?", true, ok, true) - test.Assert(t, "Delete", exp, c.in, true) + test.Assert(t, "Delete OK?", true, ok) + test.Assert(t, "Delete", exp, c.in) } } @@ -113,7 +113,7 @@ func TestFrequencyOfTokens(t *testing.T) { for _, c := range cases { got := FrequencyOfTokens(c.words, c.tokens, c.sensitive) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -121,10 +121,10 @@ func TestIsContain(t *testing.T) { ss := []string{"a", "b", "c", "d"} got := IsContain(ss, "a") - test.Assert(t, "", true, got, true) + test.Assert(t, "", true, got) got = IsContain(ss, "e") - test.Assert(t, "", false, got, true) + test.Assert(t, "", false, got) } func TestIsEqual(t *testing.T) { @@ -151,7 +151,7 @@ func TestIsEqual(t *testing.T) { }} for _, c := range cases { - test.Assert(t, "", c.exp, IsEqual(c.a, c.b), true) + test.Assert(t, "", c.exp, IsEqual(c.a, c.b)) } } @@ -176,8 +176,8 @@ func TestLongest(t *testing.T) { for _, c := range cases { got, idx := Longest(c.words) - test.Assert(t, "word", c.exp, got, true) - test.Assert(t, "idx", c.expIdx, idx, true) + test.Assert(t, "word", c.exp, got) + test.Assert(t, "idx", c.expIdx, idx) } } @@ -205,7 +205,7 @@ func TestMostFrequentTokens(t *testing.T) { for _, c := range cases { got := MostFrequentTokens(c.words, c.tokens, c.sensitive) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -216,7 +216,7 @@ func TestSortByIndex(t *testing.T) { SortByIndex(&dat, ids) - test.Assert(t, "", exp, dat, true) + test.Assert(t, "", exp, dat) } func TestSwap(t *testing.T) { @@ -248,7 +248,7 @@ func TestSwap(t *testing.T) { }} for _, c := range cases { Swap(ss, c.x, c.y) - test.Assert(t, "", c.exp, ss, true) + test.Assert(t, "", c.exp, ss) } } @@ -268,7 +268,7 @@ func TestTotalFrequencyOfTokens(t *testing.T) { for _, c := range cases { got := TotalFrequencyOfTokens(c.words, c.tokens, c.sensitive) - test.Assert(t, "", c.exp, numbers.Float64Round(got, 3), true) + test.Assert(t, "", c.exp, numbers.Float64Round(got, 3)) } } @@ -291,7 +291,7 @@ func TestUniq(t *testing.T) { for _, c := range cases { got := Uniq(c.words, c.sensitive) - test.Assert(t, "unique", c.expReturn, got, true) - test.Assert(t, "words", c.expWords, c.words, true) + test.Assert(t, "unique", c.expReturn, got) + test.Assert(t, "words", c.expWords, c.words) } } diff --git a/lib/strings/table_test.go b/lib/strings/table_test.go index 41850d48..7998b441 100644 --- a/lib/strings/table_test.go +++ b/lib/strings/table_test.go @@ -54,7 +54,7 @@ func TestPartition(t *testing.T) { got := Partition(c.ss, c.k) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -71,7 +71,7 @@ func TestSinglePartition(t *testing.T) { for _, c := range cases { got := SinglePartition(c.ss) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -112,7 +112,7 @@ func TestTable_IsEqual(t *testing.T) { for _, c := range cases { got := table.IsEqual(c.tcmp) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } @@ -148,6 +148,6 @@ func TestTable_JoinCombination(t *testing.T) { for _, c := range cases { got := c.table.JoinCombination(c.s) - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } diff --git a/lib/strings/to_test.go b/lib/strings/to_test.go index ac7906b3..f04cb9b4 100644 --- a/lib/strings/to_test.go +++ b/lib/strings/to_test.go @@ -16,7 +16,7 @@ func TestToFloat64(t *testing.T) { got := ToFloat64(in) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestToInt64(t *testing.T) { @@ -25,7 +25,7 @@ func TestToInt64(t *testing.T) { got := ToInt64(in) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestToStrings(t *testing.T) { @@ -39,5 +39,5 @@ func TestToStrings(t *testing.T) { got := ToStrings(is) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/tabula/column_test.go b/lib/tabula/column_test.go index 7e0ad9c4..39d68d59 100644 --- a/lib/tabula/column_test.go +++ b/lib/tabula/column_test.go @@ -31,7 +31,7 @@ func TestToFloatSlice(t *testing.T) { got := col.ToFloatSlice() expFloat := []float64{9.987654321, 8.8, 7.7, 6.6, 5.5, 4.4, 3.3} - test.Assert(t, "", expFloat, got, true) + test.Assert(t, "", expFloat, got) } func TestToStringSlice(t *testing.T) { @@ -50,7 +50,7 @@ func TestToStringSlice(t *testing.T) { got := col.ToStringSlice() - test.Assert(t, "", data, got, true) + test.Assert(t, "", data, got) } func TestDeleteRecordAt(t *testing.T) { @@ -65,5 +65,5 @@ func TestDeleteRecordAt(t *testing.T) { col.DeleteRecordAt(del) got := col.ToFloatSlice() - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/tabula/dataset_test.go b/lib/tabula/dataset_test.go index 89e70b97..68598deb 100644 --- a/lib/tabula/dataset_test.go +++ b/lib/tabula/dataset_test.go @@ -117,13 +117,13 @@ func TestSplitRowsByNumeric(t *testing.T) { rows := splitL.GetDataAsRows() got := fmt.Sprint(rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) expIdx = []int{5, 6, 7, 8, 9} exp = DatasetStringJoinByIndex(t, datasetRows, expIdx) got = fmt.Sprint(splitR.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Split by float splitL, splitR, e = SplitRowsByNumeric(dataset, 1, 1.8) @@ -135,13 +135,13 @@ func TestSplitRowsByNumeric(t *testing.T) { exp = DatasetStringJoinByIndex(t, datasetRows, expIdx) got = fmt.Sprint(splitL.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) expIdx = []int{8, 9} exp = DatasetStringJoinByIndex(t, datasetRows, expIdx) got = fmt.Sprint(splitR.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestSplitRowsByCategorical(t *testing.T) { @@ -158,13 +158,13 @@ func TestSplitRowsByCategorical(t *testing.T) { exp := DatasetStringJoinByIndex(t, datasetRows, expIdx) got := fmt.Sprint(splitL.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) expIdx = []int{1, 3, 4, 6, 8, 9} exp = DatasetStringJoinByIndex(t, datasetRows, expIdx) got = fmt.Sprint(splitR.GetDataAsRows()) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeColumnsPushColumn(t *testing.T) { @@ -185,12 +185,12 @@ func TestModeColumnsPushColumn(t *testing.T) { got += fmt.Sprint(dataset.Columns[x].Records) } - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Check rows exp = "" got = fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeRowsPushColumn(t *testing.T) { @@ -202,13 +202,13 @@ func TestModeRowsPushColumn(t *testing.T) { exp := DatasetRowsJoin(t) got := fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Check columns exp = "[{int 1 0 [] []} {real 2 0 [] []} {string 0 0 [] []}]" got = fmt.Sprint(dataset.Columns) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeMatrixPushColumn(t *testing.T) { @@ -229,13 +229,13 @@ func TestModeMatrixPushColumn(t *testing.T) { got += fmt.Sprint(dataset.Columns[x].Records) } - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Check rows exp = DatasetRowsJoin(t) got = fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeRowsPushRows(t *testing.T) { @@ -249,7 +249,7 @@ func TestModeRowsPushRows(t *testing.T) { exp := DatasetRowsJoin(t) got := fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeColumnsPushRows(t *testing.T) { @@ -264,7 +264,7 @@ func TestModeColumnsPushRows(t *testing.T) { exp := "" got := fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // check columns exp = DatasetColumnsJoin(t) @@ -273,7 +273,7 @@ func TestModeColumnsPushRows(t *testing.T) { got += fmt.Sprint(dataset.Columns[x].Records) } - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestModeMatrixPushRows(t *testing.T) { @@ -287,7 +287,7 @@ func TestModeMatrixPushRows(t *testing.T) { exp := DatasetRowsJoin(t) got := fmt.Sprint(dataset.Rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // check columns exp = DatasetColumnsJoin(t) @@ -296,7 +296,7 @@ func TestModeMatrixPushRows(t *testing.T) { got += fmt.Sprint(dataset.Columns[x].Records) } - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestSelectRowsWhere(t *testing.T) { @@ -312,7 +312,7 @@ func TestSelectRowsWhere(t *testing.T) { exp := dataset.GetRow(9) got := selected.GetRow(0) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestDeleteRow(t *testing.T) { @@ -330,13 +330,13 @@ func TestDeleteRow(t *testing.T) { dataset.DeleteRow(delIdx) got := dataset.Len() - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) // Check columns len. for _, col := range dataset.Columns { got = col.Len() - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } // Check rows data. @@ -349,7 +349,7 @@ func TestDeleteRow(t *testing.T) { got := fmt.Sprint(dataset.GetRow(ridx)) ridx++ - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } // Check columns data. @@ -362,6 +362,6 @@ func TestDeleteRow(t *testing.T) { exp := fmt.Sprint(coldel) got := fmt.Sprint(dataset.Columns[x].Records) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } } diff --git a/lib/tabula/maprows_test.go b/lib/tabula/maprows_test.go index 19cd5ac8..8cd0f2d2 100644 --- a/lib/tabula/maprows_test.go +++ b/lib/tabula/maprows_test.go @@ -26,7 +26,7 @@ func TestAddRow(t *testing.T) { got := fmt.Sprint(mapRows) - test.Assert(t, "", groupByExpect, got, true) + test.Assert(t, "", groupByExpect, got) } func TestGetMinority(t *testing.T) { @@ -50,5 +50,5 @@ func TestGetMinority(t *testing.T) { exp := rowsExpect[3] got := fmt.Sprint(minRows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/tabula/record_test.go b/lib/tabula/record_test.go index 223f9235..dd7593bc 100644 --- a/lib/tabula/record_test.go +++ b/lib/tabula/record_test.go @@ -31,5 +31,5 @@ func TestRecord(t *testing.T) { exp := fmt.Sprint(expec) got := fmt.Sprint(row) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/tabula/records_test.go b/lib/tabula/records_test.go index 2be6f7b1..fd13d12f 100644 --- a/lib/tabula/records_test.go +++ b/lib/tabula/records_test.go @@ -25,5 +25,5 @@ func TestSortByIndex(t *testing.T) { got := fmt.Sprint(sorted) exp := fmt.Sprint(&expect) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } diff --git a/lib/tabula/row_test.go b/lib/tabula/row_test.go index e40a1cf0..7b7d3e5c 100644 --- a/lib/tabula/row_test.go +++ b/lib/tabula/row_test.go @@ -23,9 +23,9 @@ func TestClone(t *testing.T) { rowClone := row.Clone() rowClone2 := row.Clone() - test.Assert(t, "", &row, rowClone, true) + test.Assert(t, "", &row, rowClone) // changing the clone value should not change the original copy. (*rowClone2)[0].SetFloat(0) - test.Assert(t, "", &row, rowClone, true) + test.Assert(t, "", &row, rowClone) } diff --git a/lib/tabula/rows_test.go b/lib/tabula/rows_test.go index 56e1b5cc..02857523 100644 --- a/lib/tabula/rows_test.go +++ b/lib/tabula/rows_test.go @@ -21,7 +21,7 @@ func TestPushBack(t *testing.T) { exp := strings.Join(rowsExpect, "") got := fmt.Sprint(rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestPopFront(t *testing.T) { @@ -37,7 +37,7 @@ func TestPopFront(t *testing.T) { exp := rowsExpect[i] got := fmt.Sprint(row) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) if i < l { exp = strings.Join(rowsExpect[i+1:], "") @@ -46,7 +46,7 @@ func TestPopFront(t *testing.T) { } got = fmt.Sprint(rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } // empty rows @@ -55,7 +55,7 @@ func TestPopFront(t *testing.T) { exp := "<nil>" got := fmt.Sprint(row) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestPopFrontRow(t *testing.T) { @@ -71,7 +71,7 @@ func TestPopFrontRow(t *testing.T) { exp := rowsExpect[i] got := fmt.Sprint(newRows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) if i < l { exp = strings.Join(rowsExpect[i+1:], "") @@ -80,7 +80,7 @@ func TestPopFrontRow(t *testing.T) { } got = fmt.Sprint(rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } // empty rows @@ -89,7 +89,7 @@ func TestPopFrontRow(t *testing.T) { exp := "" got := fmt.Sprint(row) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) } func TestGroupByValue(t *testing.T) { @@ -102,7 +102,7 @@ func TestGroupByValue(t *testing.T) { got := fmt.Sprint(mapRows) - test.Assert(t, "", groupByExpect, got, true) + test.Assert(t, "", groupByExpect, got) } func TestRandomPick(t *testing.T) { @@ -171,8 +171,8 @@ func TestRowsDel(t *testing.T) { exp := strings.Join(rowsExpect[1:], "") got := fmt.Sprint(rows) - test.Assert(t, "", exp, got, true) + test.Assert(t, "", exp, got) got = fmt.Sprint(row) - test.Assert(t, "", rowsExpect[0], got, true) + test.Assert(t, "", rowsExpect[0], got) } diff --git a/lib/test/test.go b/lib/test/test.go index a8343bd2..b28b676b 100644 --- a/lib/test/test.go +++ b/lib/test/test.go @@ -37,56 +37,35 @@ func printStackTrace(t testing.TB, trace []byte) { } // -// Assert will compare two interfaces: `exp` and `got` for equality. -// If both are not equal, the test will throw panic parameter describe the -// position (type and value) where both are not matched. +// Assert compare two interfaces: `exp` and `got` for equality. +// If both parameters are not equal, the function will call Fatalf that +// describe the position (type and value) where value are not matched. // // If `exp` implement the extended `reflect.Equaler`, then it will use the // method `IsEqual()` with `got` as parameter. // -// If debug parameter is true it will print the stack trace of testing.T -// instance. +// WARNING: this method does not support recursive pointer, for example a node +// that point to parent and parent that point back to node again. // -// WARNING: this method does not support recursive pointer, for example node -// that point to parent and parent that point back to node. -// -func Assert(t *testing.T, name string, exp, got interface{}, debug bool) { +func Assert(t *testing.T, name string, exp, got interface{}) { err := reflect.DoEqual(exp, got) if err == nil { return } - if debug { - trace := make([]byte, 1024) - runtime.Stack(trace, false) - printStackTrace(t, trace) - } + trace := make([]byte, 1024) + runtime.Stack(trace, false) + printStackTrace(t, trace) t.Fatalf("!!! %s: %s", name, err) } // -// AssertBench will compare two interfaces: `exp` and `got` whether its same -// with `equal` value. +// AssertBench will compare two interfaces: `exp` and `got` for equality. +// If both parameters are not equal, the function will call Fatalf that +// describe the position (type and value) where value are not matched. // -// If comparison result is not same with `equal`, it will print the result and -// expectation and then terminate the test routine. -// -func AssertBench(b *testing.B, name string, exp, got interface{}, equal bool) { - if reflect.IsEqual(exp, got) == equal { - return - } - - trace := make([]byte, 1024) - runtime.Stack(trace, false) - - printStackTrace(b, trace) - - b.Fatalf(">>> Got %s:\n\t'%+v';\n"+ - " want:\n\t'%+v'\n", name, got, exp) -} - -func AssertBench2(b *testing.B, name string, exp, got interface{}) { +func AssertBench(b *testing.B, name string, exp, got interface{}) { err := reflect.DoEqual(exp, got) if err == nil { return diff --git a/lib/test/test_test.go b/lib/test/test_test.go index c4f2f2a9..992fe888 100644 --- a/lib/test/test_test.go +++ b/lib/test/test_test.go @@ -10,22 +10,20 @@ import ( func TestAssert(t *testing.T) { cases := []struct { - desc string - in interface{} - exp interface{} - expEqual bool + desc string + in interface{} + exp interface{} }{ { - desc: "With nil", - in: nil, - exp: nil, - expEqual: true, + desc: "With nil", + in: nil, + exp: nil, }, } for _, c := range cases { t.Log(c.desc) - Assert(t, "interface{}", c.exp, c.in, c.expEqual) + Assert(t, "interface{}", c.exp, c.in) } } diff --git a/lib/time/duration_bench_test.go b/lib/time/duration_bench_test.go index f7faf9b6..27acf9c4 100644 --- a/lib/time/duration_bench_test.go +++ b/lib/time/duration_bench_test.go @@ -24,6 +24,6 @@ func BenchmarkParseDuration(b *testing.B) { b.Fatal(err) } - test.AssertBench(b, "duration", exp, got, true) + test.AssertBench(b, "duration", exp, got) } } diff --git a/lib/time/duration_test.go b/lib/time/duration_test.go index e0a01a51..618191c1 100644 --- a/lib/time/duration_test.go +++ b/lib/time/duration_test.go @@ -63,9 +63,9 @@ func TestParseDuration(t *testing.T) { if strings.IsContain(c.expErr, err.Error()) { continue } - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) } - test.Assert(t, "duration", c.exp, got, true) + test.Assert(t, "duration", c.exp, got) } } diff --git a/lib/totp/totp_test.go b/lib/totp/totp_test.go index 311e813d..be1f9c54 100644 --- a/lib/totp/totp_test.go +++ b/lib/totp/totp_test.go @@ -56,7 +56,7 @@ func TestProtocol_generateWithTimestamp_sha1(t *testing.T) { t.Error(err) continue } - test.Assert(t, "generateWithTimestamp", c.exp, got, false) + test.Assert(t, "generateWithTimestamp", c.exp, got) } } @@ -102,7 +102,7 @@ func TestProtocol_generateWithTimestamp_sha256(t *testing.T) { t.Error(err) continue } - test.Assert(t, "generateWithTimestamp", c.exp, got, false) + test.Assert(t, "generateWithTimestamp", c.exp, got) } } @@ -150,7 +150,7 @@ func TestProtocol_generateWithTimestamp_sha512(t *testing.T) { t.Error(err) continue } - test.Assert(t, "generateWithTimestamp sha512", c.exp, got, false) + test.Assert(t, "generateWithTimestamp sha512", c.exp, got) } } @@ -193,6 +193,6 @@ func TestProtocol_verifyWithTimestamp(t *testing.T) { for _, c := range cases { got := p.verifyWithTimestamp(mac, c.token, c.steps, c.ts) - test.Assert(t, c.desc, c.exp, got, false) + test.Assert(t, c.desc, c.exp, got) } } diff --git a/lib/websocket/client_test.go b/lib/websocket/client_test.go index 466e0932..540fc31b 100644 --- a/lib/websocket/client_test.go +++ b/lib/websocket/client_test.go @@ -53,7 +53,7 @@ func TestConnect(t *testing.T) { err := client.Connect() if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } @@ -102,12 +102,12 @@ func TestClient_parseURI(t *testing.T) { err := cl.parseURI() if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) continue } - test.Assert(t, "remote address", c.expRemoteAddress, cl.remoteAddr, true) - test.Assert(t, "TLS config", c.expTLSConfig, cl.TLSConfig, true) + test.Assert(t, "remote address", c.expRemoteAddress, cl.remoteAddr) + test.Assert(t, "TLS config", c.expTLSConfig, cl.TLSConfig) } } @@ -183,7 +183,7 @@ func TestClientPing(t *testing.T) { testClient.handleClose = func(cl *Client, got *Frame) error { exp := c.expClose - test.Assert(t, "close", exp, got, true) + test.Assert(t, "close", exp, got) if len(got.payload) >= 2 { got.payload = got.payload[2:] @@ -197,7 +197,7 @@ func TestClientPing(t *testing.T) { testClient.handlePong = func(cl *Client, got *Frame) (err error) { exp := c.exp - test.Assert(t, "handlePong", exp, got, true) + test.Assert(t, "handlePong", exp, got) wg.Done() return nil } @@ -318,7 +318,7 @@ func TestClientText(t *testing.T) { testClient.handleClose = func(cl *Client, got *Frame) error { exp := c.expClose - test.Assert(t, "close", exp, got, true) + test.Assert(t, "close", exp, got) cl.sendClose(got.closeCode, got.payload) cl.Quit() wg.Done() @@ -327,7 +327,7 @@ func TestClientText(t *testing.T) { testClient.HandleText = func(cl *Client, got *Frame) error { exp := c.exp - test.Assert(t, "text", exp, got, true) + test.Assert(t, "text", exp, got) wg.Done() return nil } @@ -449,7 +449,7 @@ func TestClientFragmentation(t *testing.T) { testClient.handleClose = func(cl *Client, got *Frame) error { exp := c.expClose - test.Assert(t, "close", exp, got, true) + test.Assert(t, "close", exp, got) cl.sendClose(got.closeCode, got.payload) cl.Quit() wg.Done() @@ -458,7 +458,7 @@ func TestClientFragmentation(t *testing.T) { testClient.HandleText = func(cl *Client, got *Frame) error { exp := c.exp - test.Assert(t, "text", exp, got, true) + test.Assert(t, "text", exp, got) wg.Done() return nil } @@ -524,7 +524,7 @@ func TestClientFragmentation2(t *testing.T) { payload: []byte("PING"), isComplete: true, } - test.Assert(t, "handlePong", exp, got, true) + test.Assert(t, "handlePong", exp, got) wg.Done() return nil } @@ -537,7 +537,7 @@ func TestClientFragmentation2(t *testing.T) { payload: []byte("Hello, Shulhan"), isComplete: true, } - test.Assert(t, "handlePong", exp, got, true) + test.Assert(t, "handlePong", exp, got) wg.Done() return nil } @@ -602,7 +602,7 @@ func TestClientSendBin(t *testing.T) { testClient.HandleBin = func(cl *Client, got *Frame) error { exp := c.exp - test.Assert(t, "HandleBin", exp, got, true) + test.Assert(t, "HandleBin", exp, got) wg.Done() return nil } @@ -664,7 +664,7 @@ func TestClientSendPing(t *testing.T) { testClient.handlePong = func(cl *Client, got *Frame) error { exp := c.exp - test.Assert(t, "handlePong", exp, got, true) + test.Assert(t, "handlePong", exp, got) wg.Done() return nil } @@ -705,7 +705,7 @@ func TestClient_sendClose(t *testing.T) { payload: []byte{0x03, 0xE8, 'n', 'o', 'r', 'm', 'a', 'l'}, isComplete: true, } - test.Assert(t, "handleClose", exp, got, true) + test.Assert(t, "handleClose", exp, got) cl.Quit() wg.Done() return nil @@ -721,5 +721,5 @@ func TestClient_sendClose(t *testing.T) { err = testClient.SendPing(nil) - test.Assert(t, "error", ErrConnClosed, err, true) + test.Assert(t, "error", ErrConnClosed, err) } diff --git a/lib/websocket/clientmanager_test.go b/lib/websocket/clientmanager_test.go index 7ff065ae..91549565 100644 --- a/lib/websocket/clientmanager_test.go +++ b/lib/websocket/clientmanager_test.go @@ -58,8 +58,8 @@ func TestClientManagerAdd(t *testing.T) { gotConns := fmt.Sprintf("%v", clients.conns) gotCtxLen := len(clients.ctx) - test.Assert(t, "ClientManager.conns", c.expConns, gotConns, true) - test.Assert(t, "ClientManager.ctx", c.expCtxLen, gotCtxLen, true) + test.Assert(t, "ClientManager.conns", c.expConns, gotConns) + test.Assert(t, "ClientManager.ctx", c.expCtxLen, gotCtxLen) } } @@ -103,7 +103,7 @@ func TestClientManagerRemove(t *testing.T) { gotConns := fmt.Sprintf("%v", clients.conns) gotCtxLen := len(clients.ctx) - test.Assert(t, "conns", c.expConns, gotConns, true) - test.Assert(t, "ClientManager.ctx", c.expCtxLen, gotCtxLen, true) + test.Assert(t, "conns", c.expConns, gotConns) + test.Assert(t, "ClientManager.ctx", c.expCtxLen, gotCtxLen) } } diff --git a/lib/websocket/frame_test.go b/lib/websocket/frame_test.go index 1775f44c..f91f0bb2 100644 --- a/lib/websocket/frame_test.go +++ b/lib/websocket/frame_test.go @@ -44,10 +44,10 @@ func TestNewFrameBin(t *testing.T) { frames := Unpack(packet) frame := frames.v[0] - test.Assert(t, "Frame.fin", c.exp.fin, frame.fin, true) - test.Assert(t, "Frame.opcode", c.exp.opcode, frame.opcode, true) - test.Assert(t, "Frame.masked", c.exp.masked, frame.masked, true) - test.Assert(t, "Frame.payload", c.exp.payload, frame.payload, true) + test.Assert(t, "Frame.fin", c.exp.fin, frame.fin) + test.Assert(t, "Frame.opcode", c.exp.opcode, frame.opcode) + test.Assert(t, "Frame.masked", c.exp.masked, frame.masked) + test.Assert(t, "Frame.payload", c.exp.payload, frame.payload) } } @@ -87,12 +87,11 @@ func TestNewFrameClose(t *testing.T) { frames := Unpack(packet) frame := frames.v[0] - test.Assert(t, "Frame.fin", c.exp.fin, frame.fin, true) - test.Assert(t, "Frame.opcode", c.exp.opcode, frame.opcode, true) - test.Assert(t, "Frame.closeCode", c.exp.closeCode, - frame.closeCode, true) - test.Assert(t, "Frame.masked", c.exp.masked, frame.masked, true) - test.Assert(t, "Frame.payload", c.exp.payload, frame.payload, true) + test.Assert(t, "Frame.fin", c.exp.fin, frame.fin) + test.Assert(t, "Frame.opcode", c.exp.opcode, frame.opcode) + test.Assert(t, "Frame.closeCode", c.exp.closeCode, frame.closeCode) + test.Assert(t, "Frame.masked", c.exp.masked, frame.masked) + test.Assert(t, "Frame.payload", c.exp.payload, frame.payload) } } @@ -128,10 +127,10 @@ func TestNewFramePing(t *testing.T) { frames := Unpack(packet) frame := frames.v[0] - test.Assert(t, "Frame.fin", c.exp.fin, frame.fin, true) - test.Assert(t, "Frame.opcode", c.exp.opcode, frame.opcode, true) - test.Assert(t, "Frame.masked", c.exp.masked, frame.masked, true) - test.Assert(t, "Frame.payload", c.exp.payload, frame.payload, true) + test.Assert(t, "Frame.fin", c.exp.fin, frame.fin) + test.Assert(t, "Frame.opcode", c.exp.opcode, frame.opcode) + test.Assert(t, "Frame.masked", c.exp.masked, frame.masked) + test.Assert(t, "Frame.payload", c.exp.payload, frame.payload) } } @@ -167,10 +166,10 @@ func TestNewFramePong(t *testing.T) { frames := Unpack(packet) frame := frames.v[0] - test.Assert(t, "Frame.fin", c.exp.fin, frame.fin, true) - test.Assert(t, "Frame.opcode", c.exp.opcode, frame.opcode, true) - test.Assert(t, "Frame.masked", c.exp.masked, frame.masked, true) - test.Assert(t, "Frame.payload", c.exp.payload, frame.payload, true) + test.Assert(t, "Frame.fin", c.exp.fin, frame.fin) + test.Assert(t, "Frame.opcode", c.exp.opcode, frame.opcode) + test.Assert(t, "Frame.masked", c.exp.masked, frame.masked) + test.Assert(t, "Frame.payload", c.exp.payload, frame.payload) } } @@ -207,10 +206,10 @@ func TestNewFrameText(t *testing.T) { frames := Unpack(packet) frame := frames.v[0] - test.Assert(t, "Frame.fin", c.exp.fin, frame.fin, true) - test.Assert(t, "Frame.opcode", c.exp.opcode, frame.opcode, true) - test.Assert(t, "Frame.masked", c.exp.masked, frame.masked, true) - test.Assert(t, "Frame.payload", c.exp.payload, frame.payload, true) + test.Assert(t, "Frame.fin", c.exp.fin, frame.fin) + test.Assert(t, "Frame.opcode", c.exp.opcode, frame.opcode) + test.Assert(t, "Frame.masked", c.exp.masked, frame.masked) + test.Assert(t, "Frame.payload", c.exp.payload, frame.payload) } } @@ -345,6 +344,6 @@ func TestFramePack(t *testing.T) { got := c.f.pack() - test.Assert(t, "", c.exp, got, true) + test.Assert(t, "", c.exp, got) } } diff --git a/lib/websocket/frames_test.go b/lib/websocket/frames_test.go index 22e6379b..3cf0979e 100644 --- a/lib/websocket/frames_test.go +++ b/lib/websocket/frames_test.go @@ -177,7 +177,7 @@ func TestFrameUnpack(t *testing.T) { gots := Unpack(c.in) if gots != nil && len(gots.v) > 0 { - test.Assert(t, "", c.exp, gots.v[0], true) + test.Assert(t, "", c.exp, gots.v[0]) } } } @@ -209,9 +209,8 @@ func TestFramesAppend(t *testing.T) { frames.Append(c.f) - test.Assert(t, "Frames.Len", c.expLen, len(frames.v), true) - test.Assert(t, "Frames.payload", c.expPayload, - string(frames.payload()), true) + test.Assert(t, "Frames.Len", c.expLen, len(frames.v)) + test.Assert(t, "Frames.payload", c.expPayload, string(frames.payload())) } } @@ -247,7 +246,7 @@ func TestFramesIsClosed(t *testing.T) { for _, c := range cases { t.Log(c.desc) got := c.frames.isClosed() - test.Assert(t, "Frames.isClosed", c.exp, got, true) + test.Assert(t, "Frames.isClosed", c.exp, got) } } @@ -329,6 +328,6 @@ func TestFramesPayload(t *testing.T) { got := c.fs.payload() - test.Assert(t, "Frames.payload", c.exp, string(got), true) + test.Assert(t, "Frames.payload", c.exp, string(got)) } } diff --git a/lib/websocket/handshake_test.go b/lib/websocket/handshake_test.go index e6b2e32f..dc207dba 100644 --- a/lib/websocket/handshake_test.go +++ b/lib/websocket/handshake_test.go @@ -54,10 +54,10 @@ func TestHandshakeParseHTTPLine(t *testing.T) { err := h.parseHTTPLine() if err != nil { - test.Assert(t, "err", c.expErr, err, true) + test.Assert(t, "err", c.expErr, err) continue } - test.Assert(t, "URI", c.expURI, h.URL.String(), true) + test.Assert(t, "URI", c.expURI, h.URL.String()) } } diff --git a/lib/websocket/request_test.go b/lib/websocket/request_test.go index 916db0d9..a5e5fc7c 100644 --- a/lib/websocket/request_test.go +++ b/lib/websocket/request_test.go @@ -18,13 +18,13 @@ func TestRequestReset(t *testing.T) { req.reset() - test.Assert(t, "Request.ID", uint64(0), req.ID, true) - test.Assert(t, "Request.Method", "", req.Method, true) - test.Assert(t, "Request.Target", "", req.Target, true) - test.Assert(t, "Request.Body", "", req.Body, true) - test.Assert(t, "Request.Path", "", req.Path, true) - test.Assert(t, "Request.Params", targetParam{}, req.Params, true) - test.Assert(t, "Request.Query", url.Values{}, req.Query, true) + test.Assert(t, "Request.ID", uint64(0), req.ID) + test.Assert(t, "Request.Method", "", req.Method) + test.Assert(t, "Request.Target", "", req.Target) + test.Assert(t, "Request.Body", "", req.Body) + test.Assert(t, "Request.Path", "", req.Path) + test.Assert(t, "Request.Params", targetParam{}, req.Params) + test.Assert(t, "Request.Query", url.Values{}, req.Query) } func testHandleGet(ctx context.Context, req *Request) (res Response) { @@ -93,11 +93,11 @@ func TestRequestUnpack(t *testing.T) { _, err := c.req.unpack(rootRoutes) if err != nil { - test.Assert(t, "error", c.expErr, err.Error(), true) + test.Assert(t, "error", c.expErr, err.Error()) continue } - test.Assert(t, "Params", c.expParams, c.req.Params, true) - test.Assert(t, "Query", c.expQuery, c.req.Query, true) + test.Assert(t, "Params", c.expParams, c.req.Params) + test.Assert(t, "Query", c.expQuery, c.req.Query) } } diff --git a/lib/websocket/response_test.go b/lib/websocket/response_test.go index b5a2d016..006a7310 100644 --- a/lib/websocket/response_test.go +++ b/lib/websocket/response_test.go @@ -15,8 +15,8 @@ func TestResponseReset(t *testing.T) { res.reset() - test.Assert(t, "Response.ID", uint64(0), res.ID, true) - test.Assert(t, "Response.Code", int32(0), res.Code, true) - test.Assert(t, "Response.Message", "", res.Message, true) - test.Assert(t, "Response.Body", "", res.Body, true) + test.Assert(t, "Response.ID", uint64(0), res.ID) + test.Assert(t, "Response.Code", int32(0), res.Code) + test.Assert(t, "Response.Message", "", res.Message) + test.Assert(t, "Response.Body", "", res.Body) } diff --git a/lib/websocket/rootroute_test.go b/lib/websocket/rootroute_test.go index c9ec3c32..4fe65c38 100644 --- a/lib/websocket/rootroute_test.go +++ b/lib/websocket/rootroute_test.go @@ -20,7 +20,7 @@ var ( func testRouteHandler(t *testing.T, target string) RouteHandler { return func(ctx context.Context, req *Request) (res Response) { - test.Assert(t, "routeHandler", target, req.Target, true) + test.Assert(t, "routeHandler", target, req.Target) return } } @@ -153,12 +153,12 @@ func testRootRouteAdd(t *testing.T) { err := _testRootRoute.add(c.method, c.target, c.handler) if err != nil { - test.Assert(t, "err", c.expErr, err, true) + test.Assert(t, "err", c.expErr, err) } got := _testRootRoute.getParent(c.method) - test.Assert(t, "route", fmt.Sprintf("%+v", c.exp), fmt.Sprintf("%+v", got), true) + test.Assert(t, "route", fmt.Sprintf("%+v", c.exp), fmt.Sprintf("%+v", got)) } } @@ -232,7 +232,7 @@ func testRootRouteGet(t *testing.T) { gotParams, gotHandler := _testRootRoute.get(c.method, c.target) - test.Assert(t, "params", c.expParams, gotParams, true) + test.Assert(t, "params", c.expParams, gotParams) if gotHandler != nil { gotHandler(context.Background(), &Request{Target: c.expTarget}) diff --git a/lib/websocket/server_test.go b/lib/websocket/server_test.go index e147b036..b93acedd 100644 --- a/lib/websocket/server_test.go +++ b/lib/websocket/server_test.go @@ -250,7 +250,7 @@ func TestServerHandshake(t *testing.T) { _, err = cl.doHandshake("", bb.Bytes()) if err != nil { - test.Assert(t, "error", c.expError, err.Error(), true) + test.Assert(t, "error", c.expError, err.Error()) } } } @@ -261,6 +261,5 @@ func TestServer_Health(t *testing.T) { t.Fatal(err) } - test.Assert(t, "/status response code", http.StatusOK, - res.StatusCode, true) + test.Assert(t, "/status response code", http.StatusOK, res.StatusCode) } diff --git a/lib/xmlrpc/request_test.go b/lib/xmlrpc/request_test.go index 1a0f149f..5af05d8c 100644 --- a/lib/xmlrpc/request_test.go +++ b/lib/xmlrpc/request_test.go @@ -74,6 +74,6 @@ func TestRequest(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Pack", c.exp, string(got), true) + test.Assert(t, "Pack", c.exp, string(got)) } } diff --git a/lib/xmlrpc/response_test.go b/lib/xmlrpc/response_test.go index 0928ca97..04e97913 100644 --- a/lib/xmlrpc/response_test.go +++ b/lib/xmlrpc/response_test.go @@ -98,6 +98,6 @@ func TestResponse(t *testing.T) { t.Fatal(err) } - test.Assert(t, "Response", c.exp, got, true) + test.Assert(t, "Response", c.exp, got) } } |
