Skip to content

Commit

Permalink
Add a simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
tboby committed Sep 22, 2022
1 parent e25f16f commit 6dbd749
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<Compile Include="Language\ComputationExpressionTests.fs" />
<Compile Include="Language\CastingTests.fs" />
<Compile Include="Language\NameofTests.fs" />
<Compile Include="Language\DotLambdaTests.fs" />
<Compile Include="ConstraintSolver\PrimitiveConstraints.fs" />
<Compile Include="ConstraintSolver\MemberConstraints.fs" />
<None Include="**\*.cs;**\*.fs;**\*.fsx;**\*.fsi" Exclude="@(Compile)">
Expand Down
29 changes: 29 additions & 0 deletions tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.

namespace FSharp.Compiler.ComponentTests.Language

open Xunit
open FSharp.Test.Compiler

module DotLambdaTests =

[<Fact>]
let ``Script: _.ToString()`` () =
Fsx "_.ToString()"
|> compile
|> shouldSucceed

let ``Simple anonymous unary function shorthands compile`` () =
FSharp """
module One
let a1 : {| Foo : {| Bar : string |}|} -> string = _.Foo.Bar
let a2 : {| Foo : int array |} -> int = _.Foo.[5]
let a3 : {| Foo : int array |} -> int = _.Foo[5]
let a4 : {| Foo : unit -> string |} -> string = _.Foo()
let a5 : {| Foo : int -> {| X : string |} |} -> string = _.Foo(5).X
open System
let a6 = [1] |> List.map _.ToString()
"""
|> compile
|> shouldSucceed

0 comments on commit 6dbd749

Please sign in to comment.