diff options
author | rubytree <rt@rubytree.me> | 2023-04-30 13:09:26 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2023-05-13 16:32:38 +0100 |
commit | 037e2c575c367666a952f99ea4d9cc42268cedec (patch) | |
tree | fe0857f1ac1593696bfbad333c14e1ee3881cc1c /test | |
parent | 37b4a44fe8f63b6314f3611f8ec3dab820f34e3a (diff) | |
download | gleam_stdlib-037e2c575c367666a952f99ea4d9cc42268cedec.tar.gz gleam_stdlib-037e2c575c367666a952f99ea4d9cc42268cedec.zip |
`dynamic.tupleN/2` optimization
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/dynamic_test.gleam | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/test/gleam/dynamic_test.gleam b/test/gleam/dynamic_test.gleam index abf4ce6..936be49 100644 --- a/test/gleam/dynamic_test.gleam +++ b/test/gleam/dynamic_test.gleam @@ -511,7 +511,7 @@ pub fn tuple2_test() { |> should.equal(Error([ DecodeError( path: [], - expected: "Tuple of 2 elements", + expected: "Tuple or List of 2 elements", found: "Tuple of 3 elements", ), ])) @@ -520,7 +520,7 @@ pub fn tuple2_test() { |> dynamic.from |> dynamic.tuple2(dynamic.int, dynamic.int) |> should.equal(Error([ - DecodeError(path: [], expected: "Tuple of 2 elements", found: "Int"), + DecodeError(path: [], expected: "Tuple or List of 2 elements", found: "Int"), ])) [1, 2] @@ -547,8 +547,19 @@ pub fn tuple2_test() { |> should.equal(Error([ DecodeError( path: [], - expected: "List of 2 elements", - found: "List of 3 elements", + expected: "Tuple or List of 2 elements", + found: "List", + ), + ])) + + [] + |> dynamic.from + |> dynamic.tuple2(dynamic.int, dynamic.int) + |> should.equal(Error([ + DecodeError( + path: [], + expected: "Tuple or List of 2 elements", + found: "List", ), ])) } @@ -596,7 +607,7 @@ pub fn tuple3_test() { |> should.equal(Error([ DecodeError( path: [], - expected: "Tuple of 3 elements", + expected: "Tuple or List of 3 elements", found: "Tuple of 2 elements", ), ])) @@ -616,8 +627,8 @@ pub fn tuple3_test() { |> should.equal(Error([ DecodeError( path: [], - expected: "List of 3 elements", - found: "List of 2 elements", + expected: "Tuple or List of 3 elements", + found: "List", ), ])) @@ -625,7 +636,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: "Int"), + DecodeError(path: [], expected: "Tuple or List of 3 elements", found: "Int"), ])) } @@ -673,7 +684,7 @@ pub fn tuple4_test() { |> should.equal(Error([ DecodeError( path: [], - expected: "Tuple of 4 elements", + expected: "Tuple or List of 4 elements", found: "Tuple of 2 elements", ), ])) @@ -694,8 +705,8 @@ pub fn tuple4_test() { |> should.equal(Error([ DecodeError( path: [], - expected: "List of 4 elements", - found: "List of 2 elements", + expected: "Tuple or List of 4 elements", + found: "List", ), ])) @@ -703,7 +714,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: "Int"), + DecodeError(path: [], expected: "Tuple or List of 4 elements", found: "Int"), ])) } @@ -800,7 +811,7 @@ pub fn tuple5_test() { |> should.equal(Error([ DecodeError( path: [], - expected: "Tuple of 5 elements", + expected: "Tuple or List of 5 elements", found: "Tuple of 2 elements", ), ])) @@ -834,8 +845,8 @@ pub fn tuple5_test() { |> should.equal(Error([ DecodeError( path: [], - expected: "List of 5 elements", - found: "List of 2 elements", + expected: "Tuple or List of 5 elements", + found: "List", ), ])) @@ -849,7 +860,7 @@ pub fn tuple5_test() { dynamic.int, ) |> should.equal(Error([ - DecodeError(path: [], expected: "Tuple of 5 elements", found: "Int"), + DecodeError(path: [], expected: "Tuple or List of 5 elements", found: "Int"), ])) } @@ -955,7 +966,7 @@ pub fn tuple6_test() { |> should.equal(Error([ DecodeError( path: [], - expected: "Tuple of 6 elements", + expected: "Tuple or List of 6 elements", found: "Tuple of 2 elements", ), ])) @@ -992,8 +1003,8 @@ pub fn tuple6_test() { |> should.equal(Error([ DecodeError( path: [], - expected: "List of 6 elements", - found: "List of 2 elements", + expected: "Tuple or List of 6 elements", + found: "List", ), ])) @@ -1008,7 +1019,7 @@ pub fn tuple6_test() { dynamic.int, ) |> should.equal(Error([ - DecodeError(path: [], expected: "Tuple of 6 elements", found: "Int"), + DecodeError(path: [], expected: "Tuple or List of 6 elements", found: "Int"), ])) } |