GLOSSARY ENTRY (DERIVED FROM QUESTION BELOW) | ||||||
---|---|---|---|---|---|---|
|
12:50 Dec 31, 2022 |
English to Russian translations [PRO] Tech/Engineering - Computers: Software / Google Go | |||||||
---|---|---|---|---|---|---|---|
|
| ||||||
| Selected response from: Mikhail Zavidin Local time: 03:24 | ||||||
Grading comment
|
Summary of answers provided | ||||
---|---|---|---|---|
3 +1 | вспомогательные функции настройки тестов/проверок |
|
вспомогательные функции настройки тестов/проверок Explanation: First a quick review of the mechanics. When we run go test the go tool generates a main program that runs the test functions for our package. If the go tool finds a TestMain function it instead generates code to call TestMain. A typical TestMain follows. func TestMain(m *testing.M) { setup() code := m.Run() shutdown() os.Exit(code) } From the above code we can see that writing a TestMain function allows us to control four aspects of test execution. Setup. How and when to run the tests. Shutdown. Exit behavior. With appropriate use of these four items, we can satisfy several different use cases that were not well served prior to Go 1.4. http://cs-guy.com/blog/2015/01/test-main/ -------------------------------------------------- Note added at 46 mins (2022-12-31 13:36:46 GMT) -------------------------------------------------- Note that I provide argument tb to the setup and teardown functions, in case if we need something from the testing library. So you can leave the function alone without any argument if you want to. Now, if you run the test by running command go test -v, you’ll have something similar with this result printed on your terminal. https://medium.com/nerd-for-tech/setup-and-teardown-unit-tes... |
| |
Grading comment
| ||
Login to enter a peer comment (or grade) |
Login or register (free and only takes a few minutes) to participate in this question.
You will also have access to many other tools and opportunities designed for those who have language-related jobs (or are passionate about them). Participation is free and the site has a strict confidentiality policy.