From e5f2decb0de1d318b04da78cf3a198e004e99c63 Mon Sep 17 00:00:00 2001 From: Inkrementator <70717315+Inkrementator@users.noreply.github.com> Date: Tue, 3 Mar 2026 20:44:57 +0100 Subject: [PATCH] List all custom assertions in submodule readme This allows you to click on the sub-package on code.dlang.org and get a list. This is something have now done a few times (instinctively, the affordance is definitely there for it) but I never found anything and had to go source diving for the functions. Extracted with the following commands from the git root dir: ``` PATTERN='^\s*(?:[A-Za-z_@()\s]*\s)?(?:auto|void)\s+(should[A-Z][A-Za-z_0-9]*)' FILE=subpackages/assertions/source/unit_threaded/assertions.d rg -P --no-line-number --only-matching --replace '$1' "$PATTERN" "$FILE" \ | awk '!seen[$0]++' \ | sed 's/^/- /' ``` --- subpackages/assertions/README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 subpackages/assertions/README.md diff --git a/subpackages/assertions/README.md b/subpackages/assertions/README.md new file mode 100644 index 0000000..277af1a --- /dev/null +++ b/subpackages/assertions/README.md @@ -0,0 +1,32 @@ +This module contains the following assertions: + +- shouldBeTrue +- shouldBeFalse +- shouldEqual +- shouldNotEqual +- shouldBeNull +- shouldNotBeNull +- shouldBeIn +- shouldNotBeIn +- shouldThrow +- shouldThrowExactly +- shouldNotThrow +- shouldThrowWithMessage +- shouldApproxEqual +- shouldBeEmpty +- shouldNotBeEmpty +- shouldBeGreaterThan +- shouldBeSmallerThan +- shouldBeSameSetAs +- shouldNotBeSameSetAs +- shouldBeSameJsonAs +- shouldBeBetween +- shouldApprox + +It also contains the `should` -testing DSL. I.e.: +``` +1.should == 1; +1.should.not == 2; +1.should in [1, 2, 3]; +4.should.not in [1, 2, 3]; +```