encoding/dot: ensure that generated DOT is syntactically valid
Created by: kortschak
Please take a look.
I would like to add the same check to the graphql tests, but they currently fail and will do so until the quoting PR is merged. So I'll leave until after that (or you can add it in there - unfortunately we need to just copy/paste this check function).