codecgen_test.go 423 B

1234567891011121314151617181920212223
  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. const callCodecgenDirect bool = true
  10. v := newTestStruc(2, false, !testSkipIntf, false)
  11. var bs []byte
  12. e := NewEncoderBytes(&bs, testJsonH)
  13. if callCodecgenDirect {
  14. v.CodecEncodeSelf(e)
  15. e.w.atEndOfEncode()
  16. } else {
  17. e.MustEncode(v)
  18. }
  19. fmt.Printf("%s\n", bs)
  20. }