aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2022-08-10 08:58:21 +0100
committerLouis Pilfold <louis@lpil.uk>2022-08-10 08:58:21 +0100
commit3fba785183210dd935a99632a653302e6f832ba4 (patch)
treeaf69fffb72709f87b9fbc4909867432db56f283d /test
parent95425ffdc5407e9ec60efed9b8d4fa7c1fdfb764 (diff)
downloadgleam_stdlib-3fba785183210dd935a99632a653302e6f832ba4.tar.gz
gleam_stdlib-3fba785183210dd935a99632a653302e6f832ba4.zip
Use different syntax for improper lists
Diffstat (limited to 'test')
-rw-r--r--test/gleam/string_test.gleam9
-rw-r--r--test/gleam_stdlib_test_ffi.erl5
2 files changed, 13 insertions, 1 deletions
diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam
index 46b5e91..acc00d7 100644
--- a/test/gleam/string_test.gleam
+++ b/test/gleam/string_test.gleam
@@ -792,3 +792,12 @@ if erlang {
|> should.equal("\"abc\"")
}
}
+
+pub fn improper_list_inspect_test() {
+ let list = improper_list_append(1, 2)
+ assert "[1, ...2]" = string.inspect(list)
+}
+
+// Warning: The type of this function is incorrect
+external fn improper_list_append(anything1, anything2) -> 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 6be4cb6..c26a879 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
+ should_be_error/1, improper_list_append/2
]).
-include_lib("eunit/include/eunit.hrl").
@@ -38,3 +38,6 @@ should_be_ok(A) ->
should_be_error(A) ->
?assertMatch({error, _}, A),
nil.
+
+improper_list_append(X, Y) ->
+ [X | Y].