test(examples): avoid literal handle ids
Remove the last handwritten __h input from techdemo markup, switch E2E posts to generated handles, and extend example contracts to catch literal handle fields in templates. req: dx/003 req: ceremony/002 req: examples/003
This commit is contained in:
@@ -63,16 +63,25 @@ fn canonical_examples_do_not_author_low_level_resource_plumbing() {
|
||||
"::lower(include_str!",
|
||||
"lower_html(",
|
||||
"render_html(",
|
||||
"name=\"__h\"",
|
||||
"name='__h'",
|
||||
];
|
||||
let mut failures = Vec::new();
|
||||
scan_examples(&examples, &mut |path, text| {
|
||||
if path.components().any(|part| part.as_os_str() == "tests") {
|
||||
return;
|
||||
}
|
||||
if path.extension().and_then(|ext| ext.to_str()) != Some("rs") {
|
||||
let Some(ext) = path.extension().and_then(|ext| ext.to_str()) else {
|
||||
return;
|
||||
};
|
||||
if !matches!(ext, "rs" | "heml" | "html") {
|
||||
return;
|
||||
}
|
||||
let runtime_source = text.split("#[cfg(test)]").next().unwrap_or(text);
|
||||
let runtime_source = if ext == "rs" {
|
||||
text.split("#[cfg(test)]").next().unwrap_or(text)
|
||||
} else {
|
||||
text
|
||||
};
|
||||
for (line_no, line) in runtime_source.lines().enumerate() {
|
||||
if let Some(token) = forbidden.iter().find(|token| line.contains(*token)) {
|
||||
failures.push(format!(
|
||||
|
||||
Reference in New Issue
Block a user