Skip to content

Baseline parser tests - #14721

Merged
abonie merged 8 commits into
dotnet:mainfrom
nojaf:parsing-tests
Feb 10, 2023
Merged

Baseline parser tests#14721
abonie merged 8 commits into
dotnet:mainfrom
nojaf:parsing-tests

Conversation

@nojaf

@nojafnojaf commented Feb 9, 2023

Copy link
Copy Markdown
Contributor

This is a first attempt at tackling #13484.

I migrated the existing parser tests (which asserted patterns in the AST) with baseline tests.
These tests will be more interesting to detect regressions early on.

@nojaf
nojaf requested a review from a team as a code ownerFebruary 9, 2023 10:08
@nojaf
nojaf requested a review from auduchinokFebruary 9, 2023 10:08

@auduchinokauduchinok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@nojaf This is really cool!

Maybe we could move the files into subfolders, mimicking the file structure that was there before:

tests/service/data/SyntaxTree/Type/...
tests/service/data/SyntaxTree/Expression/...
tests/service/data/SyntaxTree/ModuleOrNamespace/...

We'll likely add a lot of these files, so maybe we could have some organization strategy from the start.
Otherwise, we could have this kind of structure in the file names, but I think it'll be much more difficult to maintain when there're many contributors.

Comment threadtests/service/data/SyntaxTree/AbstractKeyword.fs Outdated
Comment threadtests/service/data/SyntaxTree/AbstractKeyword.fs.bsl Outdated

@vzarytovskiivzarytovskii left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's great, thanks!

__SOURCE_DIRECTORY__ usage.
@nojaf

nojaf commented Feb 9, 2023

Copy link
Copy Markdown
ContributorAuthor

@auduchinok I took a shortcut for __SOURCE_DIRECTORY__, I think this is ok for now.

@nojafnojaf mentioned this pull request Feb 9, 2023
@abonie
abonie merged commit 1e65a08 into dotnet:mainFeb 10, 2023
Comment on lines +150 to +151
[<TestCaseSource(nameof allTestCases)>]
let ParseFile fileName =

@auduchinokauduchinokFeb 10, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there an easy way to run/debug a specific test? It's going to be crucial when debugging some cases in the parser (e.g. debugging helped me a lot when I worked on the parser in #13352).

It would also be very handy to be able to dump tokens for a specific tests easily: it may really help when changing LexFilter, as in #13089.

@nojaf@vzarytovskii Would it be easy to have separate named tests, similar to what we have here? https://github.com/JetBrains/resharper-fsharp/blob/net231/ReSharper.FSharp/test/src/FSharp.Tests/Parsing/FSharpParserTest.fs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ouch, I'm a bit late 😞

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

You can debug each individual file:
image

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants

@nojaf@vzarytovskii@auduchinok@psfinaki@abonie