From 94884702d83c7f9e246f8e8bad0dacfb9a381b91 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Sun, 8 Aug 2021 19:26:04 +0100 Subject: Switch to upper case type names As suggested by Louis Pilfold. As Gleam generally uses upper case. Also adjust the string handling so that we don't return an error saying 'BitString'. Use 'String' instead of 'binary' as we want to lean towards Gleam terminology instead of exposing the underlying erlang names. --- test/gleam/dynamic_test.gleam | 64 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'test') diff --git a/test/gleam/dynamic_test.gleam b/test/gleam/dynamic_test.gleam index 8f90635..5f6ae21 100644 --- a/test/gleam/dynamic_test.gleam +++ b/test/gleam/dynamic_test.gleam @@ -26,12 +26,12 @@ if erlang { 1 |> dynamic.from |> dynamic.bit_string - |> should.equal(Error(DecodeError(expected: "bit_string", found: "int"))) + |> should.equal(Error(DecodeError(expected: "BitString", found: "Int"))) [] |> dynamic.from |> dynamic.bit_string - |> should.equal(Error(DecodeError(expected: "bit_string", found: "list"))) + |> should.equal(Error(DecodeError(expected: "BitString", found: "List"))) } pub fn string_test() { @@ -48,17 +48,17 @@ if erlang { <<65535:16>> |> dynamic.from |> dynamic.string - |> should.equal(Error(DecodeError(expected: "string", found: "bit_string"))) + |> should.equal(Error(DecodeError(expected: "String", found: "BitString"))) 1 |> dynamic.from |> dynamic.string - |> should.equal(Error(DecodeError(expected: "bit_string", found: "int"))) + |> should.equal(Error(DecodeError(expected: "String", found: "Int"))) [] |> dynamic.from |> dynamic.string - |> should.equal(Error(DecodeError(expected: "bit_string", found: "list"))) + |> should.equal(Error(DecodeError(expected: "String", found: "List"))) } pub fn int_test() { @@ -75,12 +75,12 @@ if erlang { 1.0 |> dynamic.from |> dynamic.int - |> should.equal(Error(DecodeError(expected: "int", found: "float"))) + |> should.equal(Error(DecodeError(expected: "Int", found: "Float"))) [] |> dynamic.from |> dynamic.int - |> should.equal(Error(DecodeError(expected: "int", found: "list"))) + |> should.equal(Error(DecodeError(expected: "Int", found: "List"))) } pub fn float_test() { @@ -97,12 +97,12 @@ if erlang { 1 |> dynamic.from |> dynamic.float - |> should.equal(Error(DecodeError(expected: "float", found: "int"))) + |> should.equal(Error(DecodeError(expected: "Float", found: "Int"))) [] |> dynamic.from |> dynamic.float - |> should.equal(Error(DecodeError(expected: "float", found: "list"))) + |> should.equal(Error(DecodeError(expected: "Float", found: "List"))) } pub fn thunk_test() { @@ -147,12 +147,12 @@ if erlang { 1 |> dynamic.from |> dynamic.bool - |> should.equal(Error(DecodeError(expected: "bool", found: "int"))) + |> should.equal(Error(DecodeError(expected: "Bool", found: "Int"))) [] |> dynamic.from |> dynamic.bool - |> should.equal(Error(DecodeError(expected: "bool", found: "list"))) + |> should.equal(Error(DecodeError(expected: "Bool", found: "List"))) } pub fn typed_list_test() { @@ -306,7 +306,7 @@ if erlang { 1 |> dynamic.from |> dynamic.tuple2 - |> should.equal(Error(DecodeError(expected: "2 element tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "2 element tuple", found: "Int"))) } pub fn typed_tuple2_test() { @@ -323,7 +323,7 @@ if erlang { #(1, "") |> dynamic.from |> dynamic.typed_tuple2(dynamic.int, dynamic.int) - |> should.equal(Error(DecodeError(expected: "int", found: "binary"))) + |> should.equal(Error(DecodeError(expected: "Int", found: "String"))) #(1, 2, 3) |> dynamic.from @@ -336,7 +336,7 @@ if erlang { 1 |> dynamic.from |> dynamic.typed_tuple2(dynamic.int, dynamic.int) - |> should.equal(Error(DecodeError(expected: "2 element tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "2 element tuple", found: "Int"))) } pub fn tuple3_test() { @@ -361,7 +361,7 @@ if erlang { 1 |> dynamic.from |> dynamic.tuple3 - |> should.equal(Error(DecodeError(expected: "3 element tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "3 element tuple", found: "Int"))) } pub fn typed_tuple3_test() { @@ -378,7 +378,7 @@ if erlang { #(1, 2, "") |> dynamic.from |> dynamic.typed_tuple3(dynamic.int, dynamic.int, dynamic.int) - |> should.equal(Error(DecodeError(expected: "int", found: "binary"))) + |> should.equal(Error(DecodeError(expected: "Int", found: "String"))) #(1, 2) |> dynamic.from @@ -391,7 +391,7 @@ if erlang { 1 |> dynamic.from |> dynamic.typed_tuple3(dynamic.int, dynamic.int, dynamic.int) - |> should.equal(Error(DecodeError(expected: "3 element tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "3 element tuple", found: "Int"))) } pub fn tuple4_test() { @@ -426,7 +426,7 @@ if erlang { 1 |> dynamic.from |> dynamic.tuple4 - |> should.equal(Error(DecodeError(expected: "4 element tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "4 element tuple", found: "Int"))) } pub fn typed_tuple4_test() { @@ -448,7 +448,7 @@ if erlang { #(1, 2, 3, "") |> dynamic.from |> dynamic.typed_tuple4(dynamic.int, dynamic.int, dynamic.int, dynamic.int) - |> should.equal(Error(DecodeError(expected: "int", found: "binary"))) + |> should.equal(Error(DecodeError(expected: "Int", found: "String"))) #(1, 2) |> dynamic.from @@ -461,7 +461,7 @@ if erlang { 1 |> dynamic.from |> dynamic.typed_tuple4(dynamic.int, dynamic.int, dynamic.int, dynamic.int) - |> should.equal(Error(DecodeError(expected: "4 element tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "4 element tuple", found: "Int"))) } pub fn tuple5_test() { @@ -498,7 +498,7 @@ if erlang { 1 |> dynamic.from |> dynamic.tuple5 - |> should.equal(Error(DecodeError(expected: "5 element tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "5 element tuple", found: "Int"))) } pub fn typed_tuple5_test() { @@ -533,7 +533,7 @@ if erlang { dynamic.int, dynamic.int, ) - |> should.equal(Error(DecodeError(expected: "int", found: "binary"))) + |> should.equal(Error(DecodeError(expected: "Int", found: "String"))) #(1, 2) |> dynamic.from @@ -558,7 +558,7 @@ if erlang { dynamic.int, dynamic.int, ) - |> should.equal(Error(DecodeError(expected: "5 element tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "5 element tuple", found: "Int"))) } pub fn tuple6_test() { @@ -597,7 +597,7 @@ if erlang { 1 |> dynamic.from |> dynamic.tuple6 - |> should.equal(Error(DecodeError(expected: "6 element tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "6 element tuple", found: "Int"))) } pub fn typed_tuple6_test() { @@ -635,7 +635,7 @@ if erlang { dynamic.int, dynamic.int, ) - |> should.equal(Error(DecodeError(expected: "int", found: "binary"))) + |> should.equal(Error(DecodeError(expected: "Int", found: "String"))) #(1, 2) |> dynamic.from @@ -662,7 +662,7 @@ if erlang { dynamic.int, dynamic.int, ) - |> should.equal(Error(DecodeError(expected: "6 element tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "6 element tuple", found: "Int"))) } pub fn map_test() { @@ -674,7 +674,7 @@ if erlang { 1 |> dynamic.from |> dynamic.map - |> should.equal(Error(DecodeError(expected: "map", found: "int"))) + |> should.equal(Error(DecodeError(expected: "Map", found: "Int"))) } pub fn list_test() { @@ -696,7 +696,7 @@ if erlang { 1 |> dynamic.from |> dynamic.list - |> should.equal(Error(DecodeError(expected: "list", found: "int"))) + |> should.equal(Error(DecodeError(expected: "List", found: "Int"))) } pub fn result_test() { @@ -713,7 +713,7 @@ if erlang { 1 |> dynamic.from |> dynamic.result - |> should.equal(Error(DecodeError(expected: "result tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "result tuple", found: "Int"))) #("bad", "value") |> dynamic.from @@ -738,16 +738,16 @@ if erlang { Ok("1") |> dynamic.from |> dynamic.typed_result(ok: dynamic.int, error: dynamic.string) - |> should.equal(Error(DecodeError(expected: "int", found: "binary"))) + |> should.equal(Error(DecodeError(expected: "Int", found: "String"))) Error(1) |> dynamic.from |> dynamic.typed_result(ok: dynamic.int, error: dynamic.string) - |> should.equal(Error(DecodeError(expected: "bit_string", found: "int"))) + |> should.equal(Error(DecodeError(expected: "String", found: "Int"))) 1 |> dynamic.from |> dynamic.typed_result(ok: dynamic.int, error: dynamic.string) - |> should.equal(Error(DecodeError(expected: "result tuple", found: "int"))) + |> should.equal(Error(DecodeError(expected: "result tuple", found: "Int"))) } } -- cgit v1.2.3