- Write the test first -> Try and run the test -> Write the minimal amount of code for the test to run and check the failing test output -> Write enough code to make it pass -> Refactor
- We must not neglect our test code in the refactoring stage
- It is important to question the value of your tests. It should not be a goal to have as many tests as possible, but rather to have as much confidence as possible in your code base. Having too many tests can turn in to a real problem and it just adds more overhead in maintenance. Every test has a cost.
- reflect.DeepEqual - useful for seeing if any two variables are the same. Caveat: It is not type safe. Compiles even if silly comparisons like array == string is done. https://golang.org/pkg/reflect/#DeepEqual
Last active
January 10, 2024 18:35
-
-
Save meerasndr/4a658390d4eada24c80330beadbad988 to your computer and use it in GitHub Desktop.
Notes from Go with Tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment