examples/restarts: avoid using global variables
This PR introduces the following changes:
- Avoid using global variables. Even for examples. Especially when it makes the code shorter.
- Move
done()invocation after the print statement. Because of the async nature of Go, it happens that sometimes "I restarted and processed ..." message was printed, and sometimes it wasn't. Now it is always printed.
In general, I feel like global variables in hollywood tests are OK. global variables reduce testability, but in the tests themselves they're not at all harmfull.
Hollywood has a test style that is very terse and to the point, something I've learned to appreciate.
This is still a valuable PR, but I wouldn't spend time hunting for global variable use in the tests. :-)
In general, I feel like global variables in hollywood tests are OK. global variables reduce testability, but in the tests themselves they're not at all harmfull.
Hollywood has a test style that is very terse and to the point, something I've learned to appreciate.
This is still a valuable PR, but I wouldn't spend time hunting for global variable use in the tests. :-)
I have an allergy for global variables. In 99% case they could be replaced with something else, which is localized. Even for tests. And this PR is one of these cases.