(t *testing.T)
| 524 | } |
| 525 | |
| 526 | func TestValue_String(t *testing.T) { |
| 527 | t.Run("string", func(t *testing.T) { |
| 528 | got := model.NewStringValue("hello").String() |
| 529 | if !strings.Contains(got, "hello") { |
| 530 | t.Errorf("expected output to contain 'hello', got %s", got) |
| 531 | } |
| 532 | }) |
| 533 | t.Run("int", func(t *testing.T) { |
| 534 | got := model.NewIntValue(42).String() |
| 535 | if !strings.Contains(got, "42") { |
| 536 | t.Errorf("expected output to contain '42', got %s", got) |
| 537 | } |
| 538 | }) |
| 539 | t.Run("float", func(t *testing.T) { |
| 540 | got := model.NewFloatValue(3.14).String() |
| 541 | if !strings.Contains(got, "3.14") { |
| 542 | t.Errorf("expected output to contain '3.14', got %s", got) |
| 543 | } |
| 544 | }) |
| 545 | t.Run("bool", func(t *testing.T) { |
| 546 | got := model.NewBoolValue(true).String() |
| 547 | if !strings.Contains(got, "true") { |
| 548 | t.Errorf("expected output to contain 'true', got %s", got) |
| 549 | } |
| 550 | }) |
| 551 | t.Run("null", func(t *testing.T) { |
| 552 | got := model.NewNullValue().String() |
| 553 | if !strings.Contains(got, "null") { |
| 554 | t.Errorf("expected output to contain 'null', got %s", got) |
| 555 | } |
| 556 | }) |
| 557 | t.Run("slice", func(t *testing.T) { |
| 558 | s := model.NewSliceValue() |
| 559 | _ = s.Append(model.NewIntValue(1)) |
| 560 | got := s.String() |
| 561 | if !strings.Contains(got, "array") { |
| 562 | t.Errorf("expected output to contain 'array', got %s", got) |
| 563 | } |
| 564 | }) |
| 565 | t.Run("map", func(t *testing.T) { |
| 566 | m := model.NewValue(orderedmap.NewMap().Set("key", "val")) |
| 567 | got := m.String() |
| 568 | if !strings.Contains(got, "key") { |
| 569 | t.Errorf("expected output to contain 'key', got %s", got) |
| 570 | } |
| 571 | }) |
| 572 | } |
nothing calls this directly
no test coverage detected