@@ -113,60 +113,62 @@ func TestAttributes(t *testing.T) {
113113 t .Run (tt .name , func (t * testing.T ) {
114114 attr .Flags = tt .flags
115115
116- buf := new (Buffer )
117- attr .MarshalInto (buf )
116+ buf , err := attr .MarshalBinary ()
117+ if err != nil {
118+ t .Fatal ("unexpected error:" , err )
119+ }
118120
119- if got , want := buf . Bytes (), tt . encoded ; ! bytes .Equal (got , want ) {
120- t .Fatalf ("MarshalInto () = %X, but wanted %X" , got , want )
121+ if ! bytes .Equal (buf , tt . encoded ) {
122+ t .Fatalf ("MarshalBinary () = %X, but wanted %X" , buf , tt . encoded )
121123 }
122124
123125 attr = Attributes {}
124126
125- if err := attr .UnmarshalFrom (buf ); err != nil {
127+ if err := attr .UnmarshalBinary (buf ); err != nil {
126128 t .Fatal ("unexpected error:" , err )
127129 }
128130
129131 if attr .Flags != tt .flags {
130- t .Errorf ("UnmarshalFrom (): Flags was %x, but wanted %x" , attr .Flags , tt .flags )
132+ t .Errorf ("UnmarshalBinary (): Flags was %x, but wanted %x" , attr .Flags , tt .flags )
131133 }
132134
133135 if attr .Flags & AttrSize != 0 && attr .Size != size {
134- t .Errorf ("UnmarshalFrom (): Size was %x, but wanted %x" , attr .Size , size )
136+ t .Errorf ("UnmarshalBinary (): Size was %x, but wanted %x" , attr .Size , size )
135137 }
136138
137139 if attr .Flags & AttrUIDGID != 0 {
138140 if attr .UID != uid {
139- t .Errorf ("UnmarshalFrom (): UID was %x, but wanted %x" , attr .UID , uid )
141+ t .Errorf ("UnmarshalBinary (): UID was %x, but wanted %x" , attr .UID , uid )
140142 }
141143
142144 if attr .GID != gid {
143- t .Errorf ("UnmarshalFrom (): GID was %x, but wanted %x" , attr .GID , gid )
145+ t .Errorf ("UnmarshalBinary (): GID was %x, but wanted %x" , attr .GID , gid )
144146 }
145147 }
146148
147149 if attr .Flags & AttrPermissions != 0 && attr .Permissions != perms {
148- t .Errorf ("UnmarshalFrom (): Permissions was %#v, but wanted %#v" , attr .Permissions , perms )
150+ t .Errorf ("UnmarshalBinary (): Permissions was %#v, but wanted %#v" , attr .Permissions , perms )
149151 }
150152
151153 if attr .Flags & AttrACModTime != 0 {
152154 if attr .ATime != atime {
153- t .Errorf ("UnmarshalFrom (): ATime was %x, but wanted %x" , attr .ATime , atime )
155+ t .Errorf ("UnmarshalBinary (): ATime was %x, but wanted %x" , attr .ATime , atime )
154156 }
155157
156158 if attr .MTime != mtime {
157- t .Errorf ("UnmarshalFrom (): MTime was %x, but wanted %x" , attr .MTime , mtime )
159+ t .Errorf ("UnmarshalBinary (): MTime was %x, but wanted %x" , attr .MTime , mtime )
158160 }
159161 }
160162
161163 if attr .Flags & AttrExtended != 0 {
162164 extAttrs := attr .ExtendedAttributes
163165
164166 if count := len (extAttrs ); count != 1 {
165- t .Fatalf ("UnmarshalFrom (): len(ExtendedAttributes) was %d, but wanted %d" , count , 1 )
167+ t .Fatalf ("UnmarshalBinary (): len(ExtendedAttributes) was %d, but wanted %d" , count , 1 )
166168 }
167169
168170 if got := extAttrs [0 ]; got != extAttr {
169- t .Errorf ("UnmarshalFrom (): ExtendedAttributes[0] was %#v, but wanted %#v" , got , extAttr )
171+ t .Errorf ("UnmarshalBinary (): ExtendedAttributes[0] was %#v, but wanted %#v" , got , extAttr )
170172 }
171173 }
172174 })
@@ -189,8 +191,10 @@ func TestNameEntry(t *testing.T) {
189191 },
190192 }
191193
192- buf := new (Buffer )
193- e .MarshalInto (buf )
194+ buf , err := e .MarshalBinary ()
195+ if err != nil {
196+ t .Fatal ("unexpected error:" , err )
197+ }
194198
195199 want := []byte {
196200 0x00 , 0x00 , 0x00 , 0x03 , 'f' , 'o' , 'o' ,
@@ -199,13 +203,13 @@ func TestNameEntry(t *testing.T) {
199203 0x87 , 0x65 , 0x43 , 0x21 ,
200204 }
201205
202- if got := buf . Bytes (); ! bytes .Equal (got , want ) {
203- t .Fatalf ("MarshalInto () = %X, but wanted %X" , got , want )
206+ if ! bytes .Equal (buf , want ) {
207+ t .Fatalf ("MarshalBinary () = %X, but wanted %X" , buf , want )
204208 }
205209
206210 * e = NameEntry {}
207211
208- if err := e .UnmarshalFrom (buf ); err != nil {
212+ if err := e .UnmarshalBinary (buf ); err != nil {
209213 t .Fatal ("unexpected error:" , err )
210214 }
211215
0 commit comments