docs(fermata): known limits, config reference and READMEs say what the tests show
Known to fail holds only what known_limits.rs pins or Claude Code's docs state; the multi-line quoted value gets its own limit test. configuration.md follows the code (unknown fields, [enforcement] settings, marks, plain settings, verb classes) and every TOML example of it is loaded by tests/docs_toml_examples.rs. Speed numbers are measured with a release build. matrix.md notes the new refusals.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
//! Every fenced TOML example of `docs/configuration.md` loads as a `.botsecrets`, with
|
||||
//! unknown fields refused. A doc that shows a setting the code dropped fails here.
|
||||
|
||||
use dirigent_fermata::core::secrets::config::SecretsConfig;
|
||||
|
||||
fn toml_examples(doc: &str) -> Vec<String> {
|
||||
let mut blocks = Vec::new();
|
||||
let mut current: Option<String> = None;
|
||||
for line in doc.lines() {
|
||||
match (&mut current, line.trim_end()) {
|
||||
(None, "```toml") => current = Some(String::new()),
|
||||
(Some(_), "```") => blocks.extend(current.take()),
|
||||
(Some(block), text) => {
|
||||
block.push_str(text);
|
||||
block.push('\n');
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
blocks
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_toml_example_of_configuration_md_loads() {
|
||||
let doc = include_str!("../docs/configuration.md");
|
||||
let examples = toml_examples(doc);
|
||||
assert!(examples.len() >= 10, "found only {} TOML examples", examples.len());
|
||||
for example in &examples {
|
||||
if let Err(error) = SecretsConfig::from_toml(example) {
|
||||
panic!("this example of configuration.md does not load: {error}\n{example}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The check has teeth: a removed setting is refused.
|
||||
#[test]
|
||||
fn a_removed_setting_does_not_load() {
|
||||
for text in ["[enforcement]\nmode = \"strict\"\n", "[enforcement]\non_parse_error = \"mask-entire-file\"\n"] {
|
||||
assert!(SecretsConfig::from_toml(text).is_err(), "{text}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user