User talk:Dchapes

From Rosetta Code

Go Sum digits task

[This is in relation to Sum digits of an integer, id=188562. —dchapes]

I don't know what was going on with the non-working tests. Good catch there. Also I don't know why I thought it was worth the complexity to share a function with Digital root. This seems beyond the scope of either task. I'd be in favor of converting Sum digits to a main program like most of the other Go solutions. —Sonia (talk) 03:17, 3 September 2014 (UTC)

Sounds good. I might do that soon-ish but it's not a high priority for me. Of course, feel free to make such changes yourself (and take the opportunity to clean up or simplify my stuff) if you're so inclined.
It's quite possible the old test may have worked pre-Go 1.0. The only actual breakage was that the test function was testSum rather than TestSum and was not found or run by current go test invocations. Although I also chose to also change it from using package digit_test black box test style (which other than for Example* "tests" I'm not a fan of), that wasn't an actual problem.
It's kind of sad that the way sites like RosettaCode are done make it hard to do the "right thing" for languages like Go (multiple files, with extra test code files and separate main "demo programs", proper revision control, etc). Among other things it doesn't let us show off one of the great aspects of Go (IMO) which is the testing and build infrastructure.
Actually, on that note, does it makes any sense (and is there a reasonably nice way on RosettaCode) to provide extra non-example test files? Something that doesn't show up directly on the example page (it would be clutter and take away from the purpose of simplified examples IMO). E.g. for some of the examples I've submitted I have an associated non-trivial *_test.go file and if someone else wanted to cleanup/change/add-to the example later it might be convenient for them if they had that too. —dchapes (talk | contribs) 15:15, 3 September 2014 (UTC)