On Thursday 15 February 2024 at 00:08:44 UTC Jerry Londergaard wrote:

If code is outside of the main function but still in the main package, it 
seems its testable like other functions?


Yes indeed.
 

I suspect though if one is putting tests in package main_test, then I guess 
you can't import the main package to test it :(


Works fine as far as I can see:
https://go.dev/play/p/7UtYP2j8hg6

(Tests don't run in the playground, unless you explicitly invoke a runner, 
but you can run this locally to demonstrate)

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1266c8e9-6e25-4347-87a3-eab6356a3cc5n%40googlegroups.com.

Reply via email to