From 923ade5bdf7f2c819f26ac221522381e56925e10 Mon Sep 17 00:00:00 2001 From: BoundedChenn31 Date: Tue, 30 Aug 2022 20:12:45 +0300 Subject: [PATCH] Add tests for fixed cases --- tests/FSharp.ApiDocs.Tests/ApiDocsTests.fs | 11 +++++++++++ tests/FSharp.ApiDocs.Tests/files/FsLib1/FsLib1.fsproj | 2 ++ .../files/FsLib1/OperatorsWithFsi.fs | 4 ++++ .../files/FsLib1/OperatorsWithFsi.fsi | 5 +++++ 4 files changed, 22 insertions(+) create mode 100644 tests/FSharp.ApiDocs.Tests/files/FsLib1/OperatorsWithFsi.fs create mode 100644 tests/FSharp.ApiDocs.Tests/files/FsLib1/OperatorsWithFsi.fsi diff --git a/tests/FSharp.ApiDocs.Tests/ApiDocsTests.fs b/tests/FSharp.ApiDocs.Tests/ApiDocsTests.fs index 474b53d02..c3c58cb61 100644 --- a/tests/FSharp.ApiDocs.Tests/ApiDocsTests.fs +++ b/tests/FSharp.ApiDocs.Tests/ApiDocsTests.fs @@ -253,6 +253,17 @@ let ``ApiDocs works on two sample F# assemblies`` (format: OutputFormat) = files.[(sprintf "fslib-union.%s" format.Extension)] |> shouldContainText "Naming(rate, string)" + // Check that operators are encoded + files[$"fslib-operatorswithfsi.%s{format.Extension}"] + |> shouldContainText "<&>" + + // Check that parameters are indexed + files[$"fslib-operatorswithfsi.%s{format.Extension}"] + |> shouldContainText "arg0" + + files[$"fslib-operatorswithfsi.%s{format.Extension}"] + |> shouldContainText "arg1" + (* This may be addressed in a separate issue or removed if not an issue. // Check that implict cast operator is generated correctly files.[(sprintf "fslib-space-missing-implicit-cast.%s" format.Extension)] |> shouldContainText "op_Implicit source" diff --git a/tests/FSharp.ApiDocs.Tests/files/FsLib1/FsLib1.fsproj b/tests/FSharp.ApiDocs.Tests/files/FsLib1/FsLib1.fsproj index f2882b7e6..b709c46f4 100644 --- a/tests/FSharp.ApiDocs.Tests/files/FsLib1/FsLib1.fsproj +++ b/tests/FSharp.ApiDocs.Tests/files/FsLib1/FsLib1.fsproj @@ -6,6 +6,8 @@ + + diff --git a/tests/FSharp.ApiDocs.Tests/files/FsLib1/OperatorsWithFsi.fs b/tests/FSharp.ApiDocs.Tests/files/FsLib1/OperatorsWithFsi.fs new file mode 100644 index 000000000..0c63a50bc --- /dev/null +++ b/tests/FSharp.ApiDocs.Tests/files/FsLib1/OperatorsWithFsi.fs @@ -0,0 +1,4 @@ +module FsLib.OperatorsWithFsi + +let (<&>) (x: 'T) (y: 'T) = x < y + diff --git a/tests/FSharp.ApiDocs.Tests/files/FsLib1/OperatorsWithFsi.fsi b/tests/FSharp.ApiDocs.Tests/files/FsLib1/OperatorsWithFsi.fsi new file mode 100644 index 000000000..5f2486a08 --- /dev/null +++ b/tests/FSharp.ApiDocs.Tests/files/FsLib1/OperatorsWithFsi.fsi @@ -0,0 +1,5 @@ +module FsLib.OperatorsWithFsi + +/// The operator +val ( <&> ) : 'T -> 'T -> bool when 'T : comparison +