Add automated test for testing the link target code.
This commit is contained in:
parent
aeca958cef
commit
7c92b602bc
@ -42,7 +42,7 @@ intermediate!(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub(crate) enum LinkTarget {
|
pub(crate) enum LinkTarget {
|
||||||
Raw(String),
|
Raw(String),
|
||||||
Post {
|
Post {
|
||||||
@ -124,3 +124,27 @@ impl LinkTarget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use std::sync::Arc;
|
||||||
|
use std::sync::Mutex;
|
||||||
|
|
||||||
|
use crate::intermediate::Registry;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn link_target_raw() -> Result<(), CustomError> {
|
||||||
|
let registry = Registry::new();
|
||||||
|
let registry = Arc::new(Mutex::new(registry));
|
||||||
|
let intermediate_context = IntermediateContext::new(registry)?;
|
||||||
|
for inp in ["https://test.example/foo"] {
|
||||||
|
assert_eq!(
|
||||||
|
LinkTarget::from_string(intermediate_context.clone(), inp.to_owned())?,
|
||||||
|
LinkTarget::Raw(inp.to_owned())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user