Commit 948b99d
test: fix broken tests in test-buffer-includes
Some of the tests for `buffer.includes()` functionality introduced in
#3567 have been broken in a way that
caused them to always pass regardless of the result of the tested
method.
This behavior was caused by two reasons:
* These tests were written as though `buffer.includes()` was supposed
to return the same value that `buffer.indexOf()` does, i.e., used
indices or -1 as expected return values instead of true and false.
* `assert()` was used as the assertion function to do that instead of
`assert.strictEqual()`.
Thus `assert()` was called with a non-zero number as the first argument
effectively causing these tests to pass.
This commit changes the tests to use `assert.ok()` and removes redundant
indices.
PR-URL: #12040
Ref: #3567
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 18a586a commit 948b99d
1 file changed
+10
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
166 | 164 | | |
167 | 165 | | |
168 | 166 | | |
| |||
266 | 264 | | |
267 | 265 | | |
268 | 266 | | |
269 | | - | |
270 | | - | |
| 267 | + | |
| 268 | + | |
271 | 269 | | |
272 | 270 | | |
273 | | - | |
274 | | - | |
| 271 | + | |
| 272 | + | |
275 | 273 | | |
276 | 274 | | |
277 | 275 | | |
| |||
0 commit comments