Skip to content

Commit 580a75f

Browse files
committed
add assertEqual to docstrings
closes #7374
1 parent 6303dc5 commit 580a75f

16 files changed

+683
-597
lines changed

runtime/Belt_Array.resi

+81-80
Large diffs are not rendered by default.

runtime/Belt_Float.resi

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Converts a given `float` to an `int`.
3030
## Examples
3131

3232
```rescript
33-
Js.log(Belt.Float.toInt(1.0) === 1) /* true */
33+
assertEqual(Belt.Float.toInt(1.0), 1)
3434
```
3535
*/
3636
external toInt: float => int = "%intoffloat"
@@ -41,7 +41,7 @@ Converts a given `int` to a `float`.
4141
## Examples
4242

4343
```rescript
44-
Js.log(Belt.Float.fromInt(1) === 1.0) /* true */
44+
assertEqual(Belt.Float.fromInt(1), 1.0)
4545
```
4646
*/
4747
external fromInt: int => float = "%identity"
@@ -52,7 +52,7 @@ Converts a given `string` to a `float`. Returns `Some(float)` when the input is
5252
## Examples
5353

5454
```rescript
55-
Js.log(Belt.Float.fromString("1.0") === Some(1.0)) /* true */
55+
assertEqual(Belt.Float.fromString("1.0"), Some(1.0))
5656
```
5757
*/
5858
let fromString: string => option<float>
@@ -64,7 +64,7 @@ Converts a given `float` to a `string`. Uses the JavaScript `String` constructor
6464
## Examples
6565

6666
```rescript
67-
Js.log(Belt.Float.toString(1.0) === "1.0") /* true */
67+
assertEqual(Belt.Float.toString(1.0), "1")
6868
```
6969
*/
7070
external toString: float => string = "String"

runtime/Belt_HashMap.resi

+14-14
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module IntHash = Belt.Id.MakeHashable({
114114

115115
let hMap = Belt.HashMap.fromArray([(1, "1")], ~id=module(IntHash))
116116
Belt.HashMap.clear(hMap)
117-
Belt.HashMap.isEmpty(hMap) == true
117+
assertEqual(Belt.HashMap.isEmpty(hMap), true)
118118
```
119119
*/
120120
let clear: t<'key, 'value, 'id> => unit
@@ -131,7 +131,7 @@ module IntHash = Belt.Id.MakeHashable({
131131
let eq = (a, b) => a == b
132132
})
133133

134-
Belt.HashMap.isEmpty(Belt.HashMap.fromArray([(1, "1")], ~id=module(IntHash))) == false
134+
assertEqual(Belt.HashMap.isEmpty(Belt.HashMap.fromArray([(1, "1")], ~id=module(IntHash))), false)
135135
```
136136
*/
137137
let isEmpty: t<_> => bool
@@ -152,7 +152,7 @@ let s0 = Belt.HashMap.fromArray([(2, "2"), (1, "1"), (3, "3")], ~id=module(IntHa
152152

153153
Belt.HashMap.set(s0, 2, "3")
154154

155-
Belt.HashMap.valuesToArray(s0) == ["1", "3", "3"]
155+
assertEqual(Belt.HashMap.valuesToArray(s0), ["1", "3", "3"])
156156
```
157157
*/
158158
let set: (t<'key, 'value, 'id>, 'key, 'value) => unit
@@ -174,7 +174,7 @@ let s1 = Belt.HashMap.copy(s0)
174174

175175
Belt.HashMap.set(s0, 2, "3")
176176

177-
Belt.HashMap.get(s0, 2) != Belt.HashMap.get(s1, 2)
177+
assertEqual(Belt.HashMap.get(s0, 2) == Belt.HashMap.get(s1, 2), false)
178178
```
179179
*/
180180
let copy: t<'key, 'value, 'id> => t<'key, 'value, 'id>
@@ -194,8 +194,8 @@ module IntHash = Belt.Id.MakeHashable({
194194
let s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))
195195
Belt.HashMap.set(s0, 1, "value1")
196196

197-
Belt.HashMap.get(s0, 1) == Some("value1")
198-
Belt.HashMap.get(s0, 2) == None
197+
assertEqual(Belt.HashMap.get(s0, 1), Some("value1"))
198+
assertEqual(Belt.HashMap.get(s0, 2), None)
199199
```
200200
*/
201201
let get: (t<'key, 'value, 'id>, 'key) => option<'value>
@@ -215,8 +215,8 @@ module IntHash = Belt.Id.MakeHashable({
215215
let s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))
216216
Belt.HashMap.set(s0, 1, "value1")
217217

218-
Belt.HashMap.has(s0, 1) == true
219-
Belt.HashMap.has(s0, 2) == false
218+
assertEqual(Belt.HashMap.has(s0, 1), true)
219+
assertEqual(Belt.HashMap.has(s0, 2), false)
220220
```
221221
*/
222222
let has: (t<'key, 'value, 'id>, 'key) => bool
@@ -236,7 +236,7 @@ module IntHash = Belt.Id.MakeHashable({
236236
let s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))
237237
Belt.HashMap.set(s0, 1, "value1")
238238
Belt.HashMap.remove(s0, 1)
239-
Belt.HashMap.has(s0, 1) == false
239+
assertEqual(Belt.HashMap.has(s0, 1), false)
240240
```
241241
*/
242242
let remove: (t<'key, 'value, 'id>, 'key) => unit
@@ -340,7 +340,7 @@ let s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))
340340
Belt.HashMap.set(s0, 1, "value1")
341341
Belt.HashMap.set(s0, 2, "value2")
342342

343-
Belt.HashMap.size(s0) == 2
343+
assertEqual(Belt.HashMap.size(s0), 2)
344344
```
345345
*/
346346
let size: t<_> => int
@@ -361,7 +361,7 @@ let s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))
361361
Belt.HashMap.set(s0, 1, "value1")
362362
Belt.HashMap.set(s0, 2, "value2")
363363

364-
Belt.HashMap.toArray(s0) == [(1, "value1"), (2, "value2")]
364+
assertEqual(Belt.HashMap.toArray(s0), [(1, "value1"), (2, "value2")])
365365
```
366366
*/
367367
let toArray: t<'key, 'value, 'id> => array<('key, 'value)>
@@ -382,7 +382,7 @@ let s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))
382382
Belt.HashMap.set(s0, 1, "value1")
383383
Belt.HashMap.set(s0, 2, "value2")
384384

385-
Belt.HashMap.keysToArray(s0) == [1, 2]
385+
assertEqual(Belt.HashMap.keysToArray(s0), [1, 2])
386386
```
387387
*/
388388
let keysToArray: t<'key, _, _> => array<'key>
@@ -403,7 +403,7 @@ let s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))
403403
Belt.HashMap.set(s0, 1, "value1")
404404
Belt.HashMap.set(s0, 2, "value2")
405405

406-
Belt.HashMap.valuesToArray(s0) == ["value1", "value2"]
406+
assertEqual(Belt.HashMap.valuesToArray(s0), ["value1", "value2"])
407407
```
408408
*/
409409
let valuesToArray: t<_, 'value, _> => array<'value>
@@ -423,7 +423,7 @@ module IntHash = Belt.Id.MakeHashable({
423423
})
424424

425425
let s0 = Belt.HashMap.fromArray([(1, "value1"), (2, "value2")], ~id=module(IntHash))
426-
Belt.HashMap.toArray(s0) == [(1, "value1"), (2, "value2")]
426+
assertEqual(Belt.HashMap.toArray(s0), [(1, "value1"), (2, "value2")])
427427
```
428428
*/
429429
let fromArray: (array<('key, 'value)>, ~id: id<'key, 'id>) => t<'key, 'value, 'id>

0 commit comments

Comments
 (0)