Testing the Basic Word Counter
Understand how to write and execute automated tests in Go to verify the accuracy of a basic word counter. This lesson demonstrates creating a test file, using Go's built-in testing tools, and validating your command-line application's output to ensure reliability.
We'll cover the following...
We'll cover the following...
Using Go lets us test our code automatically, without requiring external tools or frameworks. We’ll learn more about how to test our command-line applications throughout the course. Right now, let’s write a basic test for the word counter to ensure that it correctly counts the words in the given input.
Creating a test file
Let’s create a file called main_test.go in the same directory as ...