Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[cfg(test)]
- mod tests {
- struct Inmate {
- name: String,
- infraction: String,
- incarceration_years: u16
- }
- impl Inmate {
- fn new<IntoString: Into<String>>(
- name: IntoString,
- infraction: IntoString,
- incarceration_years: u16,
- ) -> Self {
- Self {
- name: name.into(),
- infraction: infraction.into(),
- incarceration_years,
- }
- }
- }
- #[test]
- fn incarcerates() {
- let inmates = vec![
- Inmate::new("LonghornAR", "maga", 20),
- Inmate::new("wswartzendruber", "maga", 20),
- ];
- assert_eq!(2, inmates.len());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement