Skip to content

Commit

Permalink
go_test: add tests for #2696 (#2698)
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonsinth authored Nov 9, 2020
1 parent 439508e commit bf1b5b9
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tests/legacy/test_chdir/data_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
package test_chdir

import (
"log"
"os"
"testing"
)

const file = "data.txt"

func init() {
_, err := os.Stat(file)
if err != nil {
log.Fatalf("in init(), could not stat %s: %v", file, err)
}
}

func TestMain(m *testing.M) {
_, err := os.Stat(file)
if err != nil {
log.Fatalf("in TestMain(), could not stat %s: %v", file, err)
}
os.Exit(m.Run())
}

func TestLocal(t *testing.T) {
_, err := os.Stat("data.txt")
_, err := os.Stat(file)
if err != nil {
t.Errorf("could not stat local.txt: %v", err)
t.Errorf("could not stat %s: %v", file, err)
}
}

0 comments on commit bf1b5b9

Please sign in to comment.