summaryrefslogtreecommitdiff
path: root/integration_test.go
diff options
context:
space:
mode:
authorWeijia Wang <wjwang13@fudan.edu.cn>2018-06-05 16:07:40 +0800
committerRyan Dahl <ry@tinyclouds.org>2018-06-05 10:07:40 +0200
commit8094c7421b50d3cbbc0eace6d376d7ed31b3cfa1 (patch)
tree183ec11b6a4200f479350eb309869f5b3ce80dc7 /integration_test.go
parent874db2a334eeaccd5f991e1e979073d75ba2932b (diff)
Use check() to improve error check (#139)
Diffstat (limited to 'integration_test.go')
-rw-r--r--integration_test.go21
1 files changed, 6 insertions, 15 deletions
diff --git a/integration_test.go b/integration_test.go
index 95452b049..2d1cbdbea 100644
--- a/integration_test.go
+++ b/integration_test.go
@@ -21,22 +21,17 @@ var denoFn string
// so if the server runs on a different port, it will fail.
func startServer() {
l, err := net.Listen("tcp", ":4545")
- if err != nil {
- panic(err)
- }
+ check(err)
rootHandler := http.FileServer(http.Dir("."))
go func() {
- if err := http.Serve(l, rootHandler); err != nil {
- panic(err)
- }
+ err := http.Serve(l, rootHandler)
+ check(err)
}()
}
func listTestFiles() []string {
files, err := ioutil.ReadDir("testdata")
- if err != nil {
- panic(err)
- }
+ check(err)
out := make([]string, 0)
for _, file := range files {
fn := file.Name()
@@ -72,9 +67,7 @@ func checkOutput(t *testing.T, outFile string, shouldSucceed bool) {
func deno(inputFn string) (actual []byte, cachedir string, err error) {
cachedir, err = ioutil.TempDir("", "TestIntegration")
- if err != nil {
- panic(err)
- }
+ check(err)
cmd := exec.Command(denoFn, "--cachedir="+cachedir, inputFn)
var out bytes.Buffer
@@ -89,9 +82,7 @@ func integrationTestSetup() {
if denoFn == "" {
startServer()
cwd, err := os.Getwd()
- if err != nil {
- panic(err)
- }
+ check(err)
denoFn = path.Join(cwd, "deno")
}
}