Pinpoint: A virtual user conference Register today
Smarty

Testing in Go by Example: Part 6

Smarty header pin graphic
Michael Whatcott
Michael Whatcott
 | 
September 25, 2017
Tags
Smarty header pin graphic

For this installment of the Testing in Go series we'll be talking about a grouping of packages that facilitate general-purpose comparisons in various contexts. Since the most common context is testing it seemed like this series was the right place for the discussion.

We generally refer to these comparison functions as assertions (cue ominous background music and spooky sound effects). You may have already read the opinions found on the Golang FAQ related to assertions.

"Why does Go not have assertions?"

Go doesn't provide assertions. They are undeniably convenient, but our experience has been that programmers use them as a crutch to avoid thinking about proper error handling and reporting. Proper error handling means that servers continue operation after non-fatal errors instead of crashing...

"Where is my favorite helper function for testing?"

Go's standard testing package makes it easy to write unit tests, but it lacks features provided in other language's testing frameworks such as assertion functions. An earlier section of this document explained why Go doesn't have assertions, and the same arguments apply to the use of assert in tests.

In general, we agree that in many scenarios, a single assertion failure shouldn't prevent a test from running. So, by default, the assertion functions we use don't do that. Problem solved.

Subscribe to our blog!
Learn more about RSS feeds here.
rss feed icon
Subscribe Now
Read our recent posts
Tariffs are high. Your address accuracy should be higher.
Arrow Icon
Tariffs are spiking. Shipping costs are climbing. Margins are shrinking. You can’t control global trade policy, but you can control how efficient and accurate your operations are in response. Most ecommerce teams, logistics planners, and data managers miss one of their best cost-saving opportunities: addressing accuracy. Bad address data isn’t hidden. It sits in your systems, shows up in carrier returns, and quietly drains profits every day. When tariffs rise to 15 to 50 percent in some product categories and import volumes are falling, every shipment becomes more expensive, every delay costs more, and every lost customer hurts more.
Pinpoint: The Smarty virtual user conference, because the world is better validated
Arrow Icon
November 2025 | 100% online | 100% awesomeJoin us this November for the Smarty Virtual User Conference, a two-day event packed with insights, tools, laughs, and $1000 worth of prizes. This event is for you, whether you’re optimizing delivery accuracy, improving compliance, or just trying to figure out if your neighbor really has a breakfast nook. What to expect:2 days, 12 hours of content, zero fluffLive sessions from address data prosHands-on demos of Smarty’s latest tools and pluginsGiveaways galore, like gift cards, swag, and even a chance at a massive LEGO setHidden Easter eggs throughout the event (no, seriously—find them and win)An after-party with games (shoutout to Brady Amundson)Tailored tracks for every roleFor developers:Roll up your sleeves.
Welcome to the Address Zoo #1 | Override & underride city addresses
Arrow Icon
The benefits of reliable, easy-to-implement address data are straightforward. Actual addresses, on the other hand, aren’t always so cut and dry. If you’re looking to become an expert in everything that begins or ends with an address, this series is for you. We’ll demystify the types of addresses that have developers scratching their heads and introduce you to the tools keeping your address data best-in-class. Come one, come all, and enter the wonderful world of peculiar addresses! Let’s see what’s on exhibit.

Ready to get started?