Skip to content

Added fsx evaluation/running to new testing framework. - #10106

Merged
vzarytovskii merged 2 commits into
dotnet:mainfrom
vzarytovskii:eval-and-run-fsx
Sep 12, 2020
Merged

Added fsx evaluation/running to new testing framework.#10106
vzarytovskii merged 2 commits into
dotnet:mainfrom
vzarytovskii:eval-and-run-fsx

Conversation

@vzarytovskii

@vzarytovskiivzarytovskii commented Sep 11, 2020

Copy link
Copy Markdown
Member

F# scripts can be evaluated via

  • New framework function eval, takes CompilationUnit, returns result of evaluation (uses FSharpScript.Eval under the hood) - returns result of evaluation + diagnostics + FsiValue, which can be examined (for now, only 2 functions were added, for checking type and value, withEvalTypeEquals and withEvalValueEquals respectively. More can be added later as needed.)

  • New framework function runFsi, takes CompilationUnit, returns result of evaluation (uses FsiEvaluationSession.EvalInteractionNonThrowing under the hood) - will just run the script and return the result + output. Does not return FSharpErrorInfo, so need to check STDERR explicitly via withStdErrContains. Basically, a wrapper around CompilerAssert's RunScriptWithOptions.

Addresses #9836

Comment threadeng/Build.ps1

function TestUsingXUnit([string] $testProject, [string] $targetFramework, [string]$testadapterpath) {
TestUsingMsBuild -testProject $testProject -targetFramework $targetFramework -testadapterpath $testadapterpath -noTestFilter $false
TestUsingMsBuild -testProject $testProject -targetFramework $targetFramework -testadapterpath $testadapterpath -noTestFilter $true

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't add tests filters, since xUnit doesn't understand it.

@vzarytovskii

Copy link
Copy Markdown
MemberAuthor

Ugh, macOS timeouts strike again. Will re-queue.

@TIHanTIHan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@KevinRansomKevinRansom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, thanks for this.

Kevin

@cartermp

Copy link
Copy Markdown
Contributor

mmmmmm yeah that lovely macos timeout, yeeeehaw

@cartermpcartermp reopened this Sep 12, 2020
@vzarytovskii
vzarytovskii merged commit 1b5d58d into dotnet:mainSep 12, 2020
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
* Added fsx evaluation via the FSharpScript.Eval as well as FsiEvaluationSession.EvalInteractionNonThrowing
* Turn off test filter for XUnit, and add to NUnit
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@vzarytovskii@cartermp@TIHan@KevinRansom