Smarty
Testing in Go by Example: Part 6Even more about assertions.
Michael Whatcott
Michael Whatcott
 • 
September 25, 2017
Tags

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 iconSubscribe Now
Read our recent posts
Smarty & Uber Partner on Address Intelligence for Global Services
Arrow Icon
May 7, 2024 - PROVO, UTAH - Smarty, a preeminent provider of address data solutions, announced today its service partnership with Uber Technologies, Inc. (NYSE: UBER), providing accurate, real-time address data for the ride-sharing leader. Smarty's comprehensive address intelligence services will bolster Uber’s extensive address data capabilities across its global operations, encompassing ride-sharing, meal delivery and local courier services. Jonathan Oliver, CEO of Smarty, said, "It’s evident Uber has the highest commitment to delivering delightful customer experiences and operational excellence.
Star Wars Day
Arrow Icon
One of the most popular and successful movie franchises—by far—is George Lucas' Star Wars. The impact Star Wars has had on the culture of the United States and the rest of the world is incredible. From 1977 on, Hollywood has been producing large, fantastical blockbusters packed with practical and computer-generated special effects. Movies have started being considered based wholly on the merchandise they could sell. Toy laser swords have been selling like hotcakes, and every child finds themselves secretly trying to turn off the light from their bed using the Force.
Dealing with Address Data from Multiple Countries
Arrow Icon
In our recent webinar, we hosted Jeffrey Duncan, our Technical Product Manager, who discussed the complexities and nuances of managing address data across various international formats. While seemingly straightforward, addresses are quite complex, especially when dealing with international data. Jeffrey highlighted the variability in address formats, which can range from the number of address lines to the order of address components, differing significantly from one country to another. For instance, while a US address typically follows a structured format, addresses in countries like Germany or India can have a completely different setup, impacting data entry and management.
Ready to get started?