codecgen_test.go 497 B

123456789101112131415161718192021222324
  1. // +build x,codecgen
  2. package codec
  3. import (
  4. "fmt"
  5. "testing"
  6. )
  7. func _TestCodecgenJson1(t *testing.T) {
  8. // This is just a simplistic test for codecgen.
  9. // It is typically disabled. We only enable it for debugging purposes.
  10. const callCodecgenDirect bool = true
  11. v := newTestStruc(2, false, !testSkipIntf, false)
  12. var bs []byte
  13. e := NewEncoderBytes(&bs, testJsonH)
  14. if callCodecgenDirect {
  15. v.CodecEncodeSelf(e)
  16. e.w.atEndOfEncode()
  17. } else {
  18. e.MustEncode(v)
  19. }
  20. fmt.Printf("%s\n", bs)
  21. }