@@ -44,7 +44,7 @@ impl LineProtoTerm<'_> {
44
44
Float ( v) => v. to_string ( ) ,
45
45
SignedInteger ( v) => format ! ( "{}i" , v) ,
46
46
UnsignedInteger ( v) => format ! ( "{}i" , v) ,
47
- Text ( v) => format ! ( r#""{}""# , Self :: escape_any( v, & * SLASHES ) ) ,
47
+ Text ( v) => format ! ( r#""{}""# , Self :: escape_any( v, & * QUOTES_SLASHES ) ) ,
48
48
}
49
49
}
50
50
@@ -59,9 +59,9 @@ impl LineProtoTerm<'_> {
59
59
}
60
60
}
61
61
. to_string ( ) ,
62
- Float ( v) => format ! ( r#"" {}"" # , v. to_string ( ) ) ,
63
- SignedInteger ( v) => format ! ( r#""{}" "# , v) ,
64
- UnsignedInteger ( v) => format ! ( r#""{}" "# , v) ,
62
+ Float ( v) => format ! ( r#"{}"# , v) ,
63
+ SignedInteger ( v) => format ! ( r#"{} "# , v) ,
64
+ UnsignedInteger ( v) => format ! ( r#"{} "# , v) ,
65
65
Text ( v) => Self :: escape_any ( v, & * SLASHES ) ,
66
66
}
67
67
}
@@ -78,6 +78,11 @@ mod test {
78
78
79
79
#[ test]
80
80
fn test ( ) {
81
+ assert_eq ! ( TagValue ( & Type :: Boolean ( true ) ) . escape( ) , r#"true"# ) ;
82
+ assert_eq ! ( TagValue ( & Type :: Float ( 1.8324f64 ) ) . escape( ) , r#"1.8324"# ) ;
83
+ assert_eq ! ( TagValue ( & Type :: SignedInteger ( -1i64 ) ) . escape( ) , r#"-1"# ) ;
84
+ assert_eq ! ( TagValue ( & Type :: UnsignedInteger ( 1u64 ) ) . escape( ) , r#"1"# ) ;
85
+
81
86
assert_eq ! (
82
87
TagValue ( & Type :: Text ( "this is my special string" . into( ) ) ) . escape( ) ,
83
88
r#"this\ is\ my\ special\ string"#
@@ -112,7 +117,7 @@ mod test {
112
117
assert_eq ! ( FieldValue ( & Type :: Text ( "\" " . into( ) ) ) . escape( ) , r#""\"""# ) ;
113
118
assert_eq ! (
114
119
FieldValue ( & Type :: Text ( r#"locat"\ ,=ion"# . into( ) ) ) . escape( ) ,
115
- r#""locat\"\\\ \,\ =ion""#
120
+ r#""locat\"\\ , =ion""#
116
121
) ;
117
122
}
118
123
0 commit comments