Skip to content

Commit

Permalink
Introduce first test and test harness
Browse files Browse the repository at this point in the history
Related to #3
  • Loading branch information
isimluk committed Sep 9, 2020
1 parent 6ddd148 commit ffbb2d2
Show file tree
Hide file tree
Showing 45 changed files with 16,750 additions and 0 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ go 1.13
require (
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334
github.com/markbates/pkger v0.16.0
github.com/stretchr/testify v1.4.0
github.com/urfave/cli v1.22.4
)
33 changes: 33 additions & 0 deletions tests/smoke_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package tests

import (
"io/ioutil"
"os"
"path/filepath"
"testing"

"github.com/gocomply/xsd2go/pkg/xsd2go"
"github.com/stretchr/testify/assert"
)

func TestSanity(t *testing.T) {
xsdFiles, err := filepath.Glob("xsd-examples/valid/*.xsd")
assert.Nil(t, err)
assert.NotEmpty(t, xsdFiles)

for _, xsdPath := range xsdFiles {
assertConvertsFine(t, xsdPath)
}
}

func assertConvertsFine(t *testing.T, xsdPath string) {
dname, err := ioutil.TempDir("", "xsd2go_tests_")
assert.Nil(t, err)
defer os.RemoveAll(dname)

outputDir := dname

goModule := "user.com/private"

err = xsd2go.Convert(xsdPath, goModule, outputDir)
}
12 changes: 12 additions & 0 deletions tests/xsd-examples/valid/simple.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:simple-schema="https://simple.example.com/"
targetNamespace="https://simple.example.com/"
elementFormDefault="qualified">
<xsd:element name="myelement" type="simple-schema:MyElementType" />
<xsd:complexType name="MyElementType">
<xsd:sequence>
<xsd:element name="id" type="xsd:integer" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
15 changes: 15 additions & 0 deletions vendor/github.com/davecgh/go-spew/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

145 changes: 145 additions & 0 deletions vendor/github.com/davecgh/go-spew/spew/bypass.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions vendor/github.com/davecgh/go-spew/spew/bypasssafe.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ffbb2d2

Please # to comment.