Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS0001: The type 'TestDir' does not have 'null' as a proper value when using use in TestCaseBuilder #341

Closed
matthid opened this issue Aug 28, 2019 · 2 comments

Comments

@matthid
Copy link

matthid commented Aug 28, 2019

Example:

type TestDir =
    { Dir : string }
    interface System.IDisposable with
        member x.Dispose() =
            try
                Directory.Delete(x.Dir, true)
            with e ->
                eprintf "Failed to delete '%s': %O" x.Dir e
                ()

let createTestDir () =
    let testFile = Path.Combine (Path.GetTempPath (), Path.GetRandomFileName ())
    Directory.CreateDirectory(testFile)
        |> ignore<DirectoryInfo>
    { Dir = testFile }

[<Tests>]
let tests =
  testList "Tests" [
    test "test" {
      use testDir = createTestDir() // <- FS0001
      ()
    }
  ]

Workaround use testCase "test" <| fun _ -> instead

haf added a commit that referenced this issue Oct 20, 2019
haf added a commit that referenced this issue Oct 20, 2019
haf added a commit that referenced this issue Oct 20, 2019
haf added a commit that referenced this issue Oct 20, 2019
@haf haf closed this as completed in 152962a Oct 20, 2019
@haf
Copy link
Owner

haf commented Oct 20, 2019

@matthid This has been fixed now!

@matthid
Copy link
Author

matthid commented Oct 20, 2019

@haf Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants