2017-09-01 22:21:46 +08:00
|
|
|
// Internal tests for march
|
2017-07-01 04:24:13 +08:00
|
|
|
|
2018-01-13 00:30:54 +08:00
|
|
|
package march
|
2017-07-01 04:24:13 +08:00
|
|
|
|
|
|
|
import (
|
2019-08-05 19:43:39 +08:00
|
|
|
"context"
|
|
|
|
"errors"
|
2019-06-09 22:57:05 +08:00
|
|
|
"fmt"
|
2017-09-08 23:19:41 +08:00
|
|
|
"strings"
|
2019-08-05 19:43:39 +08:00
|
|
|
"sync"
|
2017-07-01 04:24:13 +08:00
|
|
|
"testing"
|
|
|
|
|
2019-08-05 19:43:39 +08:00
|
|
|
_ "github.com/rclone/rclone/backend/local"
|
2019-07-29 01:47:38 +08:00
|
|
|
"github.com/rclone/rclone/fs"
|
2019-08-05 19:43:39 +08:00
|
|
|
"github.com/rclone/rclone/fs/filter"
|
|
|
|
"github.com/rclone/rclone/fs/fserrors"
|
|
|
|
"github.com/rclone/rclone/fstest"
|
2019-07-29 01:47:38 +08:00
|
|
|
"github.com/rclone/rclone/fstest/mockdir"
|
|
|
|
"github.com/rclone/rclone/fstest/mockobject"
|
2017-07-01 04:24:13 +08:00
|
|
|
"github.com/stretchr/testify/assert"
|
2019-08-05 19:43:39 +08:00
|
|
|
"github.com/stretchr/testify/require"
|
2017-07-01 04:24:13 +08:00
|
|
|
)
|
|
|
|
|
2019-08-05 19:43:39 +08:00
|
|
|
// Some times used in the tests
|
|
|
|
var (
|
|
|
|
t1 = fstest.Time("2001-02-03T04:05:06.499999999Z")
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMain(m *testing.M) {
|
|
|
|
fstest.TestMain(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
type marchTester struct {
|
|
|
|
ctx context.Context // internal context for controlling go-routines
|
|
|
|
cancel func() // cancel the context
|
|
|
|
srcOnly fs.DirEntries
|
|
|
|
dstOnly fs.DirEntries
|
|
|
|
match fs.DirEntries
|
|
|
|
entryMutex sync.Mutex
|
|
|
|
errorMu sync.Mutex // Mutex covering the error variables
|
|
|
|
err error
|
|
|
|
noRetryErr error
|
|
|
|
fatalErr error
|
|
|
|
noTraverse bool
|
|
|
|
}
|
|
|
|
|
|
|
|
// DstOnly have an object which is in the destination only
|
|
|
|
func (mt *marchTester) DstOnly(dst fs.DirEntry) (recurse bool) {
|
|
|
|
mt.entryMutex.Lock()
|
|
|
|
mt.dstOnly = append(mt.dstOnly, dst)
|
|
|
|
mt.entryMutex.Unlock()
|
|
|
|
|
|
|
|
switch dst.(type) {
|
|
|
|
case fs.Object:
|
|
|
|
return false
|
|
|
|
case fs.Directory:
|
|
|
|
return true
|
|
|
|
default:
|
|
|
|
panic("Bad object in DirEntries")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SrcOnly have an object which is in the source only
|
|
|
|
func (mt *marchTester) SrcOnly(src fs.DirEntry) (recurse bool) {
|
|
|
|
mt.entryMutex.Lock()
|
|
|
|
mt.srcOnly = append(mt.srcOnly, src)
|
|
|
|
mt.entryMutex.Unlock()
|
|
|
|
|
|
|
|
switch src.(type) {
|
|
|
|
case fs.Object:
|
|
|
|
return false
|
|
|
|
case fs.Directory:
|
|
|
|
return true
|
|
|
|
default:
|
|
|
|
panic("Bad object in DirEntries")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Match is called when src and dst are present, so sync src to dst
|
|
|
|
func (mt *marchTester) Match(ctx context.Context, dst, src fs.DirEntry) (recurse bool) {
|
|
|
|
mt.entryMutex.Lock()
|
|
|
|
mt.match = append(mt.match, src)
|
|
|
|
mt.entryMutex.Unlock()
|
|
|
|
|
|
|
|
switch src.(type) {
|
|
|
|
case fs.Object:
|
|
|
|
return false
|
|
|
|
case fs.Directory:
|
|
|
|
// Do the same thing to the entire contents of the directory
|
|
|
|
_, ok := dst.(fs.Directory)
|
|
|
|
if ok {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
// FIXME src is dir, dst is file
|
|
|
|
err := errors.New("can't overwrite file with directory")
|
|
|
|
fs.Errorf(dst, "%v", err)
|
|
|
|
mt.processError(err)
|
|
|
|
default:
|
|
|
|
panic("Bad object in DirEntries")
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mt *marchTester) processError(err error) {
|
|
|
|
if err == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
mt.errorMu.Lock()
|
|
|
|
defer mt.errorMu.Unlock()
|
|
|
|
switch {
|
|
|
|
case fserrors.IsFatalError(err):
|
|
|
|
if !mt.aborting() {
|
|
|
|
fs.Errorf(nil, "Cancelling sync due to fatal error: %v", err)
|
|
|
|
mt.cancel()
|
|
|
|
}
|
|
|
|
mt.fatalErr = err
|
|
|
|
case fserrors.IsNoRetryError(err):
|
|
|
|
mt.noRetryErr = err
|
|
|
|
default:
|
|
|
|
mt.err = err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mt *marchTester) currentError() error {
|
|
|
|
mt.errorMu.Lock()
|
|
|
|
defer mt.errorMu.Unlock()
|
|
|
|
if mt.fatalErr != nil {
|
|
|
|
return mt.fatalErr
|
|
|
|
}
|
|
|
|
if mt.err != nil {
|
|
|
|
return mt.err
|
|
|
|
}
|
|
|
|
return mt.noRetryErr
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mt *marchTester) aborting() bool {
|
|
|
|
return mt.ctx.Err() != nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMarch(t *testing.T) {
|
|
|
|
for _, test := range []struct {
|
|
|
|
what string
|
|
|
|
fileSrcOnly []string
|
|
|
|
dirSrcOnly []string
|
|
|
|
fileDstOnly []string
|
|
|
|
dirDstOnly []string
|
|
|
|
fileMatch []string
|
|
|
|
dirMatch []string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
what: "source only",
|
|
|
|
fileSrcOnly: []string{"test", "test2", "test3", "sub dir/test4"},
|
|
|
|
dirSrcOnly: []string{"sub dir"},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "identical",
|
|
|
|
fileMatch: []string{"test", "test2", "sub dir/test3", "sub dir/sub sub dir/test4"},
|
|
|
|
dirMatch: []string{"sub dir", "sub dir/sub sub dir"},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "typical sync",
|
|
|
|
fileSrcOnly: []string{"srcOnly", "srcOnlyDir/sub"},
|
|
|
|
dirSrcOnly: []string{"srcOnlyDir"},
|
|
|
|
fileMatch: []string{"match", "matchDir/match file"},
|
|
|
|
dirMatch: []string{"matchDir"},
|
|
|
|
fileDstOnly: []string{"dstOnly", "dstOnlyDir/sub"},
|
|
|
|
dirDstOnly: []string{"dstOnlyDir"},
|
|
|
|
},
|
|
|
|
} {
|
|
|
|
t.Run(fmt.Sprintf("TestMarch-%s", test.what), func(t *testing.T) {
|
|
|
|
r := fstest.NewRun(t)
|
|
|
|
defer r.Finalise()
|
|
|
|
|
|
|
|
var srcOnly []fstest.Item
|
|
|
|
var dstOnly []fstest.Item
|
|
|
|
var match []fstest.Item
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
|
|
|
|
for _, f := range test.fileSrcOnly {
|
|
|
|
srcOnly = append(srcOnly, r.WriteFile(f, "hello world", t1))
|
|
|
|
}
|
|
|
|
for _, f := range test.fileDstOnly {
|
|
|
|
dstOnly = append(dstOnly, r.WriteObject(ctx, f, "hello world", t1))
|
|
|
|
}
|
|
|
|
for _, f := range test.fileMatch {
|
|
|
|
match = append(match, r.WriteBoth(ctx, f, "hello world", t1))
|
|
|
|
}
|
|
|
|
|
|
|
|
mt := &marchTester{
|
|
|
|
ctx: ctx,
|
|
|
|
cancel: cancel,
|
|
|
|
noTraverse: false,
|
|
|
|
}
|
|
|
|
m := &March{
|
|
|
|
Ctx: ctx,
|
|
|
|
Fdst: r.Fremote,
|
|
|
|
Fsrc: r.Flocal,
|
|
|
|
Dir: "",
|
|
|
|
NoTraverse: mt.noTraverse,
|
|
|
|
Callback: mt,
|
|
|
|
DstIncludeAll: filter.Active.Opt.DeleteExcluded,
|
|
|
|
}
|
|
|
|
|
|
|
|
mt.processError(m.Run())
|
|
|
|
mt.cancel()
|
|
|
|
err := mt.currentError()
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2019-08-17 17:28:44 +08:00
|
|
|
precision := fs.GetModifyWindow(r.Fremote, r.Flocal)
|
|
|
|
fstest.CompareItems(t, mt.srcOnly, srcOnly, test.dirSrcOnly, precision, "srcOnly")
|
|
|
|
fstest.CompareItems(t, mt.dstOnly, dstOnly, test.dirDstOnly, precision, "dstOnly")
|
|
|
|
fstest.CompareItems(t, mt.match, match, test.dirMatch, precision, "match")
|
2019-08-05 19:43:39 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMarchNoTraverse(t *testing.T) {
|
|
|
|
for _, test := range []struct {
|
|
|
|
what string
|
|
|
|
fileSrcOnly []string
|
|
|
|
dirSrcOnly []string
|
|
|
|
fileMatch []string
|
|
|
|
dirMatch []string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
what: "source only",
|
|
|
|
fileSrcOnly: []string{"test", "test2", "test3", "sub dir/test4"},
|
|
|
|
dirSrcOnly: []string{"sub dir"},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "identical",
|
|
|
|
fileMatch: []string{"test", "test2", "sub dir/test3", "sub dir/sub sub dir/test4"},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "typical sync",
|
|
|
|
fileSrcOnly: []string{"srcOnly", "srcOnlyDir/sub"},
|
|
|
|
fileMatch: []string{"match", "matchDir/match file"},
|
|
|
|
},
|
|
|
|
} {
|
|
|
|
t.Run(fmt.Sprintf("TestMarch-%s", test.what), func(t *testing.T) {
|
|
|
|
r := fstest.NewRun(t)
|
|
|
|
defer r.Finalise()
|
|
|
|
|
|
|
|
var srcOnly []fstest.Item
|
|
|
|
var match []fstest.Item
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
|
|
|
|
for _, f := range test.fileSrcOnly {
|
|
|
|
srcOnly = append(srcOnly, r.WriteFile(f, "hello world", t1))
|
|
|
|
}
|
|
|
|
for _, f := range test.fileMatch {
|
|
|
|
match = append(match, r.WriteBoth(ctx, f, "hello world", t1))
|
|
|
|
}
|
|
|
|
|
|
|
|
mt := &marchTester{
|
|
|
|
ctx: ctx,
|
|
|
|
cancel: cancel,
|
|
|
|
noTraverse: true,
|
|
|
|
}
|
|
|
|
m := &March{
|
|
|
|
Ctx: ctx,
|
|
|
|
Fdst: r.Fremote,
|
|
|
|
Fsrc: r.Flocal,
|
|
|
|
Dir: "",
|
|
|
|
NoTraverse: mt.noTraverse,
|
|
|
|
Callback: mt,
|
|
|
|
DstIncludeAll: filter.Active.Opt.DeleteExcluded,
|
|
|
|
}
|
|
|
|
|
|
|
|
mt.processError(m.Run())
|
|
|
|
mt.cancel()
|
|
|
|
err := mt.currentError()
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2019-08-17 17:28:44 +08:00
|
|
|
precision := fs.GetModifyWindow(r.Fremote, r.Flocal)
|
|
|
|
fstest.CompareItems(t, mt.srcOnly, srcOnly, test.dirSrcOnly, precision, "srcOnly")
|
|
|
|
fstest.CompareItems(t, mt.match, match, test.dirMatch, precision, "match")
|
2019-08-05 19:43:39 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-08 23:19:41 +08:00
|
|
|
func TestNewMatchEntries(t *testing.T) {
|
|
|
|
var (
|
2018-01-13 00:30:54 +08:00
|
|
|
a = mockobject.Object("path/a")
|
|
|
|
A = mockobject.Object("path/A")
|
|
|
|
B = mockobject.Object("path/B")
|
|
|
|
c = mockobject.Object("path/c")
|
2017-09-08 23:19:41 +08:00
|
|
|
)
|
|
|
|
|
2018-01-13 00:30:54 +08:00
|
|
|
es := newMatchEntries(fs.DirEntries{a, A, B, c}, nil)
|
2017-09-08 23:19:41 +08:00
|
|
|
assert.Equal(t, es, matchEntries{
|
|
|
|
{name: "A", leaf: "A", entry: A},
|
|
|
|
{name: "B", leaf: "B", entry: B},
|
|
|
|
{name: "a", leaf: "a", entry: a},
|
|
|
|
{name: "c", leaf: "c", entry: c},
|
|
|
|
})
|
|
|
|
|
2018-01-13 00:30:54 +08:00
|
|
|
es = newMatchEntries(fs.DirEntries{a, A, B, c}, []matchTransformFn{strings.ToLower})
|
2017-09-08 23:19:41 +08:00
|
|
|
assert.Equal(t, es, matchEntries{
|
|
|
|
{name: "a", leaf: "A", entry: A},
|
|
|
|
{name: "a", leaf: "a", entry: a},
|
|
|
|
{name: "b", leaf: "B", entry: B},
|
|
|
|
{name: "c", leaf: "c", entry: c},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2017-07-01 04:24:13 +08:00
|
|
|
func TestMatchListings(t *testing.T) {
|
|
|
|
var (
|
2019-06-09 22:57:05 +08:00
|
|
|
a = mockobject.Object("a")
|
|
|
|
A = mockobject.Object("A")
|
|
|
|
b = mockobject.Object("b")
|
|
|
|
c = mockobject.Object("c")
|
|
|
|
d = mockobject.Object("d")
|
|
|
|
dirA = mockdir.New("A")
|
|
|
|
dirb = mockdir.New("b")
|
2017-07-01 04:24:13 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
for _, test := range []struct {
|
2017-09-08 23:19:41 +08:00
|
|
|
what string
|
2018-01-13 00:30:54 +08:00
|
|
|
input fs.DirEntries // pairs of input src, dst
|
|
|
|
srcOnly fs.DirEntries
|
|
|
|
dstOnly fs.DirEntries
|
2017-09-08 23:19:41 +08:00
|
|
|
matches []matchPair // pairs of output
|
|
|
|
transforms []matchTransformFn
|
2017-07-01 04:24:13 +08:00
|
|
|
}{
|
|
|
|
{
|
|
|
|
what: "only src or dst",
|
2018-01-13 00:30:54 +08:00
|
|
|
input: fs.DirEntries{
|
2017-07-01 04:24:13 +08:00
|
|
|
a, nil,
|
|
|
|
b, nil,
|
|
|
|
c, nil,
|
|
|
|
d, nil,
|
|
|
|
},
|
2018-01-13 00:30:54 +08:00
|
|
|
srcOnly: fs.DirEntries{
|
2017-07-01 04:24:13 +08:00
|
|
|
a, b, c, d,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "typical sync #1",
|
2018-01-13 00:30:54 +08:00
|
|
|
input: fs.DirEntries{
|
2017-07-01 04:24:13 +08:00
|
|
|
a, nil,
|
|
|
|
b, b,
|
|
|
|
nil, c,
|
|
|
|
nil, d,
|
|
|
|
},
|
2018-01-13 00:30:54 +08:00
|
|
|
srcOnly: fs.DirEntries{
|
2017-07-01 04:24:13 +08:00
|
|
|
a,
|
|
|
|
},
|
2018-01-13 00:30:54 +08:00
|
|
|
dstOnly: fs.DirEntries{
|
2017-07-01 04:24:13 +08:00
|
|
|
c, d,
|
|
|
|
},
|
|
|
|
matches: []matchPair{
|
|
|
|
{b, b},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "typical sync #2",
|
2018-01-13 00:30:54 +08:00
|
|
|
input: fs.DirEntries{
|
2017-07-01 04:24:13 +08:00
|
|
|
a, a,
|
|
|
|
b, b,
|
|
|
|
nil, c,
|
|
|
|
d, d,
|
|
|
|
},
|
2018-01-13 00:30:54 +08:00
|
|
|
dstOnly: fs.DirEntries{
|
2017-07-01 04:24:13 +08:00
|
|
|
c,
|
|
|
|
},
|
|
|
|
matches: []matchPair{
|
|
|
|
{a, a},
|
|
|
|
{b, b},
|
|
|
|
{d, d},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "One duplicate",
|
2018-01-13 00:30:54 +08:00
|
|
|
input: fs.DirEntries{
|
2017-10-02 23:52:53 +08:00
|
|
|
A, A,
|
2017-07-01 04:24:13 +08:00
|
|
|
a, a,
|
|
|
|
a, nil,
|
2017-10-02 23:52:53 +08:00
|
|
|
b, b,
|
2017-07-01 04:24:13 +08:00
|
|
|
},
|
|
|
|
matches: []matchPair{
|
2017-10-02 23:52:53 +08:00
|
|
|
{A, A},
|
2017-07-01 04:24:13 +08:00
|
|
|
{a, a},
|
2017-10-02 23:52:53 +08:00
|
|
|
{b, b},
|
2017-07-01 04:24:13 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "Two duplicates",
|
2018-01-13 00:30:54 +08:00
|
|
|
input: fs.DirEntries{
|
2017-07-01 04:24:13 +08:00
|
|
|
a, a,
|
|
|
|
a, a,
|
|
|
|
a, nil,
|
|
|
|
},
|
|
|
|
matches: []matchPair{
|
|
|
|
{a, a},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2017-09-08 23:19:41 +08:00
|
|
|
what: "Case insensitive duplicate - no transform",
|
2018-01-13 00:30:54 +08:00
|
|
|
input: fs.DirEntries{
|
2017-09-08 23:19:41 +08:00
|
|
|
a, a,
|
|
|
|
A, A,
|
|
|
|
},
|
|
|
|
matches: []matchPair{
|
|
|
|
{A, A},
|
|
|
|
{a, a},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "Case insensitive duplicate - transform to lower case",
|
2018-01-13 00:30:54 +08:00
|
|
|
input: fs.DirEntries{
|
2017-09-08 23:19:41 +08:00
|
|
|
a, a,
|
|
|
|
A, A,
|
|
|
|
},
|
|
|
|
matches: []matchPair{
|
|
|
|
{A, A},
|
|
|
|
},
|
|
|
|
transforms: []matchTransformFn{strings.ToLower},
|
|
|
|
},
|
2019-06-09 22:57:05 +08:00
|
|
|
{
|
|
|
|
what: "File and directory are not duplicates - srcOnly",
|
|
|
|
input: fs.DirEntries{
|
|
|
|
dirA, nil,
|
|
|
|
A, nil,
|
|
|
|
},
|
|
|
|
srcOnly: fs.DirEntries{
|
|
|
|
dirA,
|
|
|
|
A,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "File and directory are not duplicates - matches",
|
|
|
|
input: fs.DirEntries{
|
|
|
|
dirA, dirA,
|
|
|
|
A, A,
|
|
|
|
},
|
|
|
|
matches: []matchPair{
|
|
|
|
{dirA, dirA},
|
|
|
|
{A, A},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "Sync with directory #1",
|
|
|
|
input: fs.DirEntries{
|
|
|
|
dirA, nil,
|
|
|
|
A, nil,
|
|
|
|
b, b,
|
|
|
|
nil, c,
|
|
|
|
nil, d,
|
|
|
|
},
|
|
|
|
srcOnly: fs.DirEntries{
|
|
|
|
dirA,
|
|
|
|
A,
|
|
|
|
},
|
|
|
|
dstOnly: fs.DirEntries{
|
|
|
|
c, d,
|
|
|
|
},
|
|
|
|
matches: []matchPair{
|
|
|
|
{b, b},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
what: "Sync with 2 directories",
|
|
|
|
input: fs.DirEntries{
|
|
|
|
dirA, dirA,
|
|
|
|
A, nil,
|
|
|
|
nil, dirb,
|
|
|
|
nil, b,
|
|
|
|
},
|
|
|
|
srcOnly: fs.DirEntries{
|
|
|
|
A,
|
|
|
|
},
|
|
|
|
dstOnly: fs.DirEntries{
|
|
|
|
dirb,
|
|
|
|
b,
|
|
|
|
},
|
|
|
|
matches: []matchPair{
|
|
|
|
{dirA, dirA},
|
|
|
|
},
|
|
|
|
},
|
2017-07-01 04:24:13 +08:00
|
|
|
} {
|
2019-06-09 22:57:05 +08:00
|
|
|
t.Run(fmt.Sprintf("TestMatchListings-%s", test.what), func(t *testing.T) {
|
|
|
|
var srcList, dstList fs.DirEntries
|
|
|
|
for i := 0; i < len(test.input); i += 2 {
|
|
|
|
src, dst := test.input[i], test.input[i+1]
|
|
|
|
if src != nil {
|
|
|
|
srcList = append(srcList, src)
|
|
|
|
}
|
|
|
|
if dst != nil {
|
|
|
|
dstList = append(dstList, dst)
|
|
|
|
}
|
2017-07-01 04:24:13 +08:00
|
|
|
}
|
2019-06-09 22:57:05 +08:00
|
|
|
srcOnly, dstOnly, matches := matchListings(srcList, dstList, test.transforms)
|
|
|
|
assert.Equal(t, test.srcOnly, srcOnly, test.what, "srcOnly differ")
|
|
|
|
assert.Equal(t, test.dstOnly, dstOnly, test.what, "dstOnly differ")
|
|
|
|
assert.Equal(t, test.matches, matches, test.what, "matches differ")
|
|
|
|
// now swap src and dst
|
|
|
|
dstOnly, srcOnly, matches = matchListings(dstList, srcList, test.transforms)
|
|
|
|
assert.Equal(t, test.srcOnly, srcOnly, test.what, "srcOnly differ")
|
|
|
|
assert.Equal(t, test.dstOnly, dstOnly, test.what, "dstOnly differ")
|
|
|
|
assert.Equal(t, test.matches, matches, test.what, "matches differ")
|
|
|
|
})
|
2017-07-01 04:24:13 +08:00
|
|
|
}
|
|
|
|
}
|