-
-
Notifications
You must be signed in to change notification settings - Fork 116
Add tests that break expectation for Options.FS
#162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,6 +135,30 @@ func TestCopy(t *testing.T) { | |
| err = Copy(src, dest, opt) | ||
| Expect(t, err).ToBe(nil) | ||
| }) | ||
| When(t, "fs copy should not write outside fs", func(t *testing.T) { | ||
| subdir := t.TempDir() | ||
| subfs := os.DirFS(subdir) | ||
|
|
||
| // Copy assets to subdir so that they're available for fs. | ||
| src := "test/data/case18/assets" | ||
| err := Copy(src, filepath.Join(subdir, src)) | ||
| Expect(t, err).ToBe(nil) | ||
|
|
||
| // Define a new destination for the assets in the subdir so they are reachable. | ||
| dest := "test/data.copy/case18/assets" | ||
| err = Copy(src, dest, Options{FS: subfs}) | ||
| Expect(t, err).ToBe(nil) | ||
|
|
||
| _, err = os.Stat(filepath.Join(subdir, dest)) | ||
| Expect(t, err).ToBe(nil) | ||
| }) | ||
| When(t, "fs copy relative when fs is root", func(t *testing.T) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could roll the ball either way whether or not this is an error or a feature. Here OTOH, when providing the |
||
| dest := t.TempDir() | ||
| err := Copy("test/data/case18/assets", dest, Options{ | ||
| FS: os.DirFS("/"), | ||
| }) | ||
| Expect(t, err).ToBe(nil) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. // Note to myself @otiai10 : This line is failing as of now https://github.com/otiai10/copy/actions/runs/10471541423/job/29006044545?pr=162 |
||
| }) | ||
| } | ||
|
|
||
| func TestCopy_NamedPipe(t *testing.T) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Note to myself @otiai10 : This line is failing as of now https://github.com/otiai10/copy/actions/runs/10471541423/job/29006044545?pr=162