Skip to content

Commit 4d04aad

Browse files
authored
Merge pull request #1641 from mo8it/move-semantics5-test
Convert exercises with assertions to tests
2 parents 847b574 + 193b600 commit 4d04aad

File tree

6 files changed

+9
-5
lines changed

6 files changed

+9
-5
lines changed

exercises/iterators/iterators1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
// I AM NOT DONE
1313

14+
#[test]
1415
fn main() {
1516
let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"];
1617

exercises/move_semantics/move_semantics3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// move_semantics3.rs
22
//
3-
// Make me compile without adding new lines-- just changing existing lines! (no
3+
// Make me compile without adding new lines -- just changing existing lines! (no
44
// lines with multiple semicolons necessary!)
55
//
66
// Execute `rustlings hint move_semantics3` or use the `hint` watch subcommand

exercises/move_semantics/move_semantics5.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// I AM NOT DONE
1010

11+
#[test]
1112
fn main() {
1213
let mut x = 100;
1314
let y = &mut x;

exercises/smart_pointers/rc1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ impl Planet {
3535
}
3636
}
3737

38+
#[test]
3839
fn main() {
3940
let sun = Rc::new(Sun {});
4041
println!("reference count = {}", Rc::strong_count(&sun)); // 1 reference

exercises/threads/threads3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ fn send_tx(q: Queue, tx: mpsc::Sender<u32>) -> () {
4848
});
4949
}
5050

51+
#[test]
5152
fn main() {
5253
let (tx, rx) = mpsc::channel();
5354
let queue = Queue::new();

info.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ So the end goal is to:
337337
[[exercises]]
338338
name = "move_semantics5"
339339
path = "exercises/move_semantics/move_semantics5.rs"
340-
mode = "compile"
340+
mode = "test"
341341
hint = """
342342
Carefully reason about the range in which each mutable reference is in
343343
scope. Does it help to update the value of referent (x) immediately after
@@ -827,7 +827,7 @@ https://doc.rust-lang.org/stable/book/ch11-01-writing-tests.html#checking-for-pa
827827
[[exercises]]
828828
name = "iterators1"
829829
path = "exercises/iterators/iterators1.rs"
830-
mode = "compile"
830+
mode = "test"
831831
hint = """
832832
Step 1:
833833
We need to apply something to the collection `my_fav_fruits` before we start to go through
@@ -932,7 +932,7 @@ and try other types!
932932
[[exercises]]
933933
name = "rc1"
934934
path = "exercises/smart_pointers/rc1.rs"
935-
mode = "compile"
935+
mode = "test"
936936
hint = """
937937
This is a straightforward exercise to use the Rc<T> type. Each Planet has
938938
ownership of the Sun, and uses Rc::clone() to increment the reference count of the Sun.
@@ -1021,7 +1021,7 @@ what you've learned :)"""
10211021
[[exercises]]
10221022
name = "threads3"
10231023
path = "exercises/threads/threads3.rs"
1024-
mode = "compile"
1024+
mode = "test"
10251025
hint = """
10261026
An alternate way to handle concurrency between threads is to use
10271027
a mpsc (multiple producer, single consumer) channel to communicate.

0 commit comments

Comments
 (0)