@@ -29,15 +29,15 @@ pub struct Config {
29
29
}
30
30
31
31
/// Configuration for RFC 4648 standard base64 encoding
32
- pub static standard : Config =
32
+ pub static STANDARD : Config =
33
33
Config { char_set : Standard , pad : true , line_length : None } ;
34
34
35
35
/// Configuration for RFC 4648 base64url encoding
36
- pub static url_safe : Config =
36
+ pub static URL_SAFE : Config =
37
37
Config { char_set : UrlSafe , pad : false , line_length : None } ;
38
38
39
39
/// Configuration for RFC 2045 MIME base64 encoding
40
- pub static mime : Config =
40
+ pub static MIME : Config =
41
41
Config { char_set : Standard , pad : true , line_length : Some ( 76 ) } ;
42
42
43
43
static STANDARD_CHARS : [ char , ..64 ] = [
@@ -286,33 +286,33 @@ impl<'self> FromBase64 for &'self str {
286
286
287
287
#[ test]
288
288
fn test_to_base64_basic ( ) {
289
- assert_eq ! ( "" . to_base64( standard ) , ~"") ;
290
- assert_eq ! ( "f" . to_base64( standard ) , ~"Zg ==");
291
- assert_eq!(" fo".to_base64(standard ), ~" Zm8 =");
292
- assert_eq!(" foo".to_base64(standard ), ~" Zm9v ");
293
- assert_eq!(" foob".to_base64(standard ), ~" Zm9vYg ==");
294
- assert_eq!(" fooba".to_base64(standard ), ~" Zm9vYmE =");
295
- assert_eq!(" foobar".to_base64(standard ), ~" Zm9vYmFy ");
289
+ assert_eq ! ( "" . to_base64( STANDARD ) , ~"") ;
290
+ assert_eq ! ( "f" . to_base64( STANDARD ) , ~"Zg ==");
291
+ assert_eq!(" fo".to_base64(STANDARD ), ~" Zm8 =");
292
+ assert_eq!(" foo".to_base64(STANDARD ), ~" Zm9v ");
293
+ assert_eq!(" foob".to_base64(STANDARD ), ~" Zm9vYg ==");
294
+ assert_eq!(" fooba".to_base64(STANDARD ), ~" Zm9vYmE =");
295
+ assert_eq!(" foobar".to_base64(STANDARD ), ~" Zm9vYmFy ");
296
296
}
297
297
298
298
#[test]
299
299
fn test_to_base64_line_break() {
300
- assert!(![0u8, 1000].to_base64(Config {line_length: None, ..standard })
300
+ assert!(![0u8, 1000].to_base64(Config {line_length: None, ..STANDARD })
301
301
.contains("\r \n " ) ) ;
302
- assert_eq ! ( "foobar" . to_base64( Config { line_length: Some ( 4 ) , ..standard } ) ,
302
+ assert_eq ! ( "foobar" . to_base64( Config { line_length: Some ( 4 ) , ..STANDARD } ) ,
303
303
~"Zm9v \r \n YmFy ");
304
304
}
305
305
306
306
#[test]
307
307
fn test_to_base64_padding() {
308
- assert_eq!(" f".to_base64(Config {pad: false, ..standard }), ~" Zg ");
309
- assert_eq!(" fo".to_base64(Config {pad: false, ..standard }), ~" Zm8 ");
308
+ assert_eq!(" f".to_base64(Config {pad: false, ..STANDARD }), ~" Zg ");
309
+ assert_eq!(" fo".to_base64(Config {pad: false, ..STANDARD }), ~" Zm8 ");
310
310
}
311
311
312
312
#[test]
313
313
fn test_to_base64_url_safe() {
314
- assert_eq!([251, 255].to_base64(url_safe ), ~" -_8");
315
- assert_eq!([251, 255].to_base64(standard ), ~" +/8 =");
314
+ assert_eq!([251, 255].to_base64(URL_SAFE ), ~" -_8");
315
+ assert_eq!([251, 255].to_base64(STANDARD ), ~" +/8 =");
316
316
}
317
317
318
318
#[test]
@@ -359,6 +359,6 @@ fn test_base64_random() {
359
359
push( random( ) ) ;
360
360
}
361
361
} ;
362
- assert_eq ! ( v. to_base64( standard ) . from_base64( ) . get( ) , v) ;
362
+ assert_eq ! ( v. to_base64( STANDARD ) . from_base64( ) . get( ) , v) ;
363
363
}
364
364
}
0 commit comments