// Copyright 2017 FoxyUtils ehf. All rights reserved.
//
// Use of this source code is governed by the terms of the Affero GNU General
// Public License version 3.0 as published by the Free Software Foundation and
// appearing in the file LICENSE included in the packaging of this file. A
// commercial license can be purchased on https://unidoc.io.
package unioffice_test
import (
"bytes"
"encoding/xml"
"strings"
"testing"
"github.com/unidoc/unioffice"
)
func TestXSDAny(t *testing.T) {
any := unioffice.XSDAny{}
anyXml := `foobar`
exp := `foobar`
dec := xml.NewDecoder(strings.NewReader(anyXml))
if err := dec.Decode(&any); err != nil {
t.Errorf("error decoding XSDAny: %s", err)
}
buf := bytes.Buffer{}
enc := xml.NewEncoder(&buf)
if err := enc.Encode(&any); err != nil {
t.Errorf("error encoding XSDAny: %s", err)
}
if buf.String() != exp {
t.Errorf("expected %s, got %s", exp, buf.String())
}
}