Skip to content

grep — all cases

Every case file under src/clauz3/stdlib/grep/tests/cases/, inlined. _pass cases must prove; _fail cases must not.

See the curated walk-through for the trusted module and contract vocabulary.

src/clauz3/stdlib/grep/tests/cases/never_read_under_fail.py

# ruff: noqa: F821
from tools.grep.trusted import contracts as grep_rules
from tools.grep.trusted.effects import grep

import clauz3


@clauz3.guarantee(grep_rules.never_read_under("/home/user/.ssh"))
def main() -> None:
    grep("key", "/home/user/.ssh/id_rsa")

src/clauz3/stdlib/grep/tests/cases/never_read_under_pass.py

# ruff: noqa: F821
from tools.grep.trusted import contracts as grep_rules
from tools.grep.trusted.effects import grep

import clauz3


@clauz3.guarantee(grep_rules.never_read_under("/home/user/.ssh"))
def main() -> None:
    grep("TODO", "/repo/src/app.py")

src/clauz3/stdlib/grep/tests/cases/only_pattern_fail.py

# ruff: noqa: F821
from tools.grep.trusted import contracts as grep_rules
from tools.grep.trusted.effects import grep

import clauz3


@clauz3.guarantee(grep_rules.only_pattern("TODO"))
def main() -> None:
    grep("FIXME", "/repo/a.py")

src/clauz3/stdlib/grep/tests/cases/only_pattern_pass.py

# ruff: noqa: F821
from tools.grep.trusted import contracts as grep_rules
from tools.grep.trusted.effects import grep

import clauz3


@clauz3.guarantee(grep_rules.only_pattern("TODO"))
def main() -> None:
    grep("TODO", "/repo/a.py")
    grep("TODO", "/repo/b.py")

src/clauz3/stdlib/grep/tests/cases/only_read_under_fail.py

# ruff: noqa: F821
from tools.grep.trusted import contracts as grep_rules
from tools.grep.trusted.effects import grep

import clauz3


@clauz3.guarantee(grep_rules.only_read_under("/repo"))
def main() -> None:
    grep("secret", "/etc/shadow")

src/clauz3/stdlib/grep/tests/cases/only_read_under_pass.py

# ruff: noqa: F821
from tools.grep.trusted import contracts as grep_rules
from tools.grep.trusted.effects import grep

import clauz3


@clauz3.guarantee(grep_rules.only_read_under("/repo"))
def main() -> None:
    grep("TODO", "/repo/src/app.py")

src/clauz3/stdlib/grep/tests/cases/searches_at_most_fail.py

# ruff: noqa: F821
from tools.grep.trusted import contracts as grep_rules
from tools.grep.trusted.effects import grep

import clauz3


@clauz3.guarantee(grep_rules.searches_at_most(1))
def main() -> None:
    grep("TODO", "/repo/a.py")
    grep("FIXME", "/repo/b.py")

src/clauz3/stdlib/grep/tests/cases/searches_at_most_pass.py

# ruff: noqa: F821
from tools.grep.trusted import contracts as grep_rules
from tools.grep.trusted.effects import grep

import clauz3


@clauz3.guarantee(grep_rules.searches_at_most(2))
def main() -> None:
    grep("TODO", "/repo/a.py")
    grep("FIXME", "/repo/b.py")