Skip to content

add assertEqual to docstrings #7417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 81 additions & 80 deletions runtime/Belt_Array.resi

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions runtime/Belt_Float.resi
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Converts a given `float` to an `int`.
## Examples

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

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

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

```rescript
Js.log(Belt.Float.toString(1.0) === "1.0") /* true */
assertEqual(Belt.Float.toString(1.0), "1")
```
*/
external toString: float => string = "String"
Expand Down
28 changes: 14 additions & 14 deletions runtime/Belt_HashMap.resi
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module IntHash = Belt.Id.MakeHashable({

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

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

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

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

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

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

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

Belt.HashMap.has(s0, 1) == true
Belt.HashMap.has(s0, 2) == false
assertEqual(Belt.HashMap.has(s0, 1), true)
assertEqual(Belt.HashMap.has(s0, 2), false)
```
*/
let has: (t<'key, 'value, 'id>, 'key) => bool
Expand All @@ -236,7 +236,7 @@ module IntHash = Belt.Id.MakeHashable({
let s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))
Belt.HashMap.set(s0, 1, "value1")
Belt.HashMap.remove(s0, 1)
Belt.HashMap.has(s0, 1) == false
assertEqual(Belt.HashMap.has(s0, 1), false)
```
*/
let remove: (t<'key, 'value, 'id>, 'key) => unit
Expand Down Expand Up @@ -340,7 +340,7 @@ let s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))
Belt.HashMap.set(s0, 1, "value1")
Belt.HashMap.set(s0, 2, "value2")

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

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

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

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

let s0 = Belt.HashMap.fromArray([(1, "value1"), (2, "value2")], ~id=module(IntHash))
Belt.HashMap.toArray(s0) == [(1, "value1"), (2, "value2")]
assertEqual(Belt.HashMap.toArray(s0), [(1, "value1"), (2, "value2")])
```
*/
let fromArray: (array<('key, 'value)>, ~id: id<'key, 'id>) => t<'key, 'value, 'id>
Expand Down
Loading