refactor(cow1): replace main with tests

Following the discussion in #1195 this is the best I could come up with.
The issue for me (and apparently a few other learners) was that the code
needed to complete the exercise was not _missing_, but was rather there
but wrong.

In the end, what made the difference between this exercise and others
(for me) was that in this exercise I was supposed to learn what to
*expect* of an output. So I think it makes sense here to let the learner
modify the tests and not the code itself.

Fixes #1195

Signed-off-by: Daan Wynen <black.puppydog@gmx.de>

# Conflicts:
#	info.toml
This commit is contained in:
Daan Wynen
2023-02-14 20:37:33 +01:00
parent 149e0c8ac2
commit bbdc5c6039
2 changed files with 49 additions and 23 deletions

View File

@@ -1010,11 +1010,11 @@ https://doc.rust-lang.org/stable/book/ch16-00-concurrency.html
[[exercises]]
name = "cow1"
path = "exercises/smart_pointers/cow1.rs"
mode = "compile"
mode = "test"
hint = """
Since the vector is already owned, the `Cow` type doesn't need to clone it.
If Cow already owns the data it doesn't need to clone it when to_mut() is called.
Checkout https://doc.rust-lang.org/std/borrow/enum.Cow.html for documentation
Check out https://doc.rust-lang.org/std/borrow/enum.Cow.html for documentation
on the `Cow` type.
"""