-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
Handle tests within nested modules #1844
Handle tests within nested modules #1844
Conversation
Great job! I'll wait to merge this until the matching FSAC PR is merged and released, ok? |
@kojo12228 can you resolve the conflicts with the other PR when you have a moment? I'm working on an FSAC release so when that's completed I'm ready to merge and release this fix as well. |
@baronfel sorry for the delay, I merged them locally but was getting issues with test explorer that I don't get on |
Odd behaviour since mergingFor further details, tests seems to be correctly being discovered with eea849e: However something is happening on 182b6ff that I can't explain, The diff between the commits (ignoring commits) is the followingStarting line 194 in this PR: if Seq.length testCases > 1 then
let ti =
- t.Test.children.get (t.Test.uri.Value.ToString() + " -- " + testName)
+ t.Test.children.get (
+ t.Test.uri.Value.ToString()
+ + " -- "
+ + Convert.ToBase64String(Encoding.UTF8.GetBytes(testName))
+ )
|> Option.defaultWith (fun () ->
tc.createTestItem ( Starting line 224 in this PR: let rec mapTest
(tc: TestController)
(uri: Uri)
(moduleTypes: Collections.Generic.Dictionary<string, string>)
(t: TestAdapterEntry)
: TestItem =
- let ti = tc.createTestItem (uri.ToString() + " -- " + string t.id, t.name, uri)
+ let ti =
+ tc.createTestItem (
+ uri.ToString() + " -- " + Convert.ToBase64String(Encoding.UTF8.GetBytes(t.name)),
+ t.name,
+ uri
+ ) Starting line 271 in this PR: - logger.Debug("Module types", moduleTypes)
let rec getFullName (ti: TestItem) = |
Also |
Figured it out, #1841 unintentionally made a change such that module Outer =
[<TestFixture>]
module Inner =
[<Test>]
let Test1 () = // First Test1
Assert.Pass ()
module Innermost =
[<Test>]
let Test1 () = // Second Test1, Dictionary.Add would silently throw
Assert.Pass() Fixed this by passing a I think we're good to go @baronfel , apologies for the delay. |
No worries at all, thank you for taking the time to dig into it :) I'll try to get out a new release containing all of this later today! |
@baronfel works as expected with FsAutoComplete 0.59.2 (not sure if you want the commit in this branch though) |
Fixes #1756
Using module type information from ionide/FsAutoComplete#1071, correctly handle the full name of tests where there is a module within a module, a type within a module or a module which shares the same name as a sibling type.
Unfortunately,
TestAdapterEntry
which holds the information about module type is not accessible at the point where the full name is constructed, and the VSCode typeTestItem
has no field where this information can be added (AFAIK). To workaround that, this PR uses an otherwise undesirableResizeArray
acting as a map of sorts to hold mutable state about module types and this is passed to various functions. Ideally, something like a Set would be used but I will double check if Fable supportsSystem.Collections.Generic.HashSet
(otherwise it might be worth doing some housekeeping to ensure this collection doesn't become a memory leak).