Skip to content

Commit 02f7602

Browse files
test(stdlib): refresh HTTP socket input
The HTTP fixture also emits the shared TCP SocketInput module. Refresh its intended output so it records the new caller-buffer read behavior instead of the removed unsupported error. The exact sys_http_basic snapshot passes locally with a bounded 240-second fixture cap. This follow-up addresses the sole mismatch from CI run 33551313513.
1 parent 16d4954 commit 02f7602

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

test/snapshot/stdlib/sys_http_basic/intended/_GeneratedFiles.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"haxe/_call_stack/call_stack_impl_.ex"
3737
],
3838
"protocol": "reflaxe-elixir/generated-output",
39-
"id": 4,
39+
"id": 0,
4040
"wasCached": false,
4141
"version": 2,
4242
"ownedFiles": [
@@ -154,7 +154,7 @@
154154
},
155155
{
156156
"path": "sys/net/_socket/socket_input.ex",
157-
"sha256": "be925359a2bd795ec85b0d8391ccbedb154d818c2ec784e7acb5dc019c558bdc"
157+
"sha256": "b937fd5345e22b4950dcd03d037a20c03fe79ae85a3dcc727a17ce244a70b786"
158158
},
159159
{
160160
"path": "sys/net/_socket/socket_output.ex",
@@ -177,5 +177,5 @@
177177
"sha256": "7050c5def57907bbb793022fe8e1bf8d07865bcab165fff31af4e14b05bbab2b"
178178
}
179179
],
180-
"generation": "a0a57f59e8e18b227c0c000ca517a3c3f51cff5c01cd29ed5d56a3cfcdaedaf9"
180+
"generation": "231d37bc270fb9d989d8286898bb89c1c9882aacb43270e313fd76e5feb38243"
181181
}

test/snapshot/stdlib/sys_http_basic/intended/sys/net/_socket/socket_input.ex

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,26 @@ defmodule SocketInput do
1717
end
1818
:binary.at(result, 0)
1919
end
20-
def read_bytes(_struct, buf, pos, len) do
20+
def read_bytes(struct, buf, pos, len) do
2121
if (pos < 0 or len < 0 or pos + len > buf.length) do
2222
raise Reflaxe.Elixir.HaxeThrow, [value: {:outside_bounds}]
2323
end
2424
if (len == 0) do
2525
0
2626
else
27-
raise Reflaxe.Elixir.HaxeThrow, [value: {:custom, "sys.net.Socket.input.readBytes is not supported on the Elixir target because haxe.io.Bytes buffers are immutable in generated Elixir; use Socket.read() or Input.readByte() instead"}]
27+
result = SocketState.recv_binary(struct.socket_ref, len)
28+
if (SocketState.is_blocked(result)) do
29+
raise Reflaxe.Elixir.HaxeThrow, [value: {:blocked}]
30+
end
31+
if (SocketState.is_eof(result)) do
32+
raise Reflaxe.Elixir.HaxeThrow, [value: Eof.new()]
33+
end
34+
if (SocketState.is_error(result)) do
35+
raise Reflaxe.Elixir.HaxeThrow, [value: {:custom, SocketState.error_message(result)}]
36+
end
37+
received = Bytes.of_data(result)
38+
apply(Map.get(buf, :__reflaxe_class__) || Map.get(buf, :__struct__), :blit, [buf, pos, received, 0, received.length])
39+
received.length
2840
end
2941
end
3042
def set_big_endian(struct, b) do

0 commit comments

Comments
 (0)