mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
Conver to regular Go vendor + dep tool
This commit is contained in:
+66
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user