#[derive(Debug, PartialEq, Clone)]
pub struct Comment {
comment: String,
}
impl Comment {
pub fn new(comment: &str) -> Comment {
Comment {
comment: String::from(comment),
}
}
pub fn get_comment(&self) -> &str {
&self.comment
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn eq_test() {
let a = Comment::new("a comment");
let b = Comment::new("a comment");
assert_eq!(a == b, true);
assert_eq!(a != b, false);
}
#[test]
fn ne_test() {
let a = Comment::new("a comment");
let b = Comment::new("b comment");
assert_eq!(a != b, true);
assert_eq!(a == b, false);
}
}