You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,6 +141,53 @@ The `Evaluation.result` provides access to:
141
141
142
142
This is particularly useful when writing tests for custom assertion operations or when you need to verify that assertions produce the correct error messages.
143
143
144
+
## Release Build Configuration
145
+
146
+
By default, fluent-asserts behaves like D's built-in `assert`: assertions are enabled in debug builds and disabled (become no-ops) in release builds. This allows you to use fluent-asserts as a replacement for `assert` in your production code without any runtime overhead in release builds.
During unittest builds, the library automatically installs a custom handler for D's built-in `assert` statements. This provides fluent-asserts style error messages even when using standard `assert`:
Copy file name to clipboardExpand all lines: docs/src/content/docs/guide/configuration.mdx
+69Lines changed: 69 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,6 +130,75 @@ not ok - [1, 2, 3] should contain 5. 5 is missing from [1, 2, 3].
130
130
...
131
131
```
132
132
133
+
## Release Build Configuration
134
+
135
+
By default, fluent-asserts behaves like D's built-in `assert`: assertions are enabled in debug builds and disabled (become no-ops) in release builds. This allows you to use fluent-asserts as a replacement for `assert` in your production code without any runtime overhead in release builds.
The easiest way to use fluent-asserts is through [DUB](https://code.dlang.org/), the D package manager.
9
11
10
-
### Add to dub.json
11
-
12
+
<Tabs>
13
+
<TabItemlabel="dub.sdl">
14
+
```sdl
15
+
dependency "fluent-asserts" version="~>1.0.1"
16
+
```
17
+
</TabItem>
18
+
<TabItemlabel="dub.json">
12
19
```json
13
20
{
14
21
"dependencies": {
15
22
"fluent-asserts": "~>1.0.1"
16
23
}
17
24
}
18
25
```
19
-
20
-
### Or add to dub.sdl
21
-
22
-
```sdl
23
-
dependency "fluent-asserts" version="~>1.0.1"
24
-
```
26
+
</TabItem>
27
+
</Tabs>
25
28
26
29
Then run:
27
30
@@ -75,6 +78,12 @@ dub test
75
78
dub test --compiler=ldc2
76
79
```
77
80
81
+
## Release Builds
82
+
83
+
By default, fluent-asserts assertions are disabled in release builds (similar to D's built-in `assert`). This means you can use fluent-asserts in production code without runtime overhead in release builds.
84
+
85
+
See [Configuration](/guide/configuration/#release-build-configuration) for details on how to control this behavior.
86
+
78
87
## Integration with Test Frameworks
79
88
80
89
fluent-asserts integrates seamlessly with D test frameworks.
@@ -85,6 +94,14 @@ fluent-asserts integrates seamlessly with D test frameworks.
Copy file name to clipboardExpand all lines: docs/src/content/docs/guide/introduction.mdx
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,6 +101,18 @@ The `Evaluation.result` provides access to:
101
101
-`missing` - array of missing elements (for collection comparisons)
102
102
-`extra` - array of extra elements (for collection comparisons)
103
103
104
+
## Release Builds
105
+
106
+
Like D's built-in `assert`, fluent-asserts assertions are disabled in release builds. This means you can use them in production code without runtime overhead:
107
+
108
+
```d
109
+
// In debug builds: assertion is checked
110
+
// In release builds: this is a no-op
111
+
expect(value).to.be.greaterThan(0);
112
+
```
113
+
114
+
See [Configuration](/guide/configuration/#release-build-configuration) for how to control this behavior.
115
+
104
116
## Custom Assert Handler
105
117
106
118
During unittest builds, the library automatically installs a custom handler for D's built-in `assert` statements. This provides fluent-asserts style error messages even when using standard `assert`:
0 commit comments