|
|
@ -2,7 +2,6 @@ package test
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
@ -120,7 +119,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
t.Run("nestedImport", func(t *testing.T) {
|
|
|
|
t.Run("nestedImport", func(t *testing.T) {
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
err := ioutil.WriteFile(file, []byte(nestedAPIImport), os.ModePerm)
|
|
|
|
err := os.WriteFile(file, []byte(nestedAPIImport), os.ModePerm)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -150,7 +149,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
t.Run("ambiguousSyntax", func(t *testing.T) {
|
|
|
|
t.Run("ambiguousSyntax", func(t *testing.T) {
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
err := ioutil.WriteFile(file, []byte(ambiguousSyntax), os.ModePerm)
|
|
|
|
err := os.WriteFile(file, []byte(ambiguousSyntax), os.ModePerm)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -164,7 +163,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
t.Run("ambiguousSyntax", func(t *testing.T) {
|
|
|
|
t.Run("ambiguousSyntax", func(t *testing.T) {
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
err := ioutil.WriteFile(file, []byte(ambiguousSyntax), os.ModePerm)
|
|
|
|
err := os.WriteFile(file, []byte(ambiguousSyntax), os.ModePerm)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -178,7 +177,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
t.Run("ambiguousService", func(t *testing.T) {
|
|
|
|
t.Run("ambiguousService", func(t *testing.T) {
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
err := ioutil.WriteFile(file, []byte(ambiguousService), os.ModePerm)
|
|
|
|
err := os.WriteFile(file, []byte(ambiguousService), os.ModePerm)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -208,7 +207,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
assert.Error(t, err)
|
|
|
|
assert.Error(t, err)
|
|
|
|
|
|
|
|
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
err = ioutil.WriteFile(file, []byte(duplicateHandler), os.ModePerm)
|
|
|
|
err = os.WriteFile(file, []byte(duplicateHandler), os.ModePerm)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -237,7 +236,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
assert.Error(t, err)
|
|
|
|
assert.Error(t, err)
|
|
|
|
|
|
|
|
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
err = ioutil.WriteFile(file, []byte(duplicateRoute), os.ModePerm)
|
|
|
|
err = os.WriteFile(file, []byte(duplicateRoute), os.ModePerm)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -261,7 +260,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
assert.Error(t, err)
|
|
|
|
assert.Error(t, err)
|
|
|
|
|
|
|
|
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
file := filepath.Join(pathx.MustTempDir(), "foo.api")
|
|
|
|
err = ioutil.WriteFile(file, []byte(duplicateType), os.ModePerm)
|
|
|
|
err = os.WriteFile(file, []byte(duplicateType), os.ModePerm)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|