Skip to content

Commit

Permalink
Merge pull request #212 from Vidarls/fixing_invalid_path_csharp_error
Browse files Browse the repository at this point in the history
Fsharp.Formatting MetadataFormat no longer crashes on C# dlls
  • Loading branch information
forki committed Oct 10, 2014
2 parents 2ef0fbc + 5fb6186 commit 6266ce0
Show file tree
Hide file tree
Showing 4 changed files with 441 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/FSharp.MetadataFormat/Main.fs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ module ValueReader =
static member Create(publicOnly, map, sourceFolderRepo, urlRangeHighlight, markDownComments) =
let usedNames = Dictionary<_, _>()
let nameGen (name:string) =
let nice = name.Replace(".", "-").Replace("`", "-").ToLower()
let nice = name.Replace(".", "-").Replace("`", "-").Replace("<", "").Replace(">", "").ToLower()
let found =
seq { yield nice
for i in Seq.initInfinite id do yield sprintf "%s-%d" nice i }
Expand Down
15 changes: 15 additions & 0 deletions tests/FSharp.MetadataFormat.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,18 @@ let ``MetadataFormat process XML comments in two sample F# assemblies``() =
files.["fslib-nested.html"] |> should contain "Somewhat nested module"
files.["fslib-nested-nestedtype.html"] |> should contain "Very nested member"
files.["fslib-nested-submodule.html"] |> should contain "Very nested field"

[<Test>]
let ``MetadataFormat handles c# dlls`` () =
let library = root @@ "files" @@ "CSharpFormat.dll"
let output = getOutputDir()
MetadataFormat.Generate
( library, output, layoutRoots, info, libDirs = [root @@ "../../lib"])
let files = Directory.GetFiles(output)

let optIndex = files |> Seq.tryFind (fun s -> s.EndsWith "index.html")
optIndex.IsSome |> shouldEqual true

#if INTERACTIVE
System.Diagnostics.Process.Start(output)
#endif
Loading

0 comments on commit 6266ce0

Please sign in to comment.