#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Skill {
pub name: &'static str,
pub description: &'static str,
pub content: &'static str,
pub references: &'static [(&'static str, &'static str)],
}
#[cfg(test)]
mod tests {
use super::*;
const SAMPLE: Skill = Skill {
name: "sample",
description: "a sample skill",
content: "# Sample\n\nBody.",
references: &[("references/extra.md", "extra content")],
};
#[test]
fn fields_are_reachable() {
assert_eq!(SAMPLE.name, "sample");
assert_eq!(SAMPLE.description, "a sample skill");
assert!(SAMPLE.content.contains("Body"));
assert_eq!(SAMPLE.references.len(), 1);
assert_eq!(SAMPLE.references[0].0, "references/extra.md");
}
#[test]
fn empty_references_is_valid() {
const NO_REFS: Skill = Skill {
name: "bare",
description: "no references",
content: "content",
references: &[],
};
assert!(NO_REFS.references.is_empty());
}
#[test]
fn skill_is_copy_and_comparable() {
let copied = SAMPLE;
assert_eq!(SAMPLE, copied);
}
}