diff --git a/all_test.go b/all_test.go index fbd12e5..6256b0b 100644 --- a/all_test.go +++ b/all_test.go @@ -475,3 +475,17 @@ func (r *SleepyReader) Read(p []byte) (int, error) { } return n, e } + +func TestOptions_NumberOfWorkers(t *testing.T) { + opt := Options{NumberOfWorkers: 3} + err := Copy("test/data/case19", "test/data.copy/case19", opt) + Expect(t, err).ToBe(nil) +} + +func TestOptions_PreferConcurrent(t *testing.T) { + opt := Options{NumberOfWorkers: 4, PreferConcurrent: func(sd, dd string) (bool, error) { + return strings.HasSuffix(sd, "concurrent"), nil + }} + err := Copy("test/data/case19", "test/data.copy/case19_preferconcurrent", opt) + Expect(t, err).ToBe(nil) +} diff --git a/test/data/case19/README.md b/test/data/case19/README.md new file mode 100644 index 0000000..0c54877 --- /dev/null +++ b/test/data/case19/README.md @@ -0,0 +1 @@ +# Concurrent case \ No newline at end of file diff --git a/test/data/case19/bar_sequential/aaa.txt b/test/data/case19/bar_sequential/aaa.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/data/case19/bar_sequential/bbb.txt b/test/data/case19/bar_sequential/bbb.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/data/case19/foo_concurrent/ccc.txt b/test/data/case19/foo_concurrent/ccc.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/data/case19/foo_concurrent/ddd.txt b/test/data/case19/foo_concurrent/ddd.txt new file mode 100644 index 0000000..e69de29