Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
lpil committed May 13, 2023
1 parent 2442c67 commit b0afebc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 40 deletions.
46 changes: 36 additions & 10 deletions src/gleam/dynamic.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -619,19 +619,32 @@ if erlang {
external fn decode_tuple(Dynamic) -> Result(UnknownTuple, DecodeErrors) =
"gleam_stdlib" "decode_tuple"

external fn decode_tuple2(Dynamic) -> Result(#(Dynamic, Dynamic), DecodeErrors) =
external fn decode_tuple2(
Dynamic,
) -> Result(#(Dynamic, Dynamic), DecodeErrors) =
"gleam_stdlib" "decode_tuple2"

external fn decode_tuple3(Dynamic) -> Result(#(Dynamic, Dynamic, Dynamic), DecodeErrors) =
external fn decode_tuple3(
Dynamic,
) -> Result(#(Dynamic, Dynamic, Dynamic), DecodeErrors) =
"gleam_stdlib" "decode_tuple3"

external fn decode_tuple4(Dynamic) -> Result(#(Dynamic, Dynamic, Dynamic, Dynamic), DecodeErrors) =
external fn decode_tuple4(
Dynamic,
) -> Result(#(Dynamic, Dynamic, Dynamic, Dynamic), DecodeErrors) =
"gleam_stdlib" "decode_tuple4"

external fn decode_tuple5(Dynamic) -> Result(#(Dynamic, Dynamic, Dynamic, Dynamic, Dynamic), DecodeErrors) =
external fn decode_tuple5(
Dynamic,
) -> Result(#(Dynamic, Dynamic, Dynamic, Dynamic, Dynamic), DecodeErrors) =
"gleam_stdlib" "decode_tuple5"

external fn decode_tuple6(Dynamic) -> Result(#(Dynamic, Dynamic, Dynamic, Dynamic, Dynamic, Dynamic), DecodeErrors) =
external fn decode_tuple6(
Dynamic,
) -> Result(
#(Dynamic, Dynamic, Dynamic, Dynamic, Dynamic, Dynamic),
DecodeErrors,
) =
"gleam_stdlib" "decode_tuple6"

external fn tuple_get(UnknownTuple, Int) -> Result(Dynamic, DecodeErrors) =
Expand All @@ -645,19 +658,32 @@ if javascript {
external fn decode_tuple(Dynamic) -> Result(UnknownTuple, DecodeErrors) =
"../gleam_stdlib.mjs" "decode_tuple"

external fn decode_tuple2(Dynamic) -> Result(#(Dynamic, Dynamic), DecodeErrors) =
external fn decode_tuple2(
Dynamic,
) -> Result(#(Dynamic, Dynamic), DecodeErrors) =
"../gleam_stdlib.mjs" "decode_tuple2"

external fn decode_tuple3(Dynamic) -> Result(#(Dynamic, Dynamic, Dynamic), DecodeErrors) =
external fn decode_tuple3(
Dynamic,
) -> Result(#(Dynamic, Dynamic, Dynamic), DecodeErrors) =
"../gleam_stdlib.mjs" "decode_tuple3"

external fn decode_tuple4(Dynamic) -> Result(#(Dynamic, Dynamic, Dynamic, Dynamic), DecodeErrors) =
external fn decode_tuple4(
Dynamic,
) -> Result(#(Dynamic, Dynamic, Dynamic, Dynamic), DecodeErrors) =
"../gleam_stdlib.mjs" "decode_tuple4"

external fn decode_tuple5(Dynamic) -> Result(#(Dynamic, Dynamic, Dynamic, Dynamic, Dynamic), DecodeErrors) =
external fn decode_tuple5(
Dynamic,
) -> Result(#(Dynamic, Dynamic, Dynamic, Dynamic, Dynamic), DecodeErrors) =
"../gleam_stdlib.mjs" "decode_tuple5"

external fn decode_tuple6(Dynamic) -> Result(#(Dynamic, Dynamic, Dynamic, Dynamic, Dynamic, Dynamic), DecodeErrors) =
external fn decode_tuple6(
Dynamic,
) -> Result(
#(Dynamic, Dynamic, Dynamic, Dynamic, Dynamic, Dynamic),
DecodeErrors,
) =
"../gleam_stdlib.mjs" "decode_tuple6"

external fn tuple_get(UnknownTuple, Int) -> Result(Dynamic, DecodeErrors) =
Expand Down
36 changes: 6 additions & 30 deletions test/gleam/dynamic_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -545,22 +545,14 @@ pub fn tuple2_test() {
|> dynamic.from
|> dynamic.tuple2(dynamic.int, dynamic.int)
|> should.equal(Error([
DecodeError(
path: [],
expected: "Tuple of 2 elements",
found: "List",
),
DecodeError(path: [], expected: "Tuple of 2 elements", found: "List"),
]))

[]
|> dynamic.from
|> dynamic.tuple2(dynamic.int, dynamic.int)
|> should.equal(Error([
DecodeError(
path: [],
expected: "Tuple of 2 elements",
found: "List",
),
DecodeError(path: [], expected: "Tuple of 2 elements", found: "List"),
]))
}

Expand Down Expand Up @@ -625,11 +617,7 @@ pub fn tuple3_test() {
|> dynamic.from
|> dynamic.tuple3(dynamic.int, dynamic.int, dynamic.int)
|> should.equal(Error([
DecodeError(
path: [],
expected: "Tuple of 3 elements",
found: "List",
),
DecodeError(path: [], expected: "Tuple of 3 elements", found: "List"),
]))

1
Expand Down Expand Up @@ -703,11 +691,7 @@ pub fn tuple4_test() {
|> dynamic.from
|> dynamic.tuple4(dynamic.int, dynamic.int, dynamic.int, dynamic.int)
|> should.equal(Error([
DecodeError(
path: [],
expected: "Tuple of 4 elements",
found: "List",
),
DecodeError(path: [], expected: "Tuple of 4 elements", found: "List"),
]))

1
Expand Down Expand Up @@ -843,11 +827,7 @@ pub fn tuple5_test() {
dynamic.int,
)
|> should.equal(Error([
DecodeError(
path: [],
expected: "Tuple of 5 elements",
found: "List",
),
DecodeError(path: [], expected: "Tuple of 5 elements", found: "List"),
]))

1
Expand Down Expand Up @@ -1001,11 +981,7 @@ pub fn tuple6_test() {
dynamic.int,
)
|> should.equal(Error([
DecodeError(
path: [],
expected: "Tuple of 6 elements",
found: "List",
),
DecodeError(path: [], expected: "Tuple of 6 elements", found: "List"),
]))

1
Expand Down

0 comments on commit b0afebc

Please sign in to comment.