FreeThreads
Published in

FreeThreads

Golang Testify: require vs assert

Library Code

assert is a boolean test. An example implementation is following:

package assertfunc Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
if err == nil {
if h, ok := t.(tHelper); ok {
h.Helper()
}
// Prints error trace, test details and error message
return Fail(t, "An error is expected but got nil.", msgAndArgs...)
}
return true
}

--

--

--

Discuss design, distributed systems, developer tools, programming languages

Recommended from Medium

What is Docker and what problem does it solve?

Analyze your AWS Lambda Logs with Cloudwatch Logs Insights

Programming’s 1 golden rule : Momentum.

Grab your Microsoft Azure Free Vouchers before it goes

HTTP codes as Valentine’s Day comics

Balancing Chemical Equations With Python

An inquiry into the nature and causes of resource limitations for a Celery app in Kubernetes

Odoo Basic, Eksplorasi Modul E-Commerce dan Penjelasan Singkat Modul Lainnya

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Simplify Complexity

Simplify Complexity

Golang, Distributed Systems, File Systems, Python, C/C++, Linux

More from Medium

[Golang] How To Use Message Broker In Golang

Fuzz Testing in Go

Simple IoT Messages Delivery With GoLang — 2

Let’s GO! Part 11: Reference Types 3: Maps