| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
package libyaml |
| 8 |
|
| 9 |
import ( |
| 10 |
"reflect" |
| 11 |
"testing" |
| 12 |
|
| 13 |
"go.yaml.in/yaml/v4/internal/testutil/assert" |
| 14 |
) |
| 15 |
|
| 16 |
func TestConstructor(t *testing.T) { |
| 17 |
RunTestCases(t, "constructor.yaml", map[string]TestHandler{ |
| 18 |
"scalar-resolution": func(t *testing.T, tc TestCase) { |
| 19 |
t.Helper() |
| 20 |
|
| 21 |
|
| 22 |
result, err := LoadAny([]byte(tc.Yaml)) |
| 23 |
assert.NoErrorf(t, err, "LoadAny() error: %v", err) |
| 24 |
|
| 25 |
|
| 26 |
if !reflect.DeepEqual(result, tc.Want) { |
| 27 |
t.Errorf("LoadAny() = %v (type: %T), want %v (type: %T)", |
| 28 |
result, result, tc.Want, tc.Want) |
| 29 |
} |
| 30 |
}, |
| 31 |
}) |
| 32 |
} |