-
Notifications
You must be signed in to change notification settings - Fork 177
Feature/info option #282
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
Feature/info option #282
Conversation
Thanks! |
|
||
public (string output, int exitCode) ExecuteFixture(string fixture, params string[] arguments) | ||
{ | ||
var pathToFixture = Path.Combine("..", "..", "..", "TestFixtures", fixture); |
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.
Reuse GetPathToFixture
here?
|
||
public int ExecuteFixtureInProcess(string fixture, params string[] arguments) | ||
{ | ||
var pathToFixture = Path.Combine("..", "..", "..", "TestFixtures", fixture); |
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.
This is not used. Can be removed as you call GetPathToFixture
below.
{ | ||
var result = ScriptTestRunner.Default.Execute("--version"); | ||
Assert.Equal(0, result.exitCode); | ||
Assert.Matches(@"\d*.\d*.\d*", result.output); |
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.
This is an incorrect test. It says match 3 Unicode digit separated by anything and which appears anywhere in the output. What's more, since the Unicode digits are optional (*
), it will also match 3 of anything! The right test would be:
Assert.Matches(@"^[0-9]+(\.[0-9]+){2}$", result.output);
However, this test is still somewhat inaccurate. If you run dotnet script --version
, the output is:
0.23.0
The trouble here is that there is a leading blank line! The test shouldn't be passing but looks like it does because ProcessHelper.RunAndCaptureOutput
trims the output:
Ideally trimming should be decision of the caller.
Never mind my review, this got merged while I was writing up. 😛 |
This PR adds support for the
--info
option that displays environmental information related to resolving dependencies, compiling and executing scripts.yields
while
yields
Also added the
ScriptTestRunner
class as a start to clean up much of the stuff going on in tests.There is currently a lot of duplication of code related to script arguments and such.
Will do an overall cleanup in a separate PR 👍