Progressing through mutability use cases in models.

This commit is contained in:
Dave Shanley
2023-03-02 12:21:14 -05:00
parent 88709c389a
commit fc9a230847
7 changed files with 82 additions and 42 deletions

View File

@@ -9,6 +9,7 @@ import (
lowbase "github.com/pb33f/libopenapi/datamodel/low/base"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
"strings"
"testing"
)
@@ -39,6 +40,11 @@ x-hack: code`
assert.Equal(t, "code", highExample.Extensions["x-hack"])
assert.Equal(t, "a thing", highExample.Value)
assert.Equal(t, 4, highExample.GoLow().ExternalValue.ValueNode.Line)
// render the example as YAML
rendered, _ := highExample.Render()
assert.Equal(t, strings.TrimSpace(string(rendered)), yml)
}
func TestExtractExamples(t *testing.T) {