MCPcopy
hub / github.com/TomWright/dasel / TestValue_GoValue

Function TestValue_GoValue

model/go_value_test.go:28–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func TestValue_GoValue(t *testing.T) {
29 t.Run("null", goValueTestCase{
30 in: model.NewNullValue(),
31 exp: nil,
32 }.run)
33 t.Run("int", goValueTestCase{
34 in: model.NewIntValue(42),
35 exp: int64(42),
36 }.run)
37 t.Run("float", goValueTestCase{
38 in: model.NewFloatValue(3.14),
39 exp: 3.14,
40 }.run)
41 t.Run("string", goValueTestCase{
42 in: model.NewStringValue("hello"),
43 exp: "hello",
44 }.run)
45 t.Run("bool", goValueTestCase{
46 in: model.NewBoolValue(true),
47 exp: true,
48 }.run)
49 t.Run("slice", goValueTestCase{
50 inFn: func() *model.Value {
51 s := model.NewSliceValue()
52 _ = s.Append(model.NewIntValue(1))
53 _ = s.Append(model.NewIntValue(2))
54 _ = s.Append(model.NewIntValue(3))
55 return s
56 },
57 exp: []any{int64(1), int64(2), int64(3)},
58 }.run)
59 t.Run("map", goValueTestCase{
60 inFn: func() *model.Value {
61 m := model.NewMapValue()
62 _ = m.SetMapKey("a", model.NewStringValue("apple"))
63 return m
64 },
65 exp: map[string]any{
66 "a": "apple",
67 },
68 }.run)
69}

Callers

nothing calls this directly

Calls 10

NewNullValueFunction · 0.92
NewIntValueFunction · 0.92
NewFloatValueFunction · 0.92
NewStringValueFunction · 0.92
NewBoolValueFunction · 0.92
NewSliceValueFunction · 0.92
NewMapValueFunction · 0.92
AppendMethod · 0.80
SetMapKeyMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected