Skip to content

Commit

Permalink
Adding unit test which show that the number inference doesn't work as…
Browse files Browse the repository at this point in the history
… expected. References issue fsprojects#176
  • Loading branch information
forki committed Dec 3, 2012
1 parent 604264d commit 06d961c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Expand Up @@ -48,6 +48,7 @@
<Compile Include="JSON.WikiSample.Tests.fs" />
<Compile Include="JSON.DocumentOverride.Tests.fs" />
<Compile Include="JSON.ProjectFile.Tests.fs" />
<Compile Include="InferenceTests.fs" />
<Compile Include="MiniCsv.Tests.fs" />
<Content Include="OptionValues.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down Expand Up @@ -114,4 +115,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
25 changes: 25 additions & 0 deletions tests/FSharpx.TypeProviders.Documents.Tests/InferenceTests.fs
@@ -0,0 +1,25 @@
module FSharpx.TypeProviders.Tests.JSON.InferenceTests

open NUnit.Framework
open FSharpx
open FsUnit

type XmlCellSet = StructuredXml<Schema="""<CellSet><Row key="base64"><Cell timestamp="1349209076311" column="cGw6eG1s">base64</Cell></Row></CellSet>""">

type JsonCellSet = StructuredJSON<Schema="""{"Row":[{"key":"base64","Cell":[{"timestamp":1349209076311,"column":"cGw6eG1s","$":"base64"}]}]}""">

[<Test>]
let ``Can infer the XML timestamp as integer``() =
let inlined = XmlCellSet().Root
for row in inlined.GetRows() do
for cell in row.GetCells() do
Assert.AreEqual(1349209076311L,cell.Timestamp)
Assert.AreEqual(typeof<int64>,cell.Timestamp.GetType())

[<Test>]
let ``Can infer the JSON timestamp as integer``() =
let inlined = JsonCellSet().Root
for row in inlined.GetRows() do
for cell in row.GetCells() do
Assert.AreEqual(1349209076311L,cell.Timestamp)
Assert.AreEqual(typeof<int64>,cell.Timestamp.GetType())

0 comments on commit 06d961c

Please sign in to comment.