-
Notifications
You must be signed in to change notification settings - Fork 109
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
Add support for formatting ports #1474
Add support for formatting ports #1474
Conversation
147776b
to
0764fb0
Compare
@@ -292,6 +292,8 @@ format_spw(_Format, T) when is_float(T) -> | |||
erlang:float_to_list(T); | |||
format_spw(_Format, T) when is_pid(T) -> | |||
erlang:pid_to_list(T); | |||
format_spw(_Format, T) when is_port(T) -> | |||
erlang:port_to_list(T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much.
Could we have a test for this clause that passes on both BEAM and AtomVM?
open_port({spawn, "echo"}, [])
works on both platforms AFAIK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely, I should have thought to add tests... "echo" is what I have been using to test locally ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much. Could we have a test for this clause that passes on both BEAM and AtomVM?
The short answer is no. Lol! Any test that passes on the BEAM will fail on AtomVM until #1473 is merged. But I will write one that will make sure we are returning a list that matches the format that OTP returns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make 1474 a continuation of 1473 :-)
8ed6d86
to
68a1c78
Compare
Note: test_port_to_list should pass on OTP and fail on AtomVM until #1473 is merged. |
e866bd7
to
82d6f6d
Compare
a3f282e
to
ef9fa14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seem to fail even after merging #1473
Adds a missing clause to handle port terms in `memory_estimate_usage(term)` function that is necessary for formatting ports for io or other purposes. Signed-off-by: Winford <winford@object.stream>
057570e
to
0b270eb
Compare
Add support for io_lib (and io, etc...) to format ports. Adds port_to_list/1 to erlang module exports to keep dialyzer happy. Add test/erlang_tests/test_port_to_list.erl to test result of port_to_list/1 using the "echo" port. Signed-off-by: Winford <winford@object.stream>
0b270eb
to
b31dea1
Compare
Add support for io_lib (and io, etc...) to format ports.
Adds port_to_list/1 to erlang module exports to keep dialyzer happy.
Adds a missing clause to handle port terms in
memory_estimate_usage(term)
function that is necessary for formatting ports for io or other purposes.This is a continuation of #1473.
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later