github.com/abemedia/appcast@v0.4.0/integrations/apt/deb/utils_test.go (about)

     1  package deb_test
     2  
     3  import "time"
     4  
     5  type stringer struct {
     6  	S string
     7  }
     8  
     9  func (s stringer) String() string {
    10  	return s.S
    11  }
    12  
    13  type marshaler struct {
    14  	S string
    15  }
    16  
    17  func (s *marshaler) MarshalText() ([]byte, error) {
    18  	return []byte(s.S), nil
    19  }
    20  
    21  func (s *marshaler) UnmarshalText(text []byte) error {
    22  	s.S = string(text)
    23  	return nil
    24  }
    25  
    26  type errMarshaler struct {
    27  	E error
    28  }
    29  
    30  func (s errMarshaler) MarshalText() ([]byte, error) {
    31  	return nil, s.E
    32  }
    33  
    34  func (s *errMarshaler) UnmarshalText([]byte) error {
    35  	return s.E
    36  }
    37  
    38  type record struct {
    39  	String    string
    40  	Hex       [4]byte
    41  	Int       int
    42  	Int8      int8
    43  	Int16     int16
    44  	Int32     int32
    45  	Int64     int64
    46  	Uint      uint
    47  	Uint8     uint8
    48  	Uint16    uint16
    49  	Uint32    uint32
    50  	Uint64    uint64
    51  	Float32   float32
    52  	Float64   float64
    53  	Stringer  stringer
    54  	Marshaler *marshaler
    55  	Date      time.Time
    56  }