@@ -255,25 +255,23 @@ mod tests {
255
255
fn test_simple ( ) {
256
256
let qs = QueryString :: new ( )
257
257
. with_value ( "q" , "apple???" )
258
- . with_value ( "category" , "fruits and vegetables" ) ;
258
+ . with_value ( "category" , "fruits and vegetables" )
259
+ . with_value ( "tasty" , true )
260
+ . with_value ( "weight" , 99.9 ) ;
259
261
assert_eq ! (
260
262
qs. to_string( ) ,
261
- "?q=apple???&category=fruits%20and%20vegetables"
263
+ "?q=apple???&category=fruits%20and%20vegetables&tasty=true&weight=99.9 "
262
264
) ;
263
- assert_eq ! ( qs. len( ) , 2 ) ;
265
+ assert_eq ! ( qs. len( ) , 4 ) ;
264
266
assert ! ( !qs. is_empty( ) ) ;
265
267
}
266
268
267
269
#[ test]
268
270
fn test_encoding ( ) {
269
271
let qs = QueryString :: new ( )
270
272
. with_value ( "q" , "Grünkohl" )
271
- . with_value ( "category" , "Gemüse" )
272
- . with_value ( "answer" , 42 ) ;
273
- assert_eq ! (
274
- qs. to_string( ) ,
275
- "?q=Gr%C3%BCnkohl&category=Gem%C3%BCse&answer=42"
276
- ) ;
273
+ . with_value ( "category" , "Gemüse" ) ;
274
+ assert_eq ! ( qs. to_string( ) , "?q=Gr%C3%BCnkohl&category=Gem%C3%BCse" ) ;
277
275
}
278
276
279
277
#[ test]
@@ -292,12 +290,14 @@ mod tests {
292
290
let qs = QueryString :: new ( )
293
291
. with_value ( "q" , "celery" )
294
292
. with_opt_value ( "taste" , None :: < String > )
295
- . with_opt_value ( "category" , Some ( "fruits and vegetables" ) ) ;
293
+ . with_opt_value ( "category" , Some ( "fruits and vegetables" ) )
294
+ . with_opt_value ( "tasty" , Some ( true ) )
295
+ . with_opt_value ( "weight" , Some ( 99.9 ) ) ;
296
296
assert_eq ! (
297
297
qs. to_string( ) ,
298
- "?q=celery&category=fruits%20and%20vegetables"
298
+ "?q=celery&category=fruits%20and%20vegetables&tasty=true&weight=99.9 "
299
299
) ;
300
- assert_eq ! ( qs. len( ) , 2 ) ; // not three !
300
+ assert_eq ! ( qs. len( ) , 4 ) ; // not five !
301
301
}
302
302
303
303
#[ test]
0 commit comments