Skip to content

Commit

Permalink
Add looks_done method to Exercise to expose a resolution state
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdouSeck authored and lsagna committed May 10, 2021
1 parent 038f38e commit 032f65f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/exercise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ path = "{}.rs""#,

State::Pending(context)
}

// Check that the exercise looks to be solved using self.state()
// This is not the best way to check since
// the user can just remove the "I AM NOT DONE" string fromm the file
// without actually having solved anything.
// The only other way to truly check this would to compile and run
// the exercise; which would be both costly and counterintuitive
pub fn looks_done(&self) -> bool {
self.state() == State::Done
}
}

impl Display for Exercise {
Expand Down

0 comments on commit 032f65f

Please sign in to comment.