Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed inaccurate test/ignores. #362

Merged
merged 6 commits into from
Oct 10, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exercises/bob/tests/bob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ fn test_shouting_numbers() {
}

#[test]
#[ignore]
fn test_only_numbers() {
assert_eq!("Whatever.", bob::reply("1, 2, 3"));
}
Expand Down
7 changes: 7 additions & 0 deletions exercises/crypto-square/tests/crypto-square.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn test_empty_input() {


#[test]
#[ignore]
fn test_encrypt_also_decrypts_square() {
// note that you only get the exact input back if:
// 1. no punctuation
Expand All @@ -23,6 +24,7 @@ fn test_encrypt_also_decrypts_square() {
}

#[test]
#[ignore]
fn test_example() {
test(
"If man was meant to stay on the ground, god would have given us roots.",
Expand All @@ -31,25 +33,29 @@ fn test_example() {
}

#[test]
#[ignore]
fn test_empty_last_line() {
test("congratulate", "crl oaa ntt gue")
}

#[test]
#[ignore]
fn test_spaces_are_reorganized() {
test("abet", "ae bt");
test("a bet", "ae bt");
test(" a b e t ", "ae bt");
}

#[test]
#[ignore]
fn test_everything_becomes_lowercase() {
test("caSe", "cs ae");
test("cAsE", "cs ae");
test("CASE", "cs ae");
}

#[test]
#[ignore]
fn test_ignore_non_ascii_chars() {
test(
"She got her education, then got rich programming: 👩‍🎓🎓👩‍💻💰",
Expand All @@ -58,6 +64,7 @@ fn test_ignore_non_ascii_chars() {
}

#[test]
#[ignore]
fn test_long() {
test(
r#"
Expand Down
13 changes: 9 additions & 4 deletions exercises/say/tests/say.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ fn test_zero() {
// If the below test is uncommented, it should not compile.
//
/*
#[test]
fn test_negative() {
assert_eq!(say::encode(-1), String::from("won't compile"));
}

#[test]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is changing more lines than I expect it to change. A space got added before each line. That makes it hard to understand what changed, since now each line of this test is marked as a changed line. If this change (add space to each line) needs to be made for some reason, it would want to be a separate commit

#[ignore]
#[should_panic]
Copy link
Member

@petertseng petertseng Oct 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure should_panic makes sense, since who can say whether the test should panic if it doesn't even compile? I would not add such a line.

I kind of wish Rust would have a #[should_not_compile] or something, but that is something to bring up with the Rust project, I suppose

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of wish Rust would have a #[should_not_compile]

That is https://github.com/laumann/compiletest-rs apparently. a project for another day (and probably not something we can make students download)

fn test_negative() {
assert_eq!(say::encode(-1), String::from("won't compile"));
}

*/

#[test]
#[ignore]
fn test_one() {
assert_eq!(say::encode(1), String::from("one"));
}
Expand Down