File tree Expand file tree Collapse file tree 1 file changed +25
-8
lines changed Expand file tree Collapse file tree 1 file changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -200,14 +200,31 @@ defmodule ElixirLS.DebugAdapter.VariablesTest do
200200 end
201201
202202 test "port" do
203- children = Variables . children ( hd ( :erlang . ports ( ) ) , 0 , 10 )
204-
205- case :os . type ( ) do
206- { :win32 , _ } ->
207- assert children [ :name ] == ~c" 2/2"
208-
209- _ ->
210- assert children [ :name ] == ~c" forker"
203+ # Create our own port for testing instead of relying on system ports
204+ # which may have non-deterministic ordering
205+ # Use a simple command that exists on all platforms
206+ command =
207+ case :os . type ( ) do
208+ { :win32 , _ } -> ~c" cmd"
209+ _ -> ~c" cat"
210+ end
211+
212+ port = :erlang . open_port ( { :spawn , command } , [ :binary ] )
213+
214+ try do
215+ children = Variables . children ( port , 0 , 10 )
216+
217+ # Verify we can extract port info - the specific name may vary by OS
218+ # but it should be a charlist matching our command
219+ assert children [ :name ] == command
220+ assert is_list ( children [ :name ] )
221+ assert Enum . all? ( children [ :name ] , & is_integer / 1 )
222+
223+ # Verify other common port info fields exist
224+ assert is_integer ( children [ :id ] )
225+ assert is_pid ( children [ :connected ] )
226+ after
227+ Port . close ( port )
211228 end
212229 end
213230 end
You can’t perform that action at this time.
0 commit comments