Build/Test Issues

F# variable identifiers with dots

Started by marhoily on 5,397 views

NCrunch does not run Xunit facts that have dot '.' symbol in the double backslashed name. This standard sample just does not work with NCrunch because both tests have dots in the end

namespace Studyin.Tests

open Xunit
open FsUnit.Xunit

type LightBulb(state) =
member x.On = state
override x.ToString() =
match x.On with
| true -> "On"
| false -> "Off"

type ``Given a LightBulb that has had its state set to true``() =
let lightBulb = new LightBulb(true)

[<Fact>]
member test.``when I ask whether it is On it answers true.``() =
lightBulb.On |> should be True

[<Fact>]
member test.``when I convert it to a string it becomes "On."``() =
string lightBulb |> should equal "On"
Hi,

Thanks for sharing this issue. Based on your example I've been able to quickly reproduce it.

NCrunch is making assumptions about method names based on the rules set down by C#. It isn't possible to create methods containing the period character or spaces in C#. F# makes this possible, and I can see the benefit of this as it allows tests to be named much more concisely.

I'll need to arrange a fix for this, though it may take some time. Is this a blocking issue for you?
For anyone interested, I've prepared an early build of 2.8 that includes a fix for this issue:

http://downloads.ncrunch.net/NCrunch_GridNodeServer_2.8.0.1.msi
http://downloads.ncrunch.net/NCrunch_GridNodeServer_2.8.0.1.zip
http://downloads.ncrunch.net/NCrunch_VS2008_2.8.0.1.msi
http://downloads.ncrunch.net/NCrunch_VS2010_2.8.0.1.msi
http://downloads.ncrunch.net/NCrunch_VS2010_2.8.0.1.zip
http://downloads.ncrunch.net/NCrunch_VS2012_2.8.0.1.msi
http://downloads.ncrunch.net/NCrunch_VS2012_2.8.0.1.zip
http://downloads.ncrunch.net/NCrunch_VS2013_2.8.0.1.msi
http://downloads.ncrunch.net/NCrunch_VS2013_2.8.0.1.zip

This fix will also be included in the full 2.8 release.

Post a reply

Log in to reply.