Skip to content

Commit 7cf1831

Browse files
committed
Fix 545 - tests
1 parent 5e45da9 commit 7cf1831

File tree

1 file changed

+82
-1
lines changed

1 file changed

+82
-1
lines changed

tests/service/ProjectAnalysisTests.fs

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2689,6 +2689,85 @@ let ``Test Project16 sig symbols are equal to impl symbols`` () =
26892689
testFind ("implementation", symbolsImpl) ("implementation", symbolsImpl) // of course this should pass...
26902690
testFind ("signature", symbolsSig) ("signature", symbolsSig) // of course this should pass...
26912691

2692+
[<Test>]
2693+
let ``Test Project16 sym locations`` () =
2694+
2695+
let wholeProjectResults = checker.ParseAndCheckProject(Project16.options) |> Async.RunSynchronously
2696+
2697+
let fmtLoc (mOpt: Range.range option) =
2698+
match mOpt with
2699+
| None -> ("NONE", (0, 0), (0, 0))
2700+
| Some m -> (Project16.cleanFileName m.FileName, (m.StartLine, m.StartColumn), (m.EndLine, m.EndColumn ))
2701+
2702+
let allUsesOfAllSymbols =
2703+
wholeProjectResults.GetAllUsesOfAllSymbols()
2704+
|> Async.RunSynchronously
2705+
|> Array.map (fun su -> su.Symbol.ToString(), fmtLoc su.Symbol.SignatureLocation, fmtLoc su.Symbol.DeclarationLocation, fmtLoc su.Symbol.ImplementationLocation)
2706+
2707+
allUsesOfAllSymbols |> shouldEqual
2708+
[|("ClassAttribute", ("??", (226, 9), (226, 23)),("??", (226, 9), (226, 23)), ("??", (226, 9), (226, 23)));
2709+
("ClassAttribute", ("??", (226, 9), (226, 23)),("??", (226, 9), (226, 23)), ("??", (226, 9), (226, 23)));
2710+
("member .ctor", ("??", (230, 8), (230, 11)), ("??", (230, 8), (230, 11)),("??", (244, 9), (244, 23)));
2711+
("ClassAttribute", ("??", (226, 9), (226, 23)),("??", (226, 9), (226, 23)), ("??", (226, 9), (226, 23)));
2712+
("ClassAttribute", ("??", (226, 9), (226, 23)),("??", (226, 9), (226, 23)), ("??", (226, 9), (226, 23)));
2713+
("member .ctor", ("??", (230, 8), (230, 11)), ("??", (230, 8), (230, 11)),("??", (244, 9), (244, 23)));
2714+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2715+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2716+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2717+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2718+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2719+
("field Field1", ("sig1", (16, 10), (16, 16)),("sig1", (16, 10), (16, 16)), ("file1", (13, 10), (13, 16)));
2720+
("field Field2", ("sig1", (16, 24), (16, 30)),("sig1", (16, 24), (16, 30)), ("file1", (13, 24), (13, 30)));
2721+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2722+
("Case1", ("sig1", (17, 8), (17, 13)), ("sig1", (17, 8), (17, 13)),("file1", (14, 8), (14, 13)));
2723+
("Case2", ("sig1", (17, 16), (17, 21)), ("sig1", (17, 16), (17, 21)),("file1", (14, 16), (14, 21)));
2724+
("C", ("sig1", (4, 5), (4, 6)), ("sig1", (4, 5), (4, 6)),("file1", (4, 5), (4, 6)));
2725+
("unit", ("??", (22, 8), (22, 12)), ("??", (22, 8), (22, 12)),("??", (22, 8), (22, 12)));
2726+
("C", ("sig1", (4, 5), (4, 6)), ("sig1", (4, 5), (4, 6)),("file1", (4, 5), (4, 6)));
2727+
("member .ctor", ("sig1", (5, 4), (5, 7)), ("sig1", (5, 4), (5, 7)),("file1", (4, 5), (4, 6)));
2728+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2729+
("member get_PC", ("sig1", (6, 11), (6, 13)), ("sig1", (6, 11), (6, 13)),("file1", (5, 13), (5, 15)));
2730+
("D", ("sig1", (8, 14), (8, 15)), ("sig1", (8, 14), (8, 15)),("file1", (7, 4), (7, 5)));
2731+
("unit", ("??", (22, 8), (22, 12)), ("??", (22, 8), (22, 12)),("??", (22, 8), (22, 12)));
2732+
("D", ("sig1", (8, 14), (8, 15)), ("sig1", (8, 14), (8, 15)),("file1", (7, 4), (7, 5)));
2733+
("member .ctor", ("sig1", (9, 4), (9, 7)), ("sig1", (9, 4), (9, 7)),("file1", (7, 4), (7, 5)));
2734+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2735+
("member get_PD", ("sig1", (10, 11), (10, 13)),("sig1", (10, 11), (10, 13)), ("file1", (8, 13), (8, 15)));
2736+
("E", ("sig1", (12, 14), (12, 15)), ("sig1", (12, 14), (12, 15)),("file1", (10, 4), (10, 5)));
2737+
("unit", ("??", (22, 8), (22, 12)), ("??", (22, 8), (22, 12)),("??", (22, 8), (22, 12)));
2738+
("E", ("sig1", (12, 14), (12, 15)), ("sig1", (12, 14), (12, 15)),("file1", (10, 4), (10, 5)));
2739+
("member .ctor", ("sig1", (13, 4), (13, 7)), ("sig1", (13, 4), (13, 7)),("file1", (10, 4), (10, 5)));
2740+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2741+
("member get_PE", ("sig1", (14, 11), (14, 13)),("sig1", (14, 11), (14, 13)), ("file1", (11, 13), (11, 15)));
2742+
("F", ("sig1", (16, 4), (16, 5)), ("sig1", (16, 4), (16, 5)),("file1", (13, 4), (13, 5)));
2743+
("G", ("sig1", (17, 4), (17, 5)), ("sig1", (17, 4), (17, 5)),("file1", (14, 4), (14, 5)));
2744+
("Impl", ("sig1", (2, 7), (2, 11)), ("sig1", (2, 7), (2, 11)),("file1", (2, 7), (2, 11)));
2745+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2746+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2747+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2748+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2749+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2750+
("field Field1", ("sig1", (16, 10), (16, 16)),("file1", (13, 10), (13, 16)), ("file1", (13, 10), (13, 16)));
2751+
("field Field2", ("sig1", (16, 24), (16, 30)),("file1", (13, 24), (13, 30)), ("file1", (13, 24), (13, 30)));
2752+
("int", ("??", (69, 9), (69, 12)), ("??", (69, 9), (69, 12)),("??", (69, 9), (69, 12)));
2753+
("Case1", ("sig1", (17, 8), (17, 13)), ("file1", (14, 8), (14, 13)),("file1", (14, 8), (14, 13)));
2754+
("Case2", ("sig1", (17, 16), (17, 21)), ("file1", (14, 16), (14, 21)),("file1", (14, 16), (14, 21)));
2755+
("C", ("sig1", (4, 5), (4, 6)), ("file1", (4, 5), (4, 6)),("file1", (4, 5), (4, 6)));
2756+
("D", ("sig1", (8, 14), (8, 15)), ("file1", (7, 4), (7, 5)),("file1", (7, 4), (7, 5)));
2757+
("E", ("sig1", (12, 14), (12, 15)), ("file1", (10, 4), (10, 5)),("file1", (10, 4), (10, 5)));
2758+
("F", ("sig1", (16, 4), (16, 5)), ("file1", (13, 4), (13, 5)),("file1", (13, 4), (13, 5)));
2759+
("G", ("sig1", (17, 4), (17, 5)), ("file1", (14, 4), (14, 5)),("file1", (14, 4), (14, 5)));
2760+
("member .ctor", ("sig1", (5, 4), (5, 7)), ("file1", (4, 5), (4, 6)),("file1", (4, 5), (4, 6)));
2761+
("member get_PC", ("sig1", (6, 11), (6, 13)), ("file1", (5, 13), (5, 15)),("file1", (5, 13), (5, 15)));
2762+
("member .ctor", ("sig1", (9, 4), (9, 7)), ("file1", (7, 4), (7, 5)),("file1", (7, 4), (7, 5)));
2763+
("member get_PD", ("sig1", (10, 11), (10, 13)),("file1", (8, 13), (8, 15)), ("file1", (8, 13), (8, 15)));
2764+
("member .ctor", ("sig1", (13, 4), (13, 7)), ("file1", (10, 4), (10, 5)),("file1", (10, 4), (10, 5)));
2765+
("member get_PE", ("sig1", (14, 11), (14, 13)),("file1", (11, 13), (11, 15)), ("file1", (11, 13), (11, 15)));
2766+
("val x", ("file1", (5, 11), (5, 12)), ("file1", (5, 11), (5, 12)),("file1", (5, 11), (5, 12)));
2767+
("val x", ("file1", (8, 11), (8, 12)), ("file1", (8, 11), (8, 12)),("file1", (8, 11), (8, 12)));
2768+
("val x", ("file1", (11, 11), (11, 12)), ("file1", (11, 11), (11, 12)),("file1", (11, 11), (11, 12)));
2769+
("Impl", ("sig1", (2, 7), (2, 11)), ("file1", (2, 7), (2, 11)),("file1", (2, 7), (2, 11)))|]
2770+
26922771

26932772

26942773
//-----------------------------------------------------------------------------------------
@@ -4691,7 +4770,9 @@ type A<'XX, 'YY>() =
46914770
[<Test>]
46924771
let ``Test project38 abstract slot information`` () =
46934772
let printAbstractSignature (s: FSharpAbstractSignature) =
4694-
let printType (t: FSharpType) = (string t).[5 ..]
4773+
let printType (t: FSharpType) =
4774+
hash t |> ignore // smoke test to check hash code doesn't loop
4775+
(string t).[5 ..]
46954776
let args =
46964777
(s.AbstractArguments |> Seq.concat |> Seq.map (fun a ->
46974778
(match a.Name with Some n -> n + ":" | _ -> "") + printType a.Type) |> String.concat " * ")

0 commit comments

Comments
 (0)