fluent-asserts 0.3.0

Fluent assertions done right

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Fluent Asserts Build Status

Writing unit tests it's easy with Dlang. The unittest block allows you to start writing tests and to be productive with no special setup.

Unfortunately the assert expresion does not help you to write expressive asserts, and in case of a failure it's hard to find why an assert failed. The fluent-assert allow you to more naturally specify the expected outcome of a TDD or BDD-style test.

To begin

  1. Add the DUB dependency: https://code.dlang.org/packages/fluent-asserts

  2. Import it:

import fluent.asserts;
  1. Use it:
    unittest {
  1. Run the tests:
➜  dub test --compiler=ldc2
No source files found in configuration 'library'. Falling back to "dub -b unittest".
Performing "unittest" build using ldc2 for x86_64.
fluent-asserts:core 0.2.0+commit.16.g05678db: target for configuration "library" is up to date.
fluent-asserts 0.2.0+commit.16.g05678db: target for configuration "library" is up to date.
fluent-test ~master: building configuration "application"...
To force a rebuild of up-to-date targets, run again with --force.
Running ./fluent-test 
fluentasserts.core.base.TestException@source/app.d(11): true should equal `false`. `true` is not equal to `false`.
     6: 	writeln("Edit source/app.d to start your project.");
     7: }
    10: unittest {
>   11: 	true.should.equal(false);
    12: }

Program exited with code 1

API Docs

The library uses the should template in combination with Uniform Function Call Syntax (UFCS)

auto should(T)(lazy const T testData);

So the following statements are equivalent


In addition, the library provides a not modifier that negates the assert condition:


You can use fluent asserts with:


MIT. See LICENSE for details.

  • Szabo Bogdan
Sub packages:
fluent-asserts:core, fluent-asserts:vibe
1.0.0 2022-Aug-24
1.0.0-beta.2 2022-Aug-24
1.0.0-beta.1 2022-Aug-12
0.14.0-alpha.13 2022-May-02
0.14.0-alpha.11 2021-Dec-16
Show all 63 versions
Download Stats:
  • 1 downloads today

  • 63 downloads this week

  • 199 downloads this month

  • 43732 downloads total

Short URL: