Skip to content

Commit

Permalink
robot-name: remove redundant tests (#1983)
Browse files Browse the repository at this point in the history
[no important files changed]

part of #1824

This is another case where I think it makes sense to actually keep the
util function around. It produces a good error message and in
combination with the body of the test function, users should have enough
information.

As the comment in the diff already states, the removed tests are
redundant because the type system prevents such errors anyway.
  • Loading branch information
senekor authored Aug 16, 2024
1 parent 4d28260 commit 9617af2
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions exercises/practice/robot-name/tests/robot-name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,12 @@ fn assert_name_matches_pattern(n: &str) {
);
}

fn assert_name_is_persistent(r: &robot::Robot) {
// The type system already proves this, but why not.
let n1 = r.name();
let n2 = r.name();
let n3 = r.name();
assert_eq!(n1, n2);
assert_eq!(n2, n3);
}

#[test]
fn name_should_match_expected_pattern() {
let r = robot::Robot::new();
assert_name_matches_pattern(r.name());
}

#[test]
#[ignore]
fn name_is_persistent() {
assert_name_is_persistent(&robot::Robot::new());
}

#[test]
#[ignore]
fn different_robots_have_different_names() {
Expand Down Expand Up @@ -63,14 +48,6 @@ fn new_name_should_match_expected_pattern() {
assert_name_matches_pattern(r.name());
}

#[test]
#[ignore]
fn new_name_is_persistent() {
let mut r = robot::Robot::new();
r.reset_name();
assert_name_is_persistent(&r);
}

#[test]
#[ignore]
fn new_name_is_different_from_old_name() {
Expand Down

0 comments on commit 9617af2

Please sign in to comment.