Hi!
I’m trying Deno and wanted to write some tests, so I wrote some bindings. When I write my test though, the function seems to be curried with the two parameters it needs, but it looks like it isn’t called and my output doesn’t show
I read the docs to see what I was missing, besides the uncurried syntax with .
which I’d like to avoid because it is very ugly, it mentions @uncurry
which I tried but it did nothing.
Here is the code sample (and a playground link)
module Test = {
@scope("Deno") @val
external test: (string, @uncurry unit => unit) => unit = "test"
@scope("Deno") @val
external testAsync: (string, @uncurry unit => Js.Promise.t<unit>) => unit =
"test"
@module("https://deno.land/std@0.97.0/testing/asserts.ts")
external assertTrue: (bool, string) => unit = "assert"
type testFunctions = {
test: (string, unit => unit) => unit,
testAsync: (string, unit => Js.Promise.t<unit>) => unit,
}
let suite = (scope: string, testFn: testFunctions => unit): unit => {
let testFns: testFunctions = {
test: (subject, fn) => test(`${scope}: ${subject}`, fn),
testAsync: (subject, fn) => testAsync(`${scope}: ${subject}`, fn),
}
testFn(testFns)->ignore
}
}
module Something = {
let tests = Test.suite("Something", ({test}) => {
test("a test", () => {
Js.log("Hello?")
Test.assertTrue(false, "assert")
})
})
}
Does anyone know what I’m tripping against here? I’ve been trying rescript for a while and it is the first time this has happened to me despite never using the uncurried function syntax.
Thanks!