github.com/trim21/go-phpserialize@v0.0.22-0.20240301204449-2fca0319b3f0/internal/test/base.go (about)

     1  package test
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  type Case struct {
     8  	Name     string
     9  	Data     interface{}
    10  	Expected string `php:"-" json:"-"`
    11  }
    12  
    13  func (tc Case) WrappedExpected() string {
    14  	return fmt.Sprintf(`a:2:{s:4:"Name";s:%d:"%s";s:4:"Data";`, len(tc.Name), tc.Name) + tc.Expected + "}"
    15  }
    16  
    17  type User struct {
    18  	ID   uint64 `php:"id" json:"id"`
    19  	Name string `php:"name" json:"name"`
    20  }