From 100166532c5fe72b9f05de516c3e6fcfa068b879 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Thu, 1 May 2025 17:08:55 -0400 Subject: [PATCH] Fix `joinv` with `""` separator (#1794) * codemod per se * unit-test coverage --- pkg/bifs/collections.go | 2 +- test/cases/dsl-split-join/0028/cmd | 1 + test/cases/dsl-split-join/0028/experr | 0 test/cases/dsl-split-join/0028/expout | 1 + test/cases/dsl-split-join/0028/mlr | 1 + 5 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 test/cases/dsl-split-join/0028/cmd create mode 100644 test/cases/dsl-split-join/0028/experr create mode 100644 test/cases/dsl-split-join/0028/expout create mode 100644 test/cases/dsl-split-join/0028/mlr diff --git a/pkg/bifs/collections.go b/pkg/bifs/collections.go index cd3f87da2..a47730702 100644 --- a/pkg/bifs/collections.go +++ b/pkg/bifs/collections.go @@ -373,7 +373,7 @@ func BIF_joink(input1, input2 *mlrval.Mlrval) *mlrval.Mlrval { // joinv([3,4,5], ",") -> "3,4,5" // joinv({"a":3,"b":4,"c":5}, ",") -> "3,4,5" func BIF_joinv(input1, input2 *mlrval.Mlrval) *mlrval.Mlrval { - if !input2.IsString() { + if !input2.IsStringOrVoid() { return mlrval.FromNotStringError("joinv", input2) } fieldSeparator := input2.AcquireStringValue() diff --git a/test/cases/dsl-split-join/0028/cmd b/test/cases/dsl-split-join/0028/cmd new file mode 100644 index 000000000..6add080d4 --- /dev/null +++ b/test/cases/dsl-split-join/0028/cmd @@ -0,0 +1 @@ +mlr -n put -f ${CASEDIR}/mlr diff --git a/test/cases/dsl-split-join/0028/experr b/test/cases/dsl-split-join/0028/experr new file mode 100644 index 000000000..e69de29bb diff --git a/test/cases/dsl-split-join/0028/expout b/test/cases/dsl-split-join/0028/expout new file mode 100644 index 000000000..51b400812 --- /dev/null +++ b/test/cases/dsl-split-join/0028/expout @@ -0,0 +1 @@ +345 diff --git a/test/cases/dsl-split-join/0028/mlr b/test/cases/dsl-split-join/0028/mlr new file mode 100644 index 000000000..08e79d8dc --- /dev/null +++ b/test/cases/dsl-split-join/0028/mlr @@ -0,0 +1 @@ +end {print joinv([3,4,5], "")}