Skip to content

Commit

Permalink
🐛 Fix semver conversion to RawData
Browse files Browse the repository at this point in the history
  • Loading branch information
jaym committed Dec 19, 2024
1 parent 151b790 commit 87ef606
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llx/data_conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions llx/data_conversions_test.go
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit 87ef606

Please sign in to comment.