mirror of
https://github.com/Smaug123/WoofWare.Whippet
synced 2025-10-06 00:08:39 +00:00
Some checks are pending
.NET / check-dotnet-format (push) Waiting to run
.NET / check-nix-format (push) Waiting to run
.NET / Check links (push) Waiting to run
.NET / Check flake (push) Waiting to run
.NET / nuget-pack (push) Waiting to run
.NET / build (Debug) (push) Waiting to run
.NET / build (Release) (push) Waiting to run
.NET / analyzers (push) Waiting to run
.NET / expected-pack (push) Blocked by required conditions
.NET / check-accurate-generations (push) Waiting to run
.NET / all-required-checks-complete (push) Blocked by required conditions
.NET / nuget-publish (push) Blocked by required conditions
.NET / nuget-publish-core (push) Blocked by required conditions
.NET / nuget-publish-fantomas (push) Blocked by required conditions
.NET / nuget-publish-json-plugin (push) Blocked by required conditions
.NET / nuget-publish-json-attrs (push) Blocked by required conditions
.NET / nuget-publish-argparser-plugin (push) Blocked by required conditions
.NET / nuget-publish-argparser-attrs (push) Blocked by required conditions
.NET / nuget-publish-httpclient-plugin (push) Blocked by required conditions
.NET / nuget-publish-httpclient-attrs (push) Blocked by required conditions
.NET / nuget-publish-interfacemock-plugin (push) Blocked by required conditions
.NET / nuget-publish-interfacemock-attrs (push) Blocked by required conditions
.NET / nuget-publish-swagger-plugin (push) Blocked by required conditions
39 lines
1.3 KiB
Forth
39 lines
1.3 KiB
Forth
namespace WoofWare.Whippet.Fantomas.Test
|
|
|
|
open Fantomas.FCS.Syntax
|
|
open Fantomas.FCS.Text
|
|
open NUnit.Framework
|
|
open FsUnitTyped
|
|
open WoofWare.Whippet.Fantomas
|
|
open Fantomas.FCS
|
|
|
|
[<TestFixture>]
|
|
module TestSynType =
|
|
let typeToStringCases =
|
|
[ "string", "string" ; "ResizeArray<int>", "ResizeArray<int32>" ]
|
|
|> List.map TestCaseData
|
|
|
|
[<TestCaseSource(nameof typeToStringCases)>]
|
|
let ``Snapshot tests for SynType.toHumanReadableString`` (fsharpTypeString : string, expected : string) =
|
|
let parsed, diags =
|
|
Parse.parseFile false (SourceText.ofString $"let x : %s{fsharpTypeString} = failwith \"\"") []
|
|
|
|
diags |> shouldBeEmpty
|
|
|
|
let (SynModuleOrNamespace (decls = parsed)) =
|
|
match parsed with
|
|
| ParsedInput.ImplFile parsedImplFileInput -> parsedImplFileInput.Contents.[0]
|
|
| ParsedInput.SigFile _ -> failwith "logic error"
|
|
|
|
let (SynBinding (expr = parsed)) =
|
|
match List.exactlyOne parsed with
|
|
| SynModuleDecl.Let (bindings = bindings) -> bindings.[0]
|
|
| _ -> failwith "logic error"
|
|
|
|
let ty =
|
|
match parsed with
|
|
| SynExpr.Typed (targetType = targetType) -> targetType
|
|
| _ -> failwith $"logic error: %O{parsed}"
|
|
|
|
SynType.toHumanReadableString ty |> shouldEqual expected
|