Skip to content
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

Certain tests are never run, they are marked as "Content" in FSharp.Core.UnitTests #9515

Closed
abelbraaksma opened this issue Jun 20, 2020 · 12 comments · Fixed by #9516
Closed

Comments

@abelbraaksma
Copy link
Contributor

abelbraaksma commented Jun 20, 2020

While working on some issue, I was searching for existing tests for string which landed me at OperatorsModule2.fs. However, searching for the actual test [<Test>] test.string() inside the Test Window turned up nothing.

I also noticed that the coloring was way off, and type inference did nothing. For instance notice the "unused var" color on result:

image

After some 🤯 it dawned to me and I found this:

image

In other words, it is marked as Content. Is this deliberate? It is also true for some, but not all, other files in FSharp.Core.UnitTests, which suggests that the tests are not run. Can I change it so that it actually compiles, or should I only ever do that local-only?

EDIT: it probably is deliberate, as there's a bunch of code there that doesn't compile when I enable it. I wanted to work on #7958 and possibly this #9153, but that would mean re-enabling these tests, or putting them elsewhere.

@vzarytovskii, I believe you are working on restructuring the tests, what's the best cause of action here?

@abelbraaksma
Copy link
Contributor Author

Also, it kills VS if I re-enable that file.

@cartermp
Copy link
Contributor

@abelbraaksma it's concerning that this would tank VS by enable it as an item include. We have far, far larger tests in that project that work fine (if a bit sluggish since one of them is over 50k lines of code...).

@vzarytovskii
Copy link
Member

@abelbraaksma I would put new tests for string in a separate module(s) inside the unit tests project (maybe under String/), under appropriate subcategories (e.g. String/Equality.fs, String/Operators.fs, String/Conversion.fs, etc).

As for existing/disabled tests - I have plans to review them and move around to appropriate modules.

@abelbraaksma
Copy link
Contributor Author

abelbraaksma commented Jun 20, 2020

@cartermp, while making another coffee (waiting for the VS to come back), VS crashed + restarted. The suspected the cause to be possibly similar to #9201, because there were errors and this solution also uses a lot of SRTP.

Reason for many errors is

open SystematicUnitTests.LibraryTestFx

which doesn't exist and perhaps used to define stuff like CheckThrowsOverflowException.

As these crashes go, after the restart, repeating the same actions did not lead to another crash and just showed the errors. Odd...

@abelbraaksma
Copy link
Contributor Author

I would put new tests for string in a separate module(s) inside the unit tests project (maybe under String/), under appropriate subcategories (e.g. String/Equality.fs, String/Operators.fs, String/Conversion.fs, etc).

@vzarytovskii Hmm, ok, but that sounds like the long-term plan. Perhaps for the time being it's best if I'll just re-enable, fix the compile errors, and add tests to this file so that later they can be moved to their resp. new locations.

I don't see any other location where string: 'a -> string is being tested (in fact, there's virtually nothing), so for my up-and-coming PR I propose to just add a bunch here, as opposed to trying and creating a full new structure.

@cartermp
Copy link
Contributor

@abelbraaksma that seems reasonable

@vzarytovskii
Copy link
Member

I would put new tests for string in a separate module(s) inside the unit tests project (maybe under String/), under appropriate subcategories (e.g. String/Equality.fs, String/Operators.fs, String/Conversion.fs, etc).

@vzarytovskii Hmm, ok, but that sounds like the long-term plan. Perhaps for the time being it's best if I'll just re-enable, fix the compile errors, and add tests to this file so that later they can be moved to their resp. new locations.

Yeah, this is more of a long-term plan for existing and new tests.

For the tests you mentioned, it’s perfectly fine to just re-enable and fix them.

I don't see any other location where string: 'a -> string is being tested (in fact, there's virtually nothing), so for my up-and-coming PR I propose to just add a bunch here, as opposed to trying and creating a full new structure.

Sounds good to me!

@abelbraaksma
Copy link
Contributor Author

World of oddities today. After I changed the property from Content to F# Compiler, it moved up the tree in Solution Explorer.

Notice that LibraryTestFx.fs is defined after SeqModule.fs, but the latter actually uses the former. I don't know why I don't see the right order in the Solution Explorer, I thought that F# was always compilation-order dependent.

image

Looking at the fsproj file, the order is correct (except for the strange "putting on top" of OperatorModule2.fs). Which begs the question why Solution Explorer doesn't show it in the right order:

  <ItemGroup>
    <Compile Include="FSharp.Core\OperatorsModule2.fs" />
    <Compile Include="NUnitFrameworkShims.fs" />
    <Compile Include="LibraryTestFx.fs" />   <!-- offending file is on top here, just not in Sln Expl -->

    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\Utils.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ArrayModule.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ArrayModule2.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\Array2Module.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\Array3Module.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\Array4Module.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ArrayProperties.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ComparisonIdentityModule.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\HashIdentityModule.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ListModule.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ListModule2.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ObsoleteListFunctions.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ListType.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ListProperties.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\MapModule.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\MapType.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\SetModule.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\SetType.fs" />
    <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\SeqModule.fs" />

@abelbraaksma
Copy link
Contributor Author

abelbraaksma commented Jun 20, 2020

I think I got it. So there is this, and originally there was no OperatorsModule2.fs:

  <ItemGroup>
    <Content Include="**/*" Exclude="**/*.bak;Directory.Build.Props;Directory.Build.targets;FSharp.Core.UnitTests.fsproj" CopyToOutputDirectory="never" />
  </ItemGroup>

And after adding it as shown above, it also un-added it from the **/* Content group, which seems reasonable, otherwise it would appear twice.

  <ItemGroup>
    <Content Remove="FSharp.Core\OperatorsModule2.fs" />
  </ItemGroup>

After re-enabling one, VS apparently had no idea where to put it, so it puts it on top (which is also the current behavior of copy/paste files in Sln Expl). I'll just manually edit fsproj, so that it ends up where I want it and I'll take it from there.

Still odd that the file order in Solution Explorer does not match the file order specified in the fsproj file though, not even for the defined entries.

@abelbraaksma
Copy link
Contributor Author

This is now fixed in the PR.

@ThorstenReichert
Copy link
Contributor

I don't see any other location where string: 'a -> string is being tested (in fact, there's virtually nothing), so for my up-and-coming PR I propose to just add a bunch here, as opposed to trying and creating a full new structure.

@abelbraaksma, some tests for string (with numerical arguments) can be found in
tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/StringFormatTests.fs, see e.g. #9435.

@abelbraaksma
Copy link
Contributor Author

@ThorstenReichert, great! I needed that, that'll save me some time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants