|
|
|
@ -2,7 +2,6 @@ package test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"testing"
|
|
|
|
@ -120,7 +119,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t.Run("nestedImport", func(t *testing.T) {
|
|
|
|
|
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 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -150,7 +149,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t.Run("ambiguousSyntax", func(t *testing.T) {
|
|
|
|
|
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 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -164,7 +163,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t.Run("ambiguousSyntax", func(t *testing.T) {
|
|
|
|
|
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 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -178,7 +177,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t.Run("ambiguousService", func(t *testing.T) {
|
|
|
|
|
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 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -208,7 +207,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
assert.Error(t, err)
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -237,7 +236,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
assert.Error(t, err)
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -261,7 +260,7 @@ func TestApiParser(t *testing.T) {
|
|
|
|
|
assert.Error(t, err)
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|