tape: Fix usage of Encoder/Decoder in dynamic tests
This commit is contained in:
		
							parent
							
								
									81ac10508b
								
							
						
					
					
						commit
						8f8cd91b5d
					
				@ -71,9 +71,7 @@ func encAny(value any) ([]byte, Tag, int, error) {
 | 
			
		||||
	tag, err := TagAny(value)
 | 
			
		||||
	if err != nil { return nil, 0, 0, err }
 | 
			
		||||
	buffer := bytes.Buffer { }
 | 
			
		||||
	n, err := EncodeAny(&Encoder {
 | 
			
		||||
		Writer: &buffer,
 | 
			
		||||
	}, value, tag)
 | 
			
		||||
	n, err := EncodeAny(NewEncoder(&buffer), value, tag)
 | 
			
		||||
	if err != nil { return nil, 0, n, err }
 | 
			
		||||
	return buffer.Bytes(), tag, n, nil
 | 
			
		||||
}
 | 
			
		||||
@ -82,9 +80,7 @@ func decAny(data []byte) (Tag, any, int, error) {
 | 
			
		||||
	destination := map[uint16] any { }
 | 
			
		||||
	tag, err := TagAny(destination)
 | 
			
		||||
	if err != nil { return 0, nil, 0, err }
 | 
			
		||||
	n, err := DecodeAny(&Decoder {
 | 
			
		||||
		Reader: bytes.NewBuffer(data),
 | 
			
		||||
	}, &destination, tag)
 | 
			
		||||
	n, err := DecodeAny(NewDecoder(bytes.NewBuffer(data)), &destination, tag)
 | 
			
		||||
	if err != nil { return 0, nil, n, err }
 | 
			
		||||
	return tag, destination, n, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user