4 ms·
Skimming this quickly I was surprised that constants Spanish and French were accessible in the test files. Is this a test only scope thing or just how go works?
by mattnewton 9y ago
Skimming this quickly I was surprised that constants Spanish and French were accessible in the test files. Is this a test only scope thing or just how go works?
Edit: it’s how to works, specifically with packages. Found this:
https://medium.com/golangspec/scopes-in-go-a6042bb4298c https://medium.com/golangspec/scopes-in-go-a6042bb4298c
- erdaniels 9y agoYep. As long as you have a package that is the same name in the same directory, you'll have access to all the same identifiers in the package. This is good for white box testing. In the other direction, you could have used package_test to test from a black box perspective where you must import the package and use its exported identifiers.