mod common;
fn hooks_yaml() -> String {
common::without_comments(".pre-commit-hooks.yaml")
}
#[test]
fn no_published_hook_installs_the_python_package() {
let yaml = hooks_yaml();
assert!(
!yaml.contains("language: python"),
"a published hook still installs drep as a Python package"
);
assert!(
yaml.contains("language: rust"),
"the published hooks must build the Rust binary"
);
}
#[test]
fn the_markdown_hook_blocks_only_on_error_severity() {
let yaml = hooks_yaml();
assert!(
yaml.contains("drep lint-docs --fail-on error"),
"the markdown hook must gate at error severity"
);
assert!(
!yaml.contains("--strict"),
"--strict blocks on info findings, which no consumer wants in a hook"
);
}
#[test]
fn the_published_pre_push_hook_uses_the_push_gate() {
let yaml = hooks_yaml();
assert!(
yaml.contains("drep check --push-gate"),
"the published pre-push hook must stop after warming a cold review"
);
}
#[test]
fn the_repository_pre_push_hook_uses_the_push_gate_too() {
let yaml = common::without_comments(".pre-commit-config.yaml");
assert!(
yaml.contains("entry: ./target/release/drep check --push-gate"),
"drep must gate itself through the cache-first push path"
);
}