Пример #1
0
	JustBeforeEach(func() {
		var err error
		workspace, err = codegen.NewWorkspace("test")
		Ω(err).ShouldNot(HaveOccurred())
		pkg, err := workspace.NewPackage("contexts")
		Ω(err).ShouldNot(HaveOccurred())
		src := pkg.CreateSourceFile("test.go")
		filename = src.Abs()
		writer, err = genapp.NewContextsWriter(filename)
		Ω(err).ShouldNot(HaveOccurred())
		codegen.TempCount = 0
	})

	AfterEach(func() {
		workspace.Delete()
	})

	Context("correctly configured", func() {
		var f *os.File
		BeforeEach(func() {
			f, _ = ioutil.TempFile("", "")
			filename = f.Name()
		})

		AfterEach(func() {
			os.Remove(filename)
		})

		Context("with data", func() {
			var params, headers *design.AttributeDefinition
Пример #2
0
				Ω(err).ShouldNot(HaveOccurred())
			}
		} else {
			designPackage = nil
		}
		m = &meta.Generator{
			Genfunc: genfunc,
			Imports: []*codegen.ImportSpec{codegen.SimpleImport(designPackagePath)},
		}
		codegen.Debug = debug
		codegen.OutputDir = outputDir
		compiledFiles, compileError = m.Generate()
	})

	AfterEach(func() {
		designWorkspace.Delete()
		outputWorkspace.Delete()
	})

	Context("with no GOPATH environment variable", func() {
		var gopath string

		BeforeEach(func() {
			gopath = os.Getenv("GOPATH")
			os.Setenv("GOPATH", "")
		})

		AfterEach(func() {
			os.Setenv("GOPATH", gopath)
		})