Skip to content

Commit 48f58bb

Browse files
cristianoczth
authored andcommitted
shrink test output
1 parent 6be63fa commit 48f58bb

File tree

2 files changed

+5
-89
lines changed

2 files changed

+5
-89
lines changed

analysis/tests/src/Completion.res

+2-2
Original file line numberDiff line numberDiff line change
@@ -423,5 +423,5 @@ let onClick = evt => {
423423

424424
let ok = Ok(true)
425425

426-
// ok->
427-
// ^com
426+
// ok->g
427+
// ^com

analysis/tests/src/expected/Completion.res.txt

+3-87
Original file line numberDiff line numberDiff line change
@@ -1738,106 +1738,22 @@ Resolved opens 2 Completion.res Completion.res
17381738
"documentation": {"kind": "markdown", "value": "\n Converts a given `float` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n ```res example\n Js.log(Belt.Float.toString(1.0) === \"1.0\") /* true */\n ```\n"}
17391739
}]
17401740

1741-
Complete src/Completion.res 425:7
1742-
posCursor:[425:7] posNoWhite:[425:6] Found expr:[425:3->0:-1]
1743-
Completable: Cpath Value[ok]->
1741+
Complete src/Completion.res 425:8
1742+
posCursor:[425:8] posNoWhite:[425:7] Found expr:[425:3->425:8]
1743+
Completable: Cpath Value[ok]->g
17441744
Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder
17451745
Resolved opens 2 Completion.res Completion.res
17461746
[{
1747-
"label": "Belt.Result.mapWithDefaultU",
1748-
"kind": 12,
1749-
"tags": [],
1750-
"detail": "(t<'a, 'c>, 'b, (. 'a) => 'b) => 'b",
1751-
"documentation": null
1752-
}, {
1753-
"label": "Belt.Result.flatMapU",
1754-
"kind": 12,
1755-
"tags": [],
1756-
"detail": "(t<'a, 'c>, (. 'a) => t<'b, 'c>) => t<'b, 'c>",
1757-
"documentation": null
1758-
}, {
1759-
"label": "Belt.Result.eqU",
1760-
"kind": 12,
1761-
"tags": [],
1762-
"detail": "(t<'a, 'c>, t<'b, 'd>, (. 'a, 'b) => bool) => bool",
1763-
"documentation": null
1764-
}, {
1765-
"label": "Belt.Result.map",
1766-
"kind": 12,
1767-
"tags": [],
1768-
"detail": "(t<'a, 'c>, 'a => 'b) => t<'b, 'c>",
1769-
"documentation": {"kind": "markdown", "value": "\n `map(res, f)`: When res is `Ok(n)`, returns `Ok(f(n))`. Otherwise returns res\n unchanged. Function `f` takes a value of the same type as `n` and returns an\n ordinary value.\n\n ```res example\n let f = (x) => sqrt(Belt.Int.toFloat(x))\n\n Belt.Result.map(Ok(64), f) == Ok(8.0)\n\n Belt.Result.map(Error(\"Invalid data\"), f) == Error(\"Invalid data\")\n ```\n"}
1770-
}, {
17711747
"label": "Belt.Result.getExn",
17721748
"kind": 12,
17731749
"tags": [],
17741750
"detail": "t<'a, 'b> => 'a",
17751751
"documentation": {"kind": "markdown", "value": "\n `getExn(res)`: when `res` is `Ok(n)`, returns `n` when `res` is `Error(m)`, raise an exception\n\n ```res example\n Belt.Result.getExn(Belt.Result.Ok(42)) == 42\n\n Belt.Result.getExn(Belt.Result.Error(\"Invalid data\")) /* raises exception */\n ```\n"}
1776-
}, {
1777-
"label": "Belt.Result.mapWithDefault",
1778-
"kind": 12,
1779-
"tags": [],
1780-
"detail": "(t<'a, 'c>, 'b, 'a => 'b) => 'b",
1781-
"documentation": {"kind": "markdown", "value": "\n `mapWithDefault(res, default, f)`: When res is `Ok(n)`, returns `f(n)`,\n otherwise `default`.\n\n ```res example\n let ok = Belt.Result.Ok(42)\n Belt.Result.mapWithDefault(ok, 0, (x) => x / 2) == 21\n\n let error = Belt.Result.Error(\"Invalid data\")\n Belt.Result.mapWithDefault(error, 0, (x) => x / 2) == 0\n ```\n"}
17821752
}, {
17831753
"label": "Belt.Result.getWithDefault",
17841754
"kind": 12,
17851755
"tags": [],
17861756
"detail": "(t<'a, 'b>, 'a) => 'a",
17871757
"documentation": {"kind": "markdown", "value": "\n `getWithDefault(res, defaultValue)`: If `res` is `Ok(n)`, returns `n`,\n otherwise `default`\n\n ```res example\n Belt.Result.getWithDefault(Ok(42), 0) == 42\n\n Belt.Result.getWithDefault(Error(\"Invalid Data\"), 0) == 0\n ```\n"}
1788-
}, {
1789-
"label": "Belt.Result.isError",
1790-
"kind": 12,
1791-
"tags": [],
1792-
"detail": "t<'a, 'b> => bool",
1793-
"documentation": {"kind": "markdown", "value": "\n `isError(res)`: Returns `true` if `res` is of the form `Error(e)`, `false` if\n it is the `Ok(n)` variant.\n"}
1794-
}, {
1795-
"label": "Belt.Result.cmpU",
1796-
"kind": 12,
1797-
"tags": [],
1798-
"detail": "(t<'a, 'c>, t<'b, 'd>, (. 'a, 'b) => int) => int",
1799-
"documentation": null
1800-
}, {
1801-
"label": "Belt.Result.flatMap",
1802-
"kind": 12,
1803-
"tags": [],
1804-
"detail": "(t<'a, 'c>, 'a => t<'b, 'c>) => t<'b, 'c>",
1805-
"documentation": {"kind": "markdown", "value": "\n `flatMap(res, f)`: When res is `Ok(n)`, returns `f(n)`. Otherwise, returns res\n unchanged. Function `f` takes a value of the same type as `n` and returns a\n `Belt.Result`.\n\n ```res example\n let recip = (x) =>\n if (x !== 0.0) {\n Belt.Result.Ok(1.0 /. x)\n } else {\n Belt.Result.Error(\"Divide by zero\")\n }\n\n Belt.Result.flatMap(Ok(2.0), recip) == Ok(0.5)\n\n Belt.Result.flatMap(Ok(0.0), recip) == Error(\"Divide by zero\")\n\n Belt.Result.flatMap(Error(\"Already bad\"), recip) == Error(\"Already bad\")\n ```\n"}
1806-
}, {
1807-
"label": "Belt.Result.eq",
1808-
"kind": 12,
1809-
"tags": [],
1810-
"detail": "(t<'a, 'c>, t<'b, 'd>, ('a, 'b) => bool) => bool",
1811-
"documentation": {"kind": "markdown", "value": "\n `eq(res1, res2, f)`: Determine if two `Belt.Result` variables are equal with\n respect to an equality function. If `res1` and `res2` are of the form `Ok(n)`\n and `Ok(m)`, return the result of `f(n, m)`. If one of `res1` and `res2` are of\n the form `Error(e)`, return false If both `res1` and `res2` are of the form\n `Error(e)`, return true\n\n ```res example\n let good1 = Belt.Result.Ok(42)\n\n let good2 = Belt.Result.Ok(32)\n\n let bad1 = Belt.Result.Error(\"invalid\")\n\n let bad2 = Belt.Result.Error(\"really invalid\")\n\n let mod10equal = (a, b) => mod(a, 10) === mod(b, 10)\n\n Belt.Result.eq(good1, good2, mod10equal) == true\n\n Belt.Result.eq(good1, bad1, mod10equal) == false\n\n Belt.Result.eq(bad2, good2, mod10equal) == false\n\n Belt.Result.eq(bad1, bad2, mod10equal) == true\n ```\n"}
1812-
}, {
1813-
"label": "Belt.Result.mapU",
1814-
"kind": 12,
1815-
"tags": [],
1816-
"detail": "(t<'a, 'c>, (. 'a) => 'b) => t<'b, 'c>",
1817-
"documentation": null
1818-
}, {
1819-
"label": "Belt.Result.isOk",
1820-
"kind": 12,
1821-
"tags": [],
1822-
"detail": "t<'a, 'b> => bool",
1823-
"documentation": {"kind": "markdown", "value": "\n `isOk(res)`: Returns `true` if `res` is of the form `Ok(n)`, `false` if it is\n the `Error(e)` variant.\n"}
1824-
}, {
1825-
"label": "Belt.Result.cmp",
1826-
"kind": 12,
1827-
"tags": [],
1828-
"detail": "(t<'a, 'c>, t<'b, 'd>, ('a, 'b) => int) => int",
1829-
"documentation": {"kind": "markdown", "value": "\n `cmp(res1, res2, f)`: Compare two `Belt.Result` variables with respect to a\n comparison function. The comparison function returns -1 if the first variable\n is \"less than\" the second, 0 if the two variables are equal, and 1 if the first\n is \"greater than\" the second.\n\n If `res1` and `res2` are of the form `Ok(n)` and `Ok(m)`, return the result of\n `f(n, m)`. If `res1` is of the form `Error(e)` and `res2` of the form `Ok(n)`,\n return -1 (nothing is less than something) If `res1` is of the form `Ok(n)` and\n `res2` of the form `Error(e)`, return 1 (something is greater than nothing) If\n both `res1` and `res2` are of the form `Error(e)`, return 0 (equal)\n\n ```res example\n let good1 = Belt.Result.Ok(59)\n\n let good2 = Belt.Result.Ok(37)\n\n let bad1 = Belt.Result.Error(\"invalid\")\n\n let bad2 = Belt.Result.Error(\"really invalid\")\n\n let mod10cmp = (a, b) => Pervasives.compare(mod(a, 10), mod(b, 10))\n\n Belt.Result.cmp(Ok(39), Ok(57), mod10cmp) == 1\n\n Belt.Result.cmp(Ok(57), Ok(39), mod10cmp) == (-1)\n\n Belt.Result.cmp(Ok(39), Error(\"y\"), mod10cmp) == 1\n\n Belt.Result.cmp(Error(\"x\"), Ok(57), mod10cmp) == (-1)\n\n Belt.Result.cmp(Error(\"x\"), Error(\"y\"), mod10cmp) == 0\n ```\n"}
1830-
}, {
1831-
"label": "Belt.Result.Ok",
1832-
"kind": 4,
1833-
"tags": [],
1834-
"detail": "Ok('a)\n\ntype t<'a, 'b> = Ok('a) | Error('b)",
1835-
"documentation": null
1836-
}, {
1837-
"label": "Belt.Result.Error",
1838-
"kind": 4,
1839-
"tags": [],
1840-
"detail": "Error('b)\n\ntype t<'a, 'b> = Ok('a) | Error('b)",
1841-
"documentation": null
18421758
}]
18431759

0 commit comments

Comments
 (0)