check in generated test dependency code

This commit is contained in:
Chris Masone
2015-10-09 17:22:18 -07:00
parent ce3360da4b
commit ea34bfaaea
2 changed files with 246 additions and 0 deletions

View File

@@ -0,0 +1,128 @@
// This file was generated by nomdl/codegen.
package sha1_f1a192312c01fb47e8e329471242e475eb7001a4
import (
"github.com/attic-labs/noms/ref"
"github.com/attic-labs/noms/types"
)
var __sha1_f1a192312c01fb47e8e329471242e475eb7001a4PackageInFile_sha1_f1a192312c01fb47e8e329471242e475eb7001a4_CachedRef = __sha1_f1a192312c01fb47e8e329471242e475eb7001a4PackageInFile_sha1_f1a192312c01fb47e8e329471242e475eb7001a4_Ref()
// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func __sha1_f1a192312c01fb47e8e329471242e475eb7001a4PackageInFile_sha1_f1a192312c01fb47e8e329471242e475eb7001a4_Ref() ref.Ref {
p := types.PackageDef{
NamedTypes: types.MapOfStringToTypeRefDef{
"E": types.MakeEnumTypeRef("E", "e1", "e2", "e3"),
"S": types.MakeStructTypeRef("S",
[]types.Field{
types.Field{"s", types.MakePrimitiveTypeRef(types.StringKind), false},
types.Field{"b", types.MakePrimitiveTypeRef(types.BoolKind), false},
},
types.Choices{},
),
},
}.New()
return types.RegisterPackage(&p)
}
// E
type E uint32
const (
E1 E = iota
E2
E3
)
// S
type S struct {
m types.Map
}
func NewS() S {
return S{types.NewMap(
types.NewString("$name"), types.NewString("S"),
types.NewString("$type"), types.MakeTypeRef("S", __sha1_f1a192312c01fb47e8e329471242e475eb7001a4PackageInFile_sha1_f1a192312c01fb47e8e329471242e475eb7001a4_CachedRef),
types.NewString("s"), types.NewString(""),
types.NewString("b"), types.Bool(false),
)}
}
type SDef struct {
S string
B bool
}
func (def SDef) New() S {
return S{
types.NewMap(
types.NewString("$name"), types.NewString("S"),
types.NewString("$type"), types.MakeTypeRef("S", __sha1_f1a192312c01fb47e8e329471242e475eb7001a4PackageInFile_sha1_f1a192312c01fb47e8e329471242e475eb7001a4_CachedRef),
types.NewString("s"), types.NewString(def.S),
types.NewString("b"), types.Bool(def.B),
)}
}
func (s S) Def() (d SDef) {
d.S = s.m.Get(types.NewString("s")).(types.String).String()
d.B = bool(s.m.Get(types.NewString("b")).(types.Bool))
return
}
var __typeRefForS = types.MakeTypeRef("S", __sha1_f1a192312c01fb47e8e329471242e475eb7001a4PackageInFile_sha1_f1a192312c01fb47e8e329471242e475eb7001a4_CachedRef)
func (m S) TypeRef() types.TypeRef {
return __typeRefForS
}
func init() {
types.RegisterFromValFunction(__typeRefForS, func(v types.Value) types.NomsValue {
return SFromVal(v)
})
}
func SFromVal(val types.Value) S {
// TODO: Validate here
return S{val.(types.Map)}
}
func (s S) NomsValue() types.Value {
return s.m
}
func (s S) Equals(other types.Value) bool {
if other, ok := other.(S); ok {
return s.m.Equals(other.m)
}
return false
}
func (s S) Ref() ref.Ref {
return s.m.Ref()
}
func (s S) Chunks() []types.Future {
return s.m.Chunks()
}
func (s S) S() string {
return s.m.Get(types.NewString("s")).(types.String).String()
}
func (s S) SetS(val string) S {
return S{s.m.Set(types.NewString("s"), types.NewString(val))}
}
func (s S) B() bool {
return bool(s.m.Get(types.NewString("b")).(types.Bool))
}
func (s S) SetB(val bool) S {
return S{s.m.Set(types.NewString("b"), types.Bool(val))}
}

View File

@@ -0,0 +1,118 @@
// This file was generated by nomdl/codegen.
package sha1_f9397427926127f67d8f3edb21c92bf642262e9b
import (
"github.com/attic-labs/noms/nomdl/codegen/test/gen/sha1_f1a192312c01fb47e8e329471242e475eb7001a4"
"github.com/attic-labs/noms/ref"
"github.com/attic-labs/noms/types"
)
var __sha1_f9397427926127f67d8f3edb21c92bf642262e9bPackageInFile_sha1_f9397427926127f67d8f3edb21c92bf642262e9b_CachedRef = __sha1_f9397427926127f67d8f3edb21c92bf642262e9bPackageInFile_sha1_f9397427926127f67d8f3edb21c92bf642262e9b_Ref()
// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func __sha1_f9397427926127f67d8f3edb21c92bf642262e9bPackageInFile_sha1_f9397427926127f67d8f3edb21c92bf642262e9b_Ref() ref.Ref {
p := types.PackageDef{
NamedTypes: types.MapOfStringToTypeRefDef{
"D": types.MakeStructTypeRef("D",
[]types.Field{
types.Field{"structField", types.MakeTypeRef("S", ref.Parse("sha1-f1a192312c01fb47e8e329471242e475eb7001a4")), false},
types.Field{"enumField", types.MakeTypeRef("E", ref.Parse("sha1-f1a192312c01fb47e8e329471242e475eb7001a4")), false},
},
types.Choices{},
),
},
}.New()
return types.RegisterPackage(&p)
}
// D
type D struct {
m types.Map
}
func NewD() D {
return D{types.NewMap(
types.NewString("$name"), types.NewString("D"),
types.NewString("$type"), types.MakeTypeRef("D", __sha1_f9397427926127f67d8f3edb21c92bf642262e9bPackageInFile_sha1_f9397427926127f67d8f3edb21c92bf642262e9b_CachedRef),
types.NewString("structField"), sha1_f1a192312c01fb47e8e329471242e475eb7001a4.NewS().NomsValue(),
types.NewString("enumField"), types.UInt32(0),
)}
}
type DDef struct {
StructField sha1_f1a192312c01fb47e8e329471242e475eb7001a4.SDef
EnumField sha1_f1a192312c01fb47e8e329471242e475eb7001a4.E
}
func (def DDef) New() D {
return D{
types.NewMap(
types.NewString("$name"), types.NewString("D"),
types.NewString("$type"), types.MakeTypeRef("D", __sha1_f9397427926127f67d8f3edb21c92bf642262e9bPackageInFile_sha1_f9397427926127f67d8f3edb21c92bf642262e9b_CachedRef),
types.NewString("structField"), def.StructField.New().NomsValue(),
types.NewString("enumField"), types.UInt32(def.EnumField),
)}
}
func (s D) Def() (d DDef) {
d.StructField = sha1_f1a192312c01fb47e8e329471242e475eb7001a4.SFromVal(s.m.Get(types.NewString("structField"))).Def()
d.EnumField = sha1_f1a192312c01fb47e8e329471242e475eb7001a4.E(s.m.Get(types.NewString("enumField")).(types.UInt32))
return
}
var __typeRefForD = types.MakeTypeRef("D", __sha1_f9397427926127f67d8f3edb21c92bf642262e9bPackageInFile_sha1_f9397427926127f67d8f3edb21c92bf642262e9b_CachedRef)
func (m D) TypeRef() types.TypeRef {
return __typeRefForD
}
func init() {
types.RegisterFromValFunction(__typeRefForD, func(v types.Value) types.NomsValue {
return DFromVal(v)
})
}
func DFromVal(val types.Value) D {
// TODO: Validate here
return D{val.(types.Map)}
}
func (s D) NomsValue() types.Value {
return s.m
}
func (s D) Equals(other types.Value) bool {
if other, ok := other.(D); ok {
return s.m.Equals(other.m)
}
return false
}
func (s D) Ref() ref.Ref {
return s.m.Ref()
}
func (s D) Chunks() []types.Future {
return s.m.Chunks()
}
func (s D) StructField() sha1_f1a192312c01fb47e8e329471242e475eb7001a4.S {
return sha1_f1a192312c01fb47e8e329471242e475eb7001a4.SFromVal(s.m.Get(types.NewString("structField")))
}
func (s D) SetStructField(val sha1_f1a192312c01fb47e8e329471242e475eb7001a4.S) D {
return D{s.m.Set(types.NewString("structField"), val.NomsValue())}
}
func (s D) EnumField() sha1_f1a192312c01fb47e8e329471242e475eb7001a4.E {
return sha1_f1a192312c01fb47e8e329471242e475eb7001a4.E(s.m.Get(types.NewString("enumField")).(types.UInt32))
}
func (s D) SetEnumField(val sha1_f1a192312c01fb47e8e329471242e475eb7001a4.E) D {
return D{s.m.Set(types.NewString("enumField"), types.UInt32(val))}
}