Making repository 'go get'-able. Moved test cases to test files. Dummy build tag for gotemplate template.

This commit is contained in:
Victor Starodub
2016-02-28 14:11:49 +03:00
parent 5d497db34c
commit e7141db2c5
18 changed files with 52 additions and 19 deletions
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// generated by gotemplate
package opt
import (
+2
View File
@@ -1,3 +1,5 @@
// +build none
package optional
import (
+2
View File
@@ -1,5 +1,6 @@
package opt
//go:generate sed -i "s/\\+build none/generated by gotemplate/" optional/opt.go
//go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Int(int)
//go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Uint(uint)
@@ -18,3 +19,4 @@ package opt
//go:generate gotemplate "github.com/mailru/easyjson/opt/optional" Bool(bool)
//go:generate gotemplate "github.com/mailru/easyjson/opt/optional" String(string)
//go:generate sed -i "s/generated by gotemplate/+build none/" optional/opt.go
+20
View File
@@ -3,8 +3,28 @@ package tests
import (
"reflect"
"testing"
"encoding/json"
)
type testType interface {
json.Marshaler
json.Unmarshaler
}
var testCases = []struct {
Decoded testType
Encoded string
}{
{&primitiveTypesValue, primitiveTypesString},
{&structsValue, structsString},
{&omitEmptyValue, omitEmptyString},
{&snakeStructValue, snakeStructString},
{&omitEmptyDefaultValue, omitEmptyDefaultString},
{&optsValue, optsString},
{&rawValue, rawString},
}
func TestMarshal(t *testing.T) {
for i, test := range testCases {
data, err := test.Decoded.MarshalJSON()
-19
View File
@@ -1,7 +1,6 @@
package tests
import (
"encoding/json"
"fmt"
"math"
@@ -9,24 +8,6 @@ import (
"github.com/mailru/easyjson/opt"
)
type testType interface {
json.Marshaler
json.Unmarshaler
}
var testCases = []struct {
Decoded testType
Encoded string
}{
{&primitiveTypesValue, primitiveTypesString},
{&structsValue, structsString},
{&omitEmptyValue, omitEmptyString},
{&snakeStructValue, snakeStructString},
{&omitEmptyDefaultValue, omitEmptyDefaultString},
{&optsValue, optsString},
{&rawValue, rawString},
}
type PrimitiveTypes struct {
String string
Bool bool