diff --git a/llx/data_conversions.go b/llx/data_conversions.go index 5fe09c926..f36948f4e 100644 --- a/llx/data_conversions.go +++ b/llx/data_conversions.go @@ -59,7 +59,7 @@ func init() { types.Score: pscore2raw, types.Empty: pempty2raw, types.Block: pblock2rawV2, - types.Semver: pscore2raw, + types.Semver: pstring2raw, types.ArrayLike: parray2raw, types.MapLike: pmap2raw, types.ResourceLike: presource2raw, diff --git a/llx/data_conversions_test.go b/llx/data_conversions_test.go new file mode 100644 index 000000000..ace535864 --- /dev/null +++ b/llx/data_conversions_test.go @@ -0,0 +1,17 @@ +package llx_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + "go.mondoo.com/cnquery/v11/llx" + "go.mondoo.com/cnquery/v11/types" +) + +func TestSemver_Conversions(t *testing.T) { + sv := llx.StringPrimitive("1.2.3") + sv.Type = string(types.Semver) + rd := sv.RawData() + require.NoError(t, rd.Error, "no error converting semver to raw data") + require.Equal(t, "1.2.3", rd.Value, "semver to raw data is the same") +}