1- use crate :: myc;
21use crate :: myc:: constants:: { ColumnFlags , ColumnType } ;
32use crate :: myc:: io:: WriteMysqlExt ;
43use crate :: Column ;
@@ -663,22 +662,34 @@ mod tests {
663662 use super :: ToMysqlValue ;
664663 use crate :: myc:: value;
665664 use crate :: myc:: value:: convert:: from_value;
665+ use crate :: myc:: value:: Value ;
666666 use crate :: { Column , ColumnFlags , ColumnType } ;
667667 use chrono:: { self , TimeZone } ;
668668 use std:: time;
669669
670670 mod roundtrip_text {
671671 use super :: * ;
672672
673+ use myc:: {
674+ io:: ParseBuf ,
675+ proto:: MyDeserialize ,
676+ value:: { convert:: FromValue , TextValue , ValueDeserializer } ,
677+ } ;
678+
673679 macro_rules! rt {
674680 ( $name: ident, $t: ty, $v: expr) => {
675681 #[ test]
676682 fn $name( ) {
677683 let mut data = Vec :: new( ) ;
678684 let v: $t = $v;
679685 v. to_mysql_text( & mut data) . unwrap( ) ;
686+ let mut pb = ParseBuf ( & mut data[ ..] ) ;
680687 assert_eq!(
681- from_value:: <$t>( value:: read_text_value( & mut & data[ ..] ) . unwrap( ) ) ,
688+ <$t>:: from_value(
689+ ValueDeserializer :: <TextValue >:: deserialize( ( ) , & mut pb)
690+ . unwrap( )
691+ . 0 ,
692+ ) ,
682693 v
683694 ) ;
684695 }
@@ -728,6 +739,12 @@ mod tests {
728739 mod roundtrip_bin {
729740 use super :: * ;
730741
742+ use myc:: {
743+ io:: ParseBuf ,
744+ proto:: MyDeserialize ,
745+ value:: { convert:: FromValue , BinValue , ValueDeserializer } ,
746+ } ;
747+
731748 macro_rules! rt {
732749 ( $name: ident, $t: ty, $v: expr, $ct: expr) => {
733750 rt!( $name, $t, $v, $ct, false ) ;
@@ -749,9 +766,22 @@ mod tests {
749766
750767 let v: $t = $v;
751768 v. to_mysql_bin( & mut data, & col) . unwrap( ) ;
769+ let mut pb = ParseBuf ( & mut data[ ..] ) ;
752770 assert_eq!(
753- from_value:: <$t>(
754- value:: read_bin_value( & mut & data[ ..] , $ct, !$sig) . unwrap( )
771+ <$t>:: from_value(
772+ ValueDeserializer :: <BinValue >:: deserialize(
773+ (
774+ $ct,
775+ if $sig {
776+ ColumnFlags :: empty( )
777+ } else {
778+ ColumnFlags :: UNSIGNED_FLAG
779+ }
780+ ) ,
781+ & mut pb
782+ )
783+ . unwrap( )
784+ . 0 ,
755785 ) ,
756786 v
757787 ) ;
0 commit comments