
Никакого рокетсайнс, все просто, но вот одна вещь особенно порадовала:
Using a map literal syntax we define our test cases not as a slice of structs, but as map of test names to test fixtures.
Map iteration order is undefined 1 This means each time we run go test, our tests are going to be potentially run in a different order.
This is super useful for spotting conditions where test pass when run in statement order, but not otherwise. If you find that happens you probably have some global state that is being mutated by one test with subsequent tests depending on that modification.
Я как раз про это говорил на GoGoConf 2018 и довольно долго защищал эту идею от пары людей из гугла, что она нужна и полезна. +1 аргумент в мою пользу. збс.
https://dave.cheney.net/2019/05/07/prefer-table-driven-tests