Skip to content

Commit 0b9220c

Browse files
committed
Add looks_done method to Exercise to expose a resolution state
1 parent 0d65753 commit 0b9220c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/exercise.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,16 @@ path = "{}.rs""#,
232232

233233
State::Pending(context)
234234
}
235+
236+
// Check that the exercise looks to be solved using self.state()
237+
// This is not the best way to check since
238+
// the user can just remove the "I AM NOT DONE" string fromm the file
239+
// without actually having solved anything.
240+
// The only other way to truly check this would to compile and run
241+
// the exercise; which would be both costly and counterintuitive
242+
pub fn looks_done(&self) -> bool {
243+
self.state() == State::Done
244+
}
235245
}
236246

237247
impl Display for Exercise {

0 commit comments

Comments
 (0)