Hello,

Apologies if this has already been discussed.

I have a go tool (chidley - https://github.com/gnewton/chidley) that 
converts xml to Go struct code by examining a sample file (perhaps very 
large) of the XML (It can also generate Java JAXB code...).
Production examples of generated structs:

   - https://github.com/gnewton/pubmedstruct/blob/master/pubmed.go
   - https://github.com/gnewton/struct2dot
   - https://github.com/gnewton/gomesh2016/blob/master/desc2016.go
   

[BTW, it was the first Go thing I made so it is a little...peculiar. Not 
idiomatic and not well aligned with Go interfaces, concurrency, etc.]

My question is about testing: this application generates Go code. I would 
like to have a test that is successful if the generated Go code compiles. 
As I am using a template for the generated code, and the Go code in the 
template compiles correctly, the only place where compilation would fail 
would be if the Go structs generated by chidley were not correct. It should 
never generate structs that do not compile and I want to test for this. I 
have a set of complicated/problematic XML that I would like to walk through 
via testing to make sure my changes to the application do not cause 
regression issues. 

I could do this just by invoking the Go compiler using os.exec and checking 
the return code. But I was wondering if there were better ways of doing 
this that was 'inside' of the testing framework or some other way besides 
going to the host os.

Thanks,
Glen

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to