0.0.1-alpha.5.fix.1

This commit is contained in:
2026-09-28 10:02:47 +02:00
parent c17b7068a3
commit a1b56af8ed
23 changed files with 427 additions and 55 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/knowledge-domain-lib/src/lib.rs
// version: 2
// version: 3
//! Shared domain contracts for SaseDev Knowledge.
//!
@@ -11,6 +11,3 @@ mod source;
pub use crate::content_family::ContentFamily;
pub use crate::source::{ContentSource, SourceId, SourceIdError};
#[cfg(test)]
mod unit_tests;

View File

@@ -1,5 +1,5 @@
// file: crates/knowledge-domain-lib/src/source.rs
// version: 2
// version: 3
//! Source identities independent of repository and forge providers.
@@ -66,3 +66,7 @@ impl crate::ContentSource {
return self.family;
}
}
#[cfg(test)]
#[path = "../unit_tests/source.rs"]
mod tests;

View File

@@ -1,27 +0,0 @@
// file: crates/knowledge-domain-lib/src/unit_tests.rs
// version: 2
#[test]
fn source_id_rejects_empty_values() {
assert_eq!(crate::SourceId::new(" "), Err(crate::SourceIdError::Empty));
return;
}
#[test]
fn source_id_constructs_and_exposes_valid_values() {
let source_id = crate::SourceId::new("pgr");
assert_eq!(source_id.as_ref().map(crate::SourceId::as_str), Ok("pgr"));
return;
}
#[test]
fn content_sources_are_not_limited_to_three_repositories() {
let sources = [
crate::ContentSource::new("pgr", crate::ContentFamily::Pgr),
crate::ContentSource::new("howtos", crate::ContentFamily::Howto),
crate::ContentSource::new("snippets", crate::ContentFamily::Snippet),
crate::ContentSource::new("project-extra", crate::ContentFamily::ProjectLocal),
];
assert!(sources.iter().all(Result::is_ok));
return;
}