Hacker News new | ask | show | jobs
by pokstad 3127 days ago
No, tests are commonly in the same package as the implementation.

I did find this one: https://github.com/tenta-browser/tenta-dns/blob/master/src/t...

That's an internal test, meaning it has access to the package internals. A better test would test from outside the boundaries of the package to only interact with exposed symbols.

1 comments

Oh lordy, that log.SetLogLevel() has effects outside the test code.
Setting the log level has effects, but only on an internal wrapper package that neatly zips up the nitty gritty of setting up the logger.
Package-level loggers are an antipattern :(