Skip to content

Commit e71a29e

Browse files
committed
fix For.describe bindings
introduced by #28 they shouldn't pass textCtx
1 parent 7b436a5 commit e71a29e

2 files changed

Lines changed: 74 additions & 8 deletions

File tree

src/Vitest.res

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ module type ForType = {
879879
~only: bool=?,
880880
~todo: bool=?,
881881
~fails: bool=?,
882-
('a, testCtx) => unit,
882+
'a => unit,
883883
) => unit
884884
let describeAsync: (
885885
array<'a>,
@@ -893,7 +893,7 @@ module type ForType = {
893893
~only: bool=?,
894894
~todo: bool=?,
895895
~fails: bool=?,
896-
('a, testCtx) => promise<unit>,
896+
'a => promise<unit>,
897897
) => unit
898898

899899
let test: (
@@ -974,11 +974,7 @@ module For: ForType = {
974974
external describeObj: (
975975
~describe: describe,
976976
~cases: array<'a>,
977-
) => (
978-
~name: string,
979-
~options: testCollectorOptions,
980-
~f: @uncurry ('a, testCtx) => unit,
981-
) => unit = "for"
977+
) => (~name: string, ~options: testCollectorOptions, ~f: @uncurry ('a => unit)) => unit = "for"
982978

983979
@send
984980
external describeObjAsync: (
@@ -987,7 +983,7 @@ module For: ForType = {
987983
) => (
988984
~name: string,
989985
~options: testCollectorOptions,
990-
~f: @uncurry ('a, testCtx) => promise<unit>,
986+
~f: @uncurry ('a => promise<unit>),
991987
) => unit = "for"
992988

993989
@send

tests/for.test.res

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,73 @@ sum5->For.itAsync("itAsync: sum %i+%i+%i+%i=%s", async ((a, b, c, d, sum), t) =>
105105
t->expect((a + b + c + d)->Js.Int.toString)->Expect.toBe(sum)
106106
t->expect((a + b + c + d + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
107107
})
108+
109+
sumObj->For.describe("sum $a+$b=$sum", i => {
110+
test("inner test", t => {
111+
t->expect(i["a"] + i["b"])->Expect.toBe(i["sum"])
112+
t->expect(i["a"] + i["b"] + 1)->Expect.not->Expect.toBe(i["sum"])
113+
})
114+
})
115+
116+
sum2->For.describe("%i=%s", ((a, b)) => {
117+
test("inner test", t => {
118+
t->expect(a->Js.Int.toString)->Expect.toBe(b)
119+
t->expect((a + 1)->Js.Int.toString)->Expect.not->Expect.toBe(b)
120+
})
121+
})
122+
123+
sum3->For.describe("sum %i+%i=%s", ((a, b, sum)) => {
124+
test("inner test", t => {
125+
t->expect((a + b)->Js.Int.toString)->Expect.toBe(sum)
126+
t->expect((a + b + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
127+
})
128+
})
129+
130+
sum4->For.describe("sum %i+%i+%i=%s", ((a, b, c, sum)) => {
131+
test("inner test", t => {
132+
t->expect((a + b + c)->Js.Int.toString)->Expect.toBe(sum)
133+
t->expect((a + b + c + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
134+
})
135+
})
136+
137+
sum5->For.describe("sum %i+%i+%i+%i=%s", ((a, b, c, d, sum)) => {
138+
test("inner test", t => {
139+
t->expect((a + b + c + d)->Js.Int.toString)->Expect.toBe(sum)
140+
t->expect((a + b + c + d + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
141+
})
142+
})
143+
144+
sumObj->For.describeAsync("sum $a+$b=$sum", async i => {
145+
test("inner test", t => {
146+
t->expect(i["a"] + i["b"])->Expect.toBe(i["sum"])
147+
t->expect(i["a"] + i["b"] + 1)->Expect.not->Expect.toBe(i["sum"])
148+
})
149+
})
150+
151+
sum2->For.describeAsync("%i=%s", async ((a, b)) => {
152+
test("inner test", t => {
153+
t->expect(a->Js.Int.toString)->Expect.toBe(b)
154+
t->expect((a + 1)->Js.Int.toString)->Expect.not->Expect.toBe(b)
155+
})
156+
})
157+
158+
sum3->For.describeAsync("sum %i+%i=%s", async ((a, b, sum)) => {
159+
test("inner test", t => {
160+
t->expect((a + b)->Js.Int.toString)->Expect.toBe(sum)
161+
t->expect((a + b + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
162+
})
163+
})
164+
165+
sum4->For.describeAsync("sum %i+%i+%i=%s", async ((a, b, c, sum)) => {
166+
test("inner test", t => {
167+
t->expect((a + b + c)->Js.Int.toString)->Expect.toBe(sum)
168+
t->expect((a + b + c + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
169+
})
170+
})
171+
172+
sum5->For.describeAsync("sum %i+%i+%i+%i=%s", async ((a, b, c, d, sum)) => {
173+
test("inner test", t => {
174+
t->expect((a + b + c + d)->Js.Int.toString)->Expect.toBe(sum)
175+
t->expect((a + b + c + d + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
176+
})
177+
})

0 commit comments

Comments
 (0)