diff options
author | inoas <mail@inoas.com> | 2022-08-10 15:14:52 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-08-11 09:56:08 +0100 |
commit | a974efd66ed4904ce7c9cabc38c3ec0563715b8f (patch) | |
tree | f8c9b868ae82fd532e713876f28a313063b44b39 /test | |
parent | 81c7284468739bc64a65527d126f54fd8dff4120 (diff) | |
download | gleam_stdlib-a974efd66ed4904ce7c9cabc38c3ec0563715b8f.tar.gz gleam_stdlib-a974efd66ed4904ce7c9cabc38c3ec0563715b8f.zip |
//erl[1,2|3] output for inspecting improper Erlang lists
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/string_test.gleam | 10 | ||||
-rw-r--r-- | test/gleam_stdlib_test_ffi.erl | 14 |
2 files changed, 14 insertions, 10 deletions
diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam index 0637bdd..7c83c84 100644 --- a/test/gleam/string_test.gleam +++ b/test/gleam/string_test.gleam @@ -795,11 +795,15 @@ if erlang { if erlang { pub fn improper_list_inspect_test() { - let list = improper_list_append(1, 2) - assert "[1, ..2]" = string.inspect(list) + let list = improper_list_append(1, 2, 3) + assert "//erl[1,2|3] %% improper list" = string.inspect(list) } // Warning: The type of this function is incorrect - external fn improper_list_append(anything1, anything2) -> List(anything) = + external fn improper_list_append( + anything1, + anything2, + anything3, + ) -> List(anything) = "gleam_stdlib_test_ffi" "improper_list_append" } diff --git a/test/gleam_stdlib_test_ffi.erl b/test/gleam_stdlib_test_ffi.erl index c26a879..c34cb5e 100644 --- a/test/gleam_stdlib_test_ffi.erl +++ b/test/gleam_stdlib_test_ffi.erl @@ -2,7 +2,7 @@ -export([ main/0, should_equal/2, should_not_equal/2, should_be_ok/1, - should_be_error/1, improper_list_append/2 + should_be_error/1, improper_list_append/3 ]). -include_lib("eunit/include/eunit.hrl"). @@ -26,18 +26,18 @@ filepath_to_module(Path0) -> Path5 = list_to_binary(Path4), binary_to_atom(Path5). -should_equal(Actual, Expected) -> +should_equal(Actual, Expected) -> ?assertEqual(Expected, Actual), nil. -should_not_equal(Actual, Expected) -> +should_not_equal(Actual, Expected) -> ?assertNotEqual(Expected, Actual), nil. -should_be_ok(A) -> +should_be_ok(A) -> ?assertMatch({ok, _}, A), nil. -should_be_error(A) -> +should_be_error(A) -> ?assertMatch({error, _}, A), nil. -improper_list_append(X, Y) -> - [X | Y]. +improper_list_append(X, Y, Z) -> + [X, Y | Z]. |