示例#1
0
文件: app_test.go 项目: mbrodala/otto
func TestApp_importPath(t *testing.T) {
	gopath := filepath.Join("./test-fixtures", "gopath")

	compile.AppTest(true)
	defer compile.AppTest(false)

	// No GOPATH can be set
	defer os.Setenv("GOPATH", os.Getenv("GOPATH"))
	os.Setenv("GOPATH", gopath)

	otto.Test(t, otto.TestCase{
		Unit: true,
		Core: otto.TestCore(t, &otto.TestCoreOpts{
			Path: filepath.Join(gopath, "src", "example.com", "Appfile"),
			App:  new(App),
		}),

		Steps: []otto.TestStep{
			&compile.AppTestStepContext{
				Key:   "import_path",
				Value: "example.com",
			},

			&compile.AppTestStepContext{
				Key:   "shared_folder_path",
				Value: "/opt/gopath/src/example.com",
			},
		},
	})
}
示例#2
0
文件: app_test.go 项目: mbrodala/otto
func TestApp_importPath_noGOPATH(t *testing.T) {
	compile.AppTest(true)
	defer compile.AppTest(false)

	// No GOPATH can be set
	defer os.Setenv("GOPATH", os.Getenv("GOPATH"))
	os.Setenv("GOPATH", "")

	otto.Test(t, otto.TestCase{
		Unit: true,
		Core: otto.TestCore(t, &otto.TestCoreOpts{
			Path: filepath.Join("./test-fixtures", "basic", "Appfile"),
			App:  new(App),
		}),

		Steps: []otto.TestStep{
			&compile.AppTestStepContext{
				Key:   "import_path",
				Value: "",
			},

			&compile.AppTestStepContext{
				Key:   "shared_folder_path",
				Value: "/vagrant",
			},
		},
	})
}
示例#3
0
func TestApp_dev_detectGemfile(t *testing.T) {
	otto.Test(t, otto.TestCase{
		Core: otto.TestCore(t, &otto.TestCoreOpts{
			Path: filepath.Join("./test-fixtures", "detect-gemfile", "Appfile"),
			App:  new(App),
		}),

		Steps: []otto.TestStep{
			&vagrant.DevTestStepInit{},

			// Verify we have Ruby
			&vagrant.DevTestStepGuestScript{
				Command: "ruby --version | grep '2.1'",
			},
			&vagrant.DevTestStepGuestScript{
				Command: "bundle --version",
			},

			// Verify everything works
			&vagrant.DevTestStepGuestScript{
				Command: "bundle exec ruby app.rb | grep hello",
			},
		},

		Teardown: vagrant.DevTestTeardown,
	})
}
func TestApp_dev(t *testing.T) {
	otto.Test(t, otto.TestCase{
		Core: otto.TestCore(t, &otto.TestCoreOpts{
			Path: filepath.Join("./test-fixtures", "basic", "Appfile"),
			App:  new(App),
		}),

		Steps: []otto.TestStep{
			&vagrant.DevTestStepInit{},

			// Verify we have Node
			&vagrant.DevTestStepGuestScript{
				Command: "node --version",
			},
		},

		Teardown: vagrant.DevTestTeardown,
	})
}
示例#5
0
func TestApp_dev(t *testing.T) {
	otto.Test(t, otto.TestCase{
		Core: otto.TestCore(t, &otto.TestCoreOpts{
			Path: filepath.Join("./test-fixtures", "basic", "Appfile"),
			App:  new(App),
		}),

		Steps: []otto.TestStep{
			&vagrant.DevTestStepInit{},

			// Verify we have Go
			&vagrant.DevTestStepGuestScript{
				Command: "go version",
			},

			// Verify we can build immediately (we should be in the directory)
			&vagrant.DevTestStepGuestScript{
				Command: "grep '42' <<< $(go build -o test-output && ./test-output 2>&1)",
			},
		},

		Teardown: vagrant.DevTestTeardown,
	})
}