Conver to regular Go vendor + dep tool

This commit is contained in:
Andrey Smirnov
2017-03-22 17:38:32 +03:00
parent 070347295e
commit c6c1012330
3260 changed files with 1742550 additions and 72 deletions
+66
View File
@@ -0,0 +1,66 @@
package JsonConfigReader
import (
"bytes"
"io"
"strings"
"testing"
)
var tests = map[string]string{
`{
// a
"x": "y", // b
"x": "y", // c
}`: `{
"x": "y",
"x": "y"
}`,
`// serve a directory
"l/test": [
{
"handler": "fs",
"dir": "../",
// "strip_prefix": "",
},
],`: `
"l/test": [
{
"handler": "fs",
"dir": "../"
}
],`,
`[1, 2, 3]`: `[1, 2, 3]`,
`[1, 2, 3, 4,]`: `[1, 2, 3, 4 ]`,
`{"x":1}//[1, 2, 3, 4,]`: `{"x":1} `,
`//////`: ` `,
`{}/ /..`: `{}/ /..`,
`{,}/ /..`: `{ }/ /..`,
`{,}//..`: `{ } `,
`{[],}`: `{[] }`,
`{[,}`: `{[ }`,
`[[",",],]`: `[["," ] ]`,
`[",\"",]`: `[",\"" ]`,
`[",\"\\\",]`: `[",\"\\\",]`,
`[",//"]`: `[",//"]`,
`[",//\"
"],`: `[",//\"
"],`,
}
func TestMain(t *testing.T) {
for a, b := range tests {
buf := &bytes.Buffer{}
io.Copy(buf, New(strings.NewReader(a)))
a = buf.String()
if a != b {
a = strings.Replace(a, " ", ".", -1)
b = strings.Replace(b, " ", ".", -1)
t.Errorf("reader failed to clean json: expected: `%s`, got `%s`", b, a)
}
}
}