Created
January 4, 2014 12:11
-
-
Save zokier/8254831 to your computer and use it in GitHub Desktop.
extra::base64 decode failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern mod extra; | |
use extra::base64::FromBase64; | |
#[test] | |
fn test_b64_1() { | |
let test_data = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n"; | |
match test_data.from_base64() { | |
Ok(s) => s, | |
Err(msg) => fail!(format!("Failed to read b64: {:s}", msg.escape_default())) | |
}; | |
} | |
#[test] | |
fn test_b64_2() { | |
let test_data = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; | |
match test_data.from_base64() { | |
Ok(s) => s, | |
Err(msg) => fail!(format!("Failed to read b64: {:s}", msg.escape_default())) | |
}; | |
} | |
#[test] | |
fn test_b64_3() { | |
let test_data = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"; | |
match test_data.from_base64() { | |
Ok(s) => s, | |
Err(msg) => fail!(format!("Failed to read b64: {:s}", msg.escape_default())) | |
}; | |
} | |
#[test] | |
fn test_b64_4() { | |
let test_data = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; | |
match test_data.from_base64() { | |
Ok(s) => s, | |
Err(msg) => fail!(format!("Failed to read b64: {:s}", msg.escape_default())) | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1]$ rustc --test b64_test.rs | |
[1]$ ./b64_test | |
running 4 tests | |
task 'test_b64_1' failed at 'Failed to read b64: Invalid character \'\n\' at position 36', b64_test.rs:9 | |
test test_b64_2 ... ok | |
test test_b64_1 ... FAILED | |
test test_b64_3 ... ok | |
test test_b64_4 ... ok | |
failures: | |
test_b64_1 | |
test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured | |
task '<main>' failed at 'Some tests failed', /build/rust-git/src/rust/src/libextra/test.rs:165 | |
[1]$ rustc --version | |
rustc 0.9 (d3ae3a2 2014-01-03 13:31:58 -0800) | |
host: x86_64-unknown-linux-gnu | |
[1]$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment