[from now] 2014/08/26 23:57:51

diff --git a/cmd/copybackup/copybackup.go b/cmd/copybackup/copybackup.go
index cf92872..1664f17 100644
--- a/cmd/copybackup/copybackup.go
+++ b/cmd/copybackup/copybackup.go
@@ -24,8 +24,7 @@ func main() {

 	var e error
 	var wg sync.WaitGroup
-
-	cg := &cb.CopyGroup{}
+	var cg *cb.CopyGroup

 	opts := &Options{}
 	parser := flags.NewParser(opts, flags.Default)
diff --git a/copybackup_test.go b/copybackup_test.go
index 364a0c6..388379d 100644
--- a/copybackup_test.go
+++ b/copybackup_test.go
@@ -2,6 +2,7 @@ package copybackup

 import (
 	"os"
+	"path/filepath"
 	"regexp"
 	"testing"

@@ -11,16 +12,18 @@ import (

 func TestMakeDstPath1(t *testing.T) { // {{{
 	core.Logger, _ = log.NewLogger(os.Stdout, log.TIME_FORMAT_SEC, log.LOG_FORMAT_POWERFUL, log.LogLevel_Debug)
-	src := "/tmp/"
+	pwd, _ := os.Getwd()
+	src := filepath.Join(pwd, "copybackup_test.go")
 	bkpath := "_old"

-	expected := "^/tmp/_old/test_[0-9]{8}-[0-9]{6}$"
+	expected := "^" + pwd + `/_old/copybackup_test_[0-9]{8}-[0-9]{6}\.go$`
 	dst, e := makeDstPath(src, bkpath)
 	if e != nil {
 		t.Error(e)
 	}

 	if m, e := regexp.MatchString(expected, dst); m && e == nil {
+		core.Logger.Infof("dst = [%s]", dst)
 	} else {
 		t.Errorf("expected = [%s] but dst is = [%s]", expected, dst)
 	}
@@ -28,18 +31,27 @@ func TestMakeDstPath1(t *testing.T) { // {{{

 func TestMakeDstPath2(t *testing.T) { // {{{
 	core.Logger, _ = log.NewLogger(os.Stdout, log.TIME_FORMAT_SEC, log.LOG_FORMAT_POWERFUL, log.LogLevel_Debug)
-	src := "/tmp"
+	pwd, _ := os.Getwd()
+	src := filepath.Join(pwd, "copybackup_test.go")
 	bkpath := "/Users/yukimemi/backup"

-	expected := "^/Users/yukimemi/backup/test_[0-9]{8}-[0-9]{6}$"
+	expected := `^/Users/yukimemi/backup/copybackup_test_[0-9]{8}-[0-9]{6}\.go$`
 	dst, e := makeDstPath(src, bkpath)
 	if e != nil {
 		t.Error(e)
 	}

 	if m, e := regexp.MatchString(expected, dst); m && e == nil {
-		core.Logger.Infof("dst := [%s]", dst)
+		core.Logger.Infof("dst = [%s]", dst)
 	} else {
 		t.Errorf("expected = [%s] but dst is = [%s]", expected, dst)
 	}
 } // }}}
+
+func TestCopyGroup(t *testing.T) {
+	core.Logger, _ = log.NewLogger(os.Stdout, log.TIME_FORMAT_SEC, log.LOG_FORMAT_POWERFUL, log.LogLevel_Debug)
+	pwd, _ := os.Getwd()
+	src := filepath.Join(pwd, "copybackup_test.go")
+	cg := NewCopyGroup(src, "_old", 3, 60*10)
+	core.Logger.Infof("cg = [%s]", cg)
+}