From 28b08fb07cbbd88e346d22f4c2ecee3611112779 Mon Sep 17 00:00:00 2001 From: Abdou Seck Date: Sat, 12 Dec 2020 13:45:37 -0500 Subject: [PATCH] Add looks_done method to Exercise to expose a resolution state --- src/exercise.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/exercise.rs b/src/exercise.rs index 283b2b900c..7afa230add 100644 --- a/src/exercise.rs +++ b/src/exercise.rs @@ -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 {