yak(mutation-testing-with-muex-blogex-pure-app-code-1341): mutation testing with muex (blogex + pure app code)

This commit is contained in:
Willem van den Ende
2026-10-29 10:07:55 +00:00
parent 09da15c1df
commit 3ef38bc8fc
14 changed files with 572 additions and 3 deletions
@@ -245,6 +245,24 @@ defmodule Blogex.LinkValidatorTest do
end
describe "validate_body/2" do
# The guard is a conjunction, not a disjunction: both arguments must have
# the documented types. Mutating `and` to `or` would let a string blog id
# (or a non-binary body) through the guard to crash somewhere else, so pin
# the contract at the door.
test "rejects a non-atom blog id at the function clause guard" do
assert_raise FunctionClauseError, fn ->
# apply/3 keeps the compiler's type checker quiet: the point is the
# runtime guard, and the test deliberately passes an invalid type.
apply(LinkValidator, :validate_body, ["Just text, no links.", "engineering"])
end
end
test "rejects a non-binary body at the function clause guard" do
assert_raise FunctionClauseError, fn ->
apply(LinkValidator, :validate_body, [[], :engineering])
end
end
test "returns :ok when body has no internal blog links" do
body = "Just text, no links."