コード例 #1
0
ファイル: types_test.go プロジェクト: derekperkins/goa
	Describe("Marshaler", func() {
		var marshaler, unmarshaler string
		var context, source, target string

		BeforeEach(func() {
			codegen.TempCount = 0
			context = ""
			source = "raw"
			target = "p"
		})

		Context("with a primitive type", func() {
			var p Primitive

			JustBeforeEach(func() {
				marshaler = codegen.TypeMarshaler(p, false, "", context, source, target)
				codegen.TempCount = 0
				unmarshaler = codegen.TypeUnmarshaler(p, false, "", context, source, target)
			})

			Context("integer", func() {
				BeforeEach(func() {
					p = Primitive(IntegerKind)
				})

				It("generates the marshaler code", func() {
					expected := `	p = raw`
					Ω(marshaler).Should(Equal(expected))
				})

				It("generates the unmarshaler code", func() {
コード例 #2
0
ファイル: types_test.go プロジェクト: harboe/goa
	Describe("Marshaler", func() {
		var marshaler, unmarshaler string
		var context, source, target string

		BeforeEach(func() {
			codegen.TempCount = 0
			context = ""
			source = "raw"
			target = "p"
		})

		Context("with a primitive type", func() {
			var p Primitive

			JustBeforeEach(func() {
				marshaler = codegen.TypeMarshaler(p, context, source, target)
				codegen.TempCount = 0
				unmarshaler = codegen.PrimitiveUnmarshaler(p, context, source, target)
			})

			Context("integer", func() {
				BeforeEach(func() {
					p = Primitive(IntegerKind)
				})

				It("generates the marshaler code", func() {
					expected := `	p = raw`
					Ω(marshaler).Should(Equal(expected))
				})

				It("generates the unmarshaler code", func() {