Skip to content

Commit 3b93359

Browse files
authored
Get rid of \"@@" in tests (#7131)
1 parent 54c5459 commit 3b93359

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+274
-366
lines changed

tests/syntax_tests/data/idempotency/mareo/Director.res

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,7 @@ let update_loop = (canvas, (player, objs), map_dim) => {
498498
List.forEach(parts, part => run_update_particle(state, part))
499499
Draw.fps(canvas, fps)
500500
Draw.hud(canvas, state.score, state.coins)
501-
\"@@"(
502-
ignore,
501+
ignore(
503502
Dom_html.requestAnimationFrame((t: float) =>
504503
update_helper(t, state, player, collid_objs.contents, particles.contents)
505504
),

tests/syntax_tests/data/idempotency/mareo/Draw.res

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let render = (sprite, (posx, posy)) => {
2020
let sx = sx +. float_of_int(sprite.frame.contents) *. sw
2121
/* print_endline (string_of_int !(sprite.frame)); */
2222
/* context##clearRect(0.,0.,sw, sh); */
23-
\"@@"(ignore, context["drawImage"](sprite.img, sx, sy, sw, sh, dx, dy, dw, dh))
23+
ignore(context["drawImage"](sprite.img, sx, sy, sw, sh, dx, dy, dw, dh))
2424
}
2525

2626
/* Draws two background images, which needs to be done because of the
@@ -37,7 +37,7 @@ let clear_canvas = canvas => {
3737
let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d"))
3838
let cwidth = float_of_int(canvas["width"])
3939
let cheight = float_of_int(canvas["height"])
40-
\"@@"(ignore, context["clearRect"](0., 0., cwidth, cheight))
40+
ignore(context["clearRect"](0., 0., cwidth, cheight))
4141
}
4242

4343
/* Displays the text for score and coins. */
@@ -46,42 +46,41 @@ let hud = (canvas, score, coins) => {
4646
let coin_string = string_of_int(coins)
4747
let canvas = Dom_html.canvasElementToJsObj(canvas)
4848
let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d"))
49-
\"@@"(ignore, context["font"] = "10px 'Press Start 2P'")
50-
\"@@"(
51-
ignore,
49+
ignore(context["font"] = "10px 'Press Start 2P'")
50+
ignore(
5251
context["fillText"]("Score: " ++ score_string, float_of_int(canvas["width"]) -. 140., 18.),
5352
)
54-
\"@@"(ignore, context["fillText"]("Coins: " ++ coin_string, 120., 18.))
53+
ignore(context["fillText"]("Coins: " ++ coin_string, 120., 18.))
5554
}
5655

5756
/* Displays the fps. */
5857
let fps = (canvas, fps_val) => {
5958
let fps_str = int_of_float(fps_val) |> string_of_int
6059
let canvas = Dom_html.canvasElementToJsObj(canvas)
6160
let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d"))
62-
\"@@"(ignore, context["fillText"](fps_str, 10., 18.))
61+
ignore(context["fillText"](fps_str, 10., 18.))
6362
}
6463

6564
/* game_win displays a black screen when you finish a game. */
6665
let game_win = ctx => {
6766
let ctx = Dom_html.canvasRenderingContext2DToJsObj(ctx)
68-
\"@@"(ignore, ctx["rect"](0., 0., 512., 512.))
69-
\"@@"(ignore, ctx["fillStyle"] = "black")
70-
\"@@"(ignore, ctx["fill"]())
71-
\"@@"(ignore, ctx["fillStyle"] = "white")
72-
\"@@"(ignore, ctx["font"] = "20px 'Press Start 2P'")
73-
\"@@"(ignore, ctx["fillText"]("You win!", 180., 128.))
67+
ignore(ctx["rect"](0., 0., 512., 512.))
68+
ignore(ctx["fillStyle"] = "black")
69+
ignore(ctx["fill"]())
70+
ignore(ctx["fillStyle"] = "white")
71+
ignore(ctx["font"] = "20px 'Press Start 2P'")
72+
ignore(ctx["fillText"]("You win!", 180., 128.))
7473
failwith("Game over.")
7574
}
7675

7776
/* gave_loss displays a black screen stating a loss to finish that level play. */
7877
let game_loss = ctx => {
7978
let ctx = Dom_html.canvasRenderingContext2DToJsObj(ctx)
80-
\"@@"(ignore, ctx["rect"](0., 0., 512., 512.))
79+
ignore(ctx["rect"](0., 0., 512., 512.))
8180
ctx["fillStyle"] = "black"
82-
\"@@"(ignore, ctx["fill"]())
81+
ignore(ctx["fill"]())
8382
ctx["fillStyle"] = "white"
8483
ctx["font"] = "20px 'Press Start 2P'"
85-
\"@@"(ignore, ctx["fillText"]("GAME OVER. You lose!", 60., 128.))
84+
ignore(ctx["fillText"]("GAME OVER. You lose!", 60., 128.))
8685
failwith("Game over.")
8786
}

tests/syntax_tests/data/idempotency/reprocessing/Reprocessing.res

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,10 @@ let run = (
207207
)
208208
() => {
209209
let (x, y) = (0, 0)
210-
let (x1, y1) = (\"@@"(float_of_int, x + width), \"@@"(float_of_int, y))
211-
let (x2, y2) = (float_of_int(x), \"@@"(float_of_int, y))
212-
let (x3, y3) = (\"@@"(float_of_int, x + width), \"@@"(float_of_int, y + height))
213-
let (x4, y4) = (float_of_int(x), \"@@"(float_of_int, y + height))
210+
let (x1, y1) = (float_of_int(x + width), float_of_int(y))
211+
let (x2, y2) = (float_of_int(x), float_of_int(y))
212+
let (x3, y3) = (float_of_int(x + width), float_of_int(y + height))
213+
let (x4, y4) = (float_of_int(x), float_of_int(y + height))
214214
let verticesColorAndTexture = [
215215
x1,
216216
y1,
@@ -277,7 +277,7 @@ let run = (
277277
Reasongl.Gl.Window.setWindowSize(~window=env.window, ~width, ~height)
278278
}
279279
if fns.filename != "" {
280-
\"@@"(ignore, Reprocessing_Hotreload.checkRebuild(false, fns.filename))
280+
ignore(Reprocessing_Hotreload.checkRebuild(false, fns.filename))
281281
}
282282
if fns.justHotReloaded {
283283
let newInitialState = fns.setup(env)

tests/syntax_tests/data/idempotency/reprocessing/Reprocessing_Internal.res

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@ let getProgram = (
3232
if linkedCorrectly {
3333
Some(program)
3434
} else {
35-
\"@@"(print_endline, "Linking error: " ++ Gl.getProgramInfoLog(~context, program))
35+
print_endline("Linking error: " ++ Gl.getProgramInfoLog(~context, program))
3636
None
3737
}
3838
} else {
39-
\"@@"(
40-
print_endline,
39+
print_endline(
4140
"Fragment shader error: " ++ Gl.getShaderInfoLog(~context, fragmentShader),
4241
)
4342
None
4443
}
4544
} else {
46-
\"@@"(print_endline, "Vertex shader error: " ++ Gl.getShaderInfoLog(~context, vertexShader))
45+
print_endline("Vertex shader error: " ++ Gl.getShaderInfoLog(~context, vertexShader))
4746
None
4847
}
4948
}

tests/tests/src/arity_deopt.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ function f3(x) {
4141
return (y, z) => (x + y | 0) + z | 0;
4242
}
4343

44-
eq("File \"arity_deopt.res\", line 50, characters 11-18", 6, 6);
44+
eq("File \"arity_deopt.res\", line 50, characters 6-13", 6, 6);
4545

46-
eq("File \"arity_deopt.res\", line 51, characters 11-18", 6, 6);
46+
eq("File \"arity_deopt.res\", line 51, characters 6-13", 6, 6);
4747

48-
eq("File \"arity_deopt.res\", line 52, characters 11-18", 6, 6);
48+
eq("File \"arity_deopt.res\", line 52, characters 6-13", 6, 6);
4949

50-
eq("File \"arity_deopt.res\", line 53, characters 11-18", 6, 6);
50+
eq("File \"arity_deopt.res\", line 53, characters 6-13", 6, 6);
5151

5252
Mt.from_pair_suites("Arity_deopt", suites.contents);
5353

tests/tests/src/arity_deopt.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ let f3 = x => {
4747
So the best is never shrink functons which could change arity
4848
*/
4949
let () = {
50-
\"@@"(eq(__LOC__, 6, ...), f0(1, 2, 3))
51-
\"@@"(eq(__LOC__, 6, ...), f1(1)(2, 3))
52-
\"@@"(eq(__LOC__, 6, ...), f2(1, 2)(3))
53-
\"@@"(eq(__LOC__, 6, ...), f3(1)(2, 3))
50+
(eq(__LOC__, 6, ...))(f0(1, 2, 3))
51+
(eq(__LOC__, 6, ...))(f1(1)(2, 3))
52+
(eq(__LOC__, 6, ...))(f2(1, 2)(3))
53+
(eq(__LOC__, 6, ...))(f3(1)(2, 3))
5454
}
5555
let () = Mt.from_pair_suites(__MODULE__, suites.contents)

tests/tests/src/array_subtle_test.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let () = {
2929

3030
let () = {
3131
while Js.Array2.length(v) > 0 {
32-
\"@@"(ignore, Js.Array2.pop(v))
32+
ignore(Js.Array2.pop(v))
3333
}
3434
eq(__LOC__, (0, Js.Array2.length(v)))
3535
}
@@ -39,7 +39,7 @@ let f = v => {
3939
| Some(x) => Js.log("hi")
4040
| None => Js.log("hi2")
4141
}
42-
Js.log(\"@@"(ignore, Js.Array2.pop(v)))
42+
Js.log(ignore(Js.Array2.pop(v)))
4343
}
4444

4545
let fff = x => Array.length(x) >= 0

tests/tests/src/bs_array_test.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ let () = {
287287
eq(__LOC__, sumUsingForEach([0, 1, 2, 3, 4]), 10)
288288
b(__LOC__, !A.every([0, 1, 2, 3, 4], x => x > 2))
289289
b(__LOC__, A.some([1, 3, 7, 8], x => mod(x, 2) == 0))
290-
b(__LOC__, \"@@"(not, A.some([1, 3, 7], x => mod(x, 2) == 0)))
291-
b(__LOC__, \"@@"(not, A.eq([0, 1], [1], \"=")))
290+
b(__LOC__, !A.some([1, 3, 7], x => mod(x, 2) == 0))
291+
b(__LOC__, !A.eq([0, 1], [1], \"="))
292292
b(
293293
__LOC__,
294294
{

0 commit comments

Comments
 (0)