26 lines
690 B
Rust
26 lines
690 B
Rust
#[cfg(test)]
|
|
mod tests {
|
|
// Note this useful idiom: importing names from outer (for mod tests) scope.
|
|
use crate::structures::*;
|
|
|
|
#[test]
|
|
fn test_tag_new() {
|
|
assert_eq!(Tag::new("test".to_string()), Tag('#', "test".to_string()));
|
|
}
|
|
|
|
#[test]
|
|
fn test_tag_from_string() {
|
|
assert_eq!(Tag::from_string("#test".to_string()), Tag('#', "test".to_string()));
|
|
}
|
|
|
|
#[test]
|
|
fn test_tag_to_string() {
|
|
assert_eq!(Tag('#', "test".to_string()).to_string(), "#test".to_string());
|
|
}
|
|
|
|
#[test]
|
|
fn test_shortcode_conversion() {
|
|
assert_eq!(construct_shortcode("Test SHORtcode".to_string()), "test-shortcode".to_string());
|
|
}
|
|
}
|