We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28ca7ba commit 1efe9c5Copy full SHA for 1efe9c5
chapter8/test_and_documents/src/main.rs
@@ -11,14 +11,19 @@ fn math_works() {
11
assert!(x + 1 == 2);
12
}
13
14
-/// panic test
+//#[test]
15
+//#[should_panic(expected = "divide by zero")]
16
+//fn divide_by_zero() {
17
+// let y: i32 = 0;
18
+// let _ = 1 / y;
19
+//}
20
+
21
#[test]
22
#[should_panic(expected = "divide by zero")]
-fn divide_by_zero() {
- let y = 0;
23
+fn divide_by_zero_negative() {
24
+ let y: i32 = -1;
25
let _ = 1 / y;
26
-
27
#[cfg(test)]
28
mod tests {
29
fn roughly_equal(a: f64, b: f64) -> bool {
0 commit comments