mirror of
https://github.com/edg-l/sitewriter.git
synced 2024-11-09 09:38:24 +00:00
add 1 test and more docs
This commit is contained in:
parent
625694b7ee
commit
c1d4c59547
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "sitewriter"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
authors = ["Edgar L. <contact@edgarluque.com>"]
|
||||
edition = "2018"
|
||||
description = "A sitemap writing library."
|
||||
|
|
21
src/lib.rs
21
src/lib.rs
|
@ -61,14 +61,21 @@ use std::io::Cursor;
|
|||
use std::borrow::Cow;
|
||||
|
||||
/// How frequently the page is likely to change. This value provides general information to search engines and may not correlate exactly to how often they crawl the page.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum ChangeFreq {
|
||||
/// Changes each time it's accessed.
|
||||
Always,
|
||||
/// Changes hourly.
|
||||
Hourly,
|
||||
/// Changes daily.
|
||||
Daily,
|
||||
/// Changes weekly.
|
||||
Weekly,
|
||||
/// Changes monthly.
|
||||
Monthly,
|
||||
/// Changes yearly.
|
||||
Yearly,
|
||||
/// Describes archived URLs.
|
||||
Never,
|
||||
}
|
||||
|
||||
|
@ -125,6 +132,7 @@ impl Url {
|
|||
/// Struct to hold the sitemap information.
|
||||
#[derive(Debug)]
|
||||
pub struct Sitemap {
|
||||
/// The list of url entries.
|
||||
pub urls: Vec<Url>,
|
||||
}
|
||||
|
||||
|
@ -242,6 +250,17 @@ mod tests {
|
|||
sitemap.into_str();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn changefreq_is_valid() {
|
||||
assert_eq!(format!("{}", ChangeFreq::Always), "always");
|
||||
assert_eq!(format!("{}", ChangeFreq::Hourly), "hourly");
|
||||
assert_eq!(format!("{}", ChangeFreq::Daily), "daily");
|
||||
assert_eq!(format!("{}", ChangeFreq::Weekly), "weekly");
|
||||
assert_eq!(format!("{}", ChangeFreq::Monthly), "monthly");
|
||||
assert_eq!(format!("{}", ChangeFreq::Yearly), "yearly");
|
||||
assert_eq!(format!("{}", ChangeFreq::Never), "never");
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "chrono"))]
|
||||
#[test]
|
||||
fn it_works() {
|
||||
|
|
Loading…
Reference in a new issue