summaryrefslogtreecommitdiffhomepage
path: root/types.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-01-23 11:36:31 +0100
committerJo-Philipp Wich <jo@mein.io>2023-01-23 11:36:31 +0100
commitf1be0d725735fd8dd489494b00e954a93223f722 (patch)
tree2a433e6506d6cd3a61bf75f4829de46f22c9a9af /types.c
parent48a6eac1da1584ea784fd7d53f761baa87ae84d2 (diff)
types: fix array unshift operations and add test coverage
- Fix `ucv_array_unshift()` improperly rejecting operation on empty arrays - Fix `uc_unshift()` improperly reversing maintaining argument order - Add missing test coverage for `push()`, `pop()`, `unshift()` and `shift()` array operations. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'types.c')
-rw-r--r--types.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/types.c b/types.c
index cde2221..321392e 100644
--- a/types.c
+++ b/types.c
@@ -772,7 +772,7 @@ ucv_array_unshift(uc_value_t *uv, uc_value_t *item)
uc_array_t *array = (uc_array_t *)uv;
size_t i;
- if (ucv_type(uv) != UC_ARRAY || array->count == 0)
+ if (ucv_type(uv) != UC_ARRAY)
return NULL;
array->count++;