-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlib.rs
More file actions
34 lines (29 loc) · 711 Bytes
/
Copy pathlib.rs
File metadata and controls
34 lines (29 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Example {
pub stuff: String,
}
impl Example {
pub fn new(value: String) -> Self {
Example { stuff: value }
}
}
/**********************************/
#[cfg(test)]
mod example_tests {
use super::*;
#[test]
fn test_new() {
let e = Example::new(String::from("test"));
assert_eq!(e.stuff, String::from("test"));
}
#[test]
fn test_clone_and_eq() {
let e = Example::new(String::from("test"));
assert_eq!(e, e.clone());
}
#[test]
fn test_debug() {
let e = Example::new(String::from("test"));
assert_eq!(format!("{e:?}"), "Example { stuff: \"test\" }");
}
}