Skip to content

Get rid of \"@@" in tests #7131

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

Merged
merged 1 commit into from
Oct 26, 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
3 changes: 1 addition & 2 deletions tests/syntax_tests/data/idempotency/mareo/Director.res
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,7 @@ let update_loop = (canvas, (player, objs), map_dim) => {
List.forEach(parts, part => run_update_particle(state, part))
Draw.fps(canvas, fps)
Draw.hud(canvas, state.score, state.coins)
\"@@"(
ignore,
ignore(
Dom_html.requestAnimationFrame((t: float) =>
update_helper(t, state, player, collid_objs.contents, particles.contents)
),
Expand Down
31 changes: 15 additions & 16 deletions tests/syntax_tests/data/idempotency/mareo/Draw.res
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let render = (sprite, (posx, posy)) => {
let sx = sx +. float_of_int(sprite.frame.contents) *. sw
/* print_endline (string_of_int !(sprite.frame)); */
/* context##clearRect(0.,0.,sw, sh); */
\"@@"(ignore, context["drawImage"](sprite.img, sx, sy, sw, sh, dx, dy, dw, dh))
ignore(context["drawImage"](sprite.img, sx, sy, sw, sh, dx, dy, dw, dh))
}

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

/* Displays the text for score and coins. */
Expand All @@ -46,42 +46,41 @@ let hud = (canvas, score, coins) => {
let coin_string = string_of_int(coins)
let canvas = Dom_html.canvasElementToJsObj(canvas)
let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d"))
\"@@"(ignore, context["font"] = "10px 'Press Start 2P'")
\"@@"(
ignore,
ignore(context["font"] = "10px 'Press Start 2P'")
ignore(
context["fillText"]("Score: " ++ score_string, float_of_int(canvas["width"]) -. 140., 18.),
)
\"@@"(ignore, context["fillText"]("Coins: " ++ coin_string, 120., 18.))
ignore(context["fillText"]("Coins: " ++ coin_string, 120., 18.))
}

/* Displays the fps. */
let fps = (canvas, fps_val) => {
let fps_str = int_of_float(fps_val) |> string_of_int
let canvas = Dom_html.canvasElementToJsObj(canvas)
let context = Dom_html.canvasRenderingContext2DToJsObj(canvas["getContext"]("2d"))
\"@@"(ignore, context["fillText"](fps_str, 10., 18.))
ignore(context["fillText"](fps_str, 10., 18.))
}

/* game_win displays a black screen when you finish a game. */
let game_win = ctx => {
let ctx = Dom_html.canvasRenderingContext2DToJsObj(ctx)
\"@@"(ignore, ctx["rect"](0., 0., 512., 512.))
\"@@"(ignore, ctx["fillStyle"] = "black")
\"@@"(ignore, ctx["fill"]())
\"@@"(ignore, ctx["fillStyle"] = "white")
\"@@"(ignore, ctx["font"] = "20px 'Press Start 2P'")
\"@@"(ignore, ctx["fillText"]("You win!", 180., 128.))
ignore(ctx["rect"](0., 0., 512., 512.))
ignore(ctx["fillStyle"] = "black")
ignore(ctx["fill"]())
ignore(ctx["fillStyle"] = "white")
ignore(ctx["font"] = "20px 'Press Start 2P'")
ignore(ctx["fillText"]("You win!", 180., 128.))
failwith("Game over.")
}

/* gave_loss displays a black screen stating a loss to finish that level play. */
let game_loss = ctx => {
let ctx = Dom_html.canvasRenderingContext2DToJsObj(ctx)
\"@@"(ignore, ctx["rect"](0., 0., 512., 512.))
ignore(ctx["rect"](0., 0., 512., 512.))
ctx["fillStyle"] = "black"
\"@@"(ignore, ctx["fill"]())
ignore(ctx["fill"]())
ctx["fillStyle"] = "white"
ctx["font"] = "20px 'Press Start 2P'"
\"@@"(ignore, ctx["fillText"]("GAME OVER. You lose!", 60., 128.))
ignore(ctx["fillText"]("GAME OVER. You lose!", 60., 128.))
failwith("Game over.")
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ let run = (
)
() => {
let (x, y) = (0, 0)
let (x1, y1) = (\"@@"(float_of_int, x + width), \"@@"(float_of_int, y))
let (x2, y2) = (float_of_int(x), \"@@"(float_of_int, y))
let (x3, y3) = (\"@@"(float_of_int, x + width), \"@@"(float_of_int, y + height))
let (x4, y4) = (float_of_int(x), \"@@"(float_of_int, y + height))
let (x1, y1) = (float_of_int(x + width), float_of_int(y))
let (x2, y2) = (float_of_int(x), float_of_int(y))
let (x3, y3) = (float_of_int(x + width), float_of_int(y + height))
let (x4, y4) = (float_of_int(x), float_of_int(y + height))
let verticesColorAndTexture = [
x1,
y1,
Expand Down Expand Up @@ -277,7 +277,7 @@ let run = (
Reasongl.Gl.Window.setWindowSize(~window=env.window, ~width, ~height)
}
if fns.filename != "" {
\"@@"(ignore, Reprocessing_Hotreload.checkRebuild(false, fns.filename))
ignore(Reprocessing_Hotreload.checkRebuild(false, fns.filename))
}
if fns.justHotReloaded {
let newInitialState = fns.setup(env)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,17 @@ let getProgram = (
if linkedCorrectly {
Some(program)
} else {
\"@@"(print_endline, "Linking error: " ++ Gl.getProgramInfoLog(~context, program))
print_endline("Linking error: " ++ Gl.getProgramInfoLog(~context, program))
None
}
} else {
\"@@"(
print_endline,
print_endline(
"Fragment shader error: " ++ Gl.getShaderInfoLog(~context, fragmentShader),
)
None
}
} else {
\"@@"(print_endline, "Vertex shader error: " ++ Gl.getShaderInfoLog(~context, vertexShader))
print_endline("Vertex shader error: " ++ Gl.getShaderInfoLog(~context, vertexShader))
None
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/tests/src/arity_deopt.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ function f3(x) {
return (y, z) => (x + y | 0) + z | 0;
}

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

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

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

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

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

Expand Down
8 changes: 4 additions & 4 deletions tests/tests/src/arity_deopt.res
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,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)
4 changes: 2 additions & 2 deletions tests/tests/src/array_subtle_test.res
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let () = {

let () = {
while Js.Array2.length(v) > 0 {
\"@@"(ignore, Js.Array2.pop(v))
ignore(Js.Array2.pop(v))
}
eq(__LOC__, (0, Js.Array2.length(v)))
}
Expand All @@ -39,7 +39,7 @@ let f = v => {
| Some(x) => Js.log("hi")
| None => Js.log("hi2")
}
Js.log(\"@@"(ignore, Js.Array2.pop(v)))
Js.log(ignore(Js.Array2.pop(v)))
}

let fff = x => Array.length(x) >= 0
Expand Down
4 changes: 2 additions & 2 deletions tests/tests/src/bs_array_test.res
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ let () = {
eq(__LOC__, sumUsingForEach([0, 1, 2, 3, 4]), 10)
b(__LOC__, !A.every([0, 1, 2, 3, 4], x => x > 2))
b(__LOC__, A.some([1, 3, 7, 8], x => mod(x, 2) == 0))
b(__LOC__, \"@@"(not, A.some([1, 3, 7], x => mod(x, 2) == 0)))
b(__LOC__, \"@@"(not, A.eq([0, 1], [1], \"=")))
b(__LOC__, !A.some([1, 3, 7], x => mod(x, 2) == 0))
b(__LOC__, !A.eq([0, 1], [1], \"="))
b(
__LOC__,
{
Expand Down
Loading