Last active
October 7, 2022 13:04
-
-
Save pblasucci/7c864a98b61cad9190ae84903e99e546 to your computer and use it in GitHub Desktop.
Using signature files and script files to test private functionality
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>net6.0</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<Compile Include="Library.fsi" /> | |
<Compile Include="Library.fs" /> | |
<Compile Include="Program.fs" /> | |
<None Include="Test.fsx" /> | |
</ItemGroup> | |
</Project> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Gisty | |
type NewMaths = | |
static member ``add it up!``(left, right) = left + right | |
[<RequireQualifiedAccess>] | |
module Mathy = | |
open type NewMaths | |
let add one two = ``add it up!``(one, two) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Gisty | |
(** | |
Anything defined in `Library.fs` -- but not also defined in this file -- will not be exposed to others. | |
*) | |
[<RequireQualifiedAccess>] | |
module Mathy = | |
/// A novel contribution to the production of sums of natural numbers. | |
val add : one : int -> two : int -> int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Gisty.Program | |
open Gisty | |
printfn $"2 + 3 = %i{Mathy.add 2 3}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "nuget: FsCheck" | |
open FsCheck | |
(* uncomment ⮟⮟⮟ the signature file to emulate the compiled assembly *) | |
#load (*"Library.fsi"*) "Library.fs" | |
open Gisty | |
open type NewMaths | |
let test one two = | |
``add it up!``(one, two) = ``add it up!``(two, one) | |
do Check.Quick(test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment