(t *testing.T)
| 145 | } |
| 146 | |
| 147 | func TestValue_Copy(t *testing.T) { |
| 148 | t.Run("map copy is independent", func(t *testing.T) { |
| 149 | orig := model.NewValue(orderedmap.NewMap().Set("a", "one")) |
| 150 | cp, err := orig.Copy() |
| 151 | if err != nil { |
| 152 | t.Fatal(err) |
| 153 | } |
| 154 | // Modify original |
| 155 | if err := orig.SetMapKey("a", model.NewStringValue("modified")); err != nil { |
| 156 | t.Fatal(err) |
| 157 | } |
| 158 | // Copy should be unchanged |
| 159 | val, err := cp.GetMapKey("a") |
| 160 | if err != nil { |
| 161 | t.Fatal(err) |
| 162 | } |
| 163 | got, err := val.StringValue() |
| 164 | if err != nil { |
| 165 | t.Fatal(err) |
| 166 | } |
| 167 | if got != "one" { |
| 168 | t.Errorf("expected copy to be 'one', got %s", got) |
| 169 | } |
| 170 | }) |
| 171 | t.Run("non-map returns error", func(t *testing.T) { |
| 172 | _, err := model.NewIntValue(1).Copy() |
| 173 | if err == nil { |
| 174 | t.Fatal("expected error for Copy on non-map") |
| 175 | } |
| 176 | }) |
| 177 | } |
| 178 | |
| 179 | func TestValues_ToSliceValue(t *testing.T) { |
| 180 | vals := model.Values{model.NewIntValue(1), model.NewStringValue("hello")} |
nothing calls this directly
no test coverage detected