Skip to content
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

Make tests uncurried-ready. #6862

Merged
merged 2 commits into from
Jul 8, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
- Convert `js.ml` files to `.res`. https://github.com/rescript-lang/rescript-compiler/pull/6835
- Remove old `.ml` tests. https://github.com/rescript-lang/rescript-compiler/pull/6847
- Make compiler libs ready for uncurried mode. https://github.com/rescript-lang/rescript-compiler/pull/6861
- Make tests ready for uncurried mode. https://github.com/rescript-lang/rescript-compiler/pull/6862

#### :nail_care: Polish

Expand Down
12 changes: 6 additions & 6 deletions jscomp/test/UntaggedVariants.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions jscomp/test/UntaggedVariants.res
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ module Arr = {

let classify = async (a: arr) =>
switch a {
| Array(arr) => Js.log(arr->Belt.Array.joinWith("-"))
| Array(arr) => Js.log(arr->Belt.Array.joinWith("-", x => x))
| String(s) => Js.log(s)
| Promise(p) => Js.log(await p)
| Object({userName}) => Js.log(userName)
Expand Down Expand Up @@ -408,7 +408,7 @@ module AllInstanceofTypes = {
| Object({userName}) => Js.log(userName)
| Date(date) => Js.log(date->Js.Date.toString)
| RegExp(re) => Js.log(re->Js.Re.test_("test"))
| Array(arr) => Js.log(arr->Belt.Array.joinWith("-"))
| Array(arr) => Js.log(arr->Belt.Array.joinWith("-", x => x))
| File(file) => Js.log(file->fileName)
| Blob(blob) => Js.log(blob->blobSize)
}
Expand Down
4 changes: 2 additions & 2 deletions jscomp/test/a_filename_test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jscomp/test/a_filename_test.res
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let eq = (loc, x, y) => {
list{(loc ++ (" id " ++ string_of_int(test_id.contents)), _ => Mt.Eq(x, y)), ...suites.contents}
}

let test = Ext_filename_test.node_relative_path(true)
let test = (x,y) => Ext_filename_test.node_relative_path(true, x, y)
let () = /* TODO: adapt these tests to run on Windows. */
if platform !== #win32 {
eq(
Expand Down
13 changes: 5 additions & 8 deletions jscomp/test/ari_regress_test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions jscomp/test/ari_regress_test.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let f = x => \"+"(x)
let g = f(3, 4)
let f = x => \"+"(x, ...)
let g = f(3)(4)

let h = ref(0)

Expand All @@ -13,9 +13,9 @@ let g1 = (x, y) => {
let () = incr(h)
(xx, yy) => xx + yy + u
}
let x = gg(3, 5, 6)
let x = gg(3, 5)(6)

let v = g1(3, 4, 6)
let v = g1(3, 4)(6, _)

let suites = {
open Mt
Expand All @@ -32,7 +32,7 @@ let suites = {
),
),
("curry3", _ => Eq(x, 14)),
(__LOC__, _ => Eq(h.contents, 1)),
(__LOC__, _ => Eq(h.contents, 2)),
}
}

Expand Down
8 changes: 4 additions & 4 deletions jscomp/test/arity_deopt.res
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ let f3 = x => {
So the best is never shrink functons which could change arity
*/
let () = {
\"@@"(eq(__LOC__, 6), f0(. 1, 2, 3))
\"@@"(eq(__LOC__, 6), f1(1)(. 2, 3))
\"@@"(eq(__LOC__, 6), f2(. 1, 2)(3))
\"@@"(eq(__LOC__, 6), f3(1)(. 2, 3))
\"@@"(eq(__LOC__, 6, ...), f0(. 1, 2, 3))
\"@@"(eq(__LOC__, 6, ...), f1(1)(. 2, 3))
\"@@"(eq(__LOC__, 6, ...), f2(. 1, 2)(3))
\"@@"(eq(__LOC__, 6, ...), f3(1)(. 2, 3))
}
let () = Mt.from_pair_suites(__MODULE__, suites.contents)
2 changes: 1 addition & 1 deletion jscomp/test/async_inline.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jscomp/test/async_inline.res
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ type callback<'input, 'output> = 'input => 'output
external useCallback: (@uncurry ('input => 'output)) => callback<'input, 'output> = "useCallback"

let onSubmit = () =>
useCallback(async (_a, b) => {
useCallback(async b => {
await b
})
78 changes: 37 additions & 41 deletions jscomp/test/bigint_test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions jscomp/test/bigint_test.res
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let (test_id, suites) = (ref(0), ref(list{}))
let eq = loc => Mt_global.collect_eq(test_id, suites, loc)
let approx = loc => Mt_global.collect_approx(test_id, suites, loc)
let eq = (loc, x, y) => Mt_global.collect_eq(test_id, suites, loc, x, y)
let approx = (loc, x, y) => Mt_global.collect_approx(test_id, suites, loc, x, y)

let bigint_compare = (x: bigint, y) => Pervasives.compare(x, y)
let generic_compare = Pervasives.compare
Expand Down
6 changes: 3 additions & 3 deletions jscomp/test/bs_abstract_test.res
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ type u = {
y1: (int, int) => int,
}

let uf = u => u->y0Get(1)
let uf1 = u => u->y1Get(1)
let uf2 = u => u->y1Get(1, 2)
let uf = u => y0Get(u)(1)
let uf1 = u => y1Get(u)(1, ...)
let uf2 = u => y1Get(u)(1, 2)

@deriving(abstract)
type u1 = {
Expand Down
2 changes: 1 addition & 1 deletion jscomp/test/bs_abstract_test.resi
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ and x = private {
let f: x
type u
let uf: u => int
let uf1: (u, int) => int
let uf1: u => int => int
let uf2: u => int

type u1
Expand Down
Loading