From c7381036ced2f01eaf44354b320b47a6874aef0b Mon Sep 17 00:00:00 2001 From: Hiromu Ochiai Date: Wed, 20 Mar 2019 09:35:36 +0900 Subject: [PATCH] Setup testdata for symlink before testing, Fix #11 --- all_test.go | 14 ++++++++++++-- testdata/case03/case01 | 1 - 2 files changed, 12 insertions(+), 3 deletions(-) delete mode 120000 testdata/case03/case01 diff --git a/all_test.go b/all_test.go index cb0edb1..a80777d 100644 --- a/all_test.go +++ b/all_test.go @@ -9,12 +9,22 @@ import ( ) func TestMain(m *testing.M) { - os.MkdirAll("testdata.copy", os.ModePerm) + setup(m) code := m.Run() - os.RemoveAll("testdata.copy") + teardown(m) os.Exit(code) } +func setup(m *testing.M) { + os.MkdirAll("testdata.copy", os.ModePerm) + os.Symlink("testdata/case01", "testdata/case03/case01") +} + +func teardown(m *testing.M) { + os.RemoveAll("testdata/case03/case01") + os.RemoveAll("testdata.copy") +} + func TestCopy(t *testing.T) { err := Copy("./testdata/case00", "./testdata.copy/case00") diff --git a/testdata/case03/case01 b/testdata/case03/case01 deleted file mode 120000 index 091feb4..0000000 --- a/testdata/case03/case01 +++ /dev/null @@ -1 +0,0 @@ -./testdata/case01 \ No newline at end of file