-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
Support custom path of a test file #1609
base: main
Are you sure you want to change the base?
Conversation
|
||
Document additionalDocument = project.AddDocument( | ||
documentName, | ||
SourceText.From(additionalFiles[i].Source), | ||
filePath: Path.Combine(directoryPath, documentName)); | ||
filePath: Path.Combine(directoryPath, additionalFiles[i].Path ?? documentName)); |
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.
I'd suggest
filePath: Path.Combine(directoryPath, additionalFiles[i].Path ?? documentName)); | |
filePath: Path.Combine(directoryPath, Path.GetDirectoryName(additionalFiles[i].Path ?? documentName), documentName)); |
that should properly process passed paths without file name, like Foo/Bar/
or something like this
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.
I added validation of file path
@@ -362,12 +362,12 @@ internal static (Document document, ImmutableArray<ExpectedDocument> expectedDoc | |||
|
|||
for (int i = 0; i < additionalFiles.Length; i++) | |||
{ | |||
string documentName = AppendNumberToFileName(options.DocumentName, i + 2); | |||
string documentName = Path.GetFileName(additionalFiles[i].Path) ?? AppendNumberToFileName(options.DocumentName, i + 2); |
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.
in case I am providing only a path, it could work erroneously. I do not know how it would behave for cases Foo/Bar
and Foo/Bar/
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.
I added validation of file path
No description provided.