diff --git a/.gitignore b/.gitignore
index 15918cfa29..f81a9f8ee0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -216,7 +216,6 @@ release.sh
localpackages/
paket-files
*.orig
-.paket/paket.exe
docs/content/license.md
docs/content/release-notes.md
.fake
diff --git a/.paket/paket.exe b/.paket/paket.exe
new file mode 100644
index 0000000000..18b1ef3068
Binary files /dev/null and b/.paket/paket.exe differ
diff --git a/.paket/paket.targets b/.paket/paket.targets
new file mode 100644
index 0000000000..0fd370f901
--- /dev/null
+++ b/.paket/paket.targets
@@ -0,0 +1,41 @@
+
+
+
+
+ true
+
+ true
+ $(MSBuildThisFileDirectory)
+ $(MSBuildThisFileDirectory)..\
+ /Library/Frameworks/Mono.framework/Commands/mono
+ mono
+
+
+
+ $(PaketToolsPath)paket.exe
+ $(PaketToolsPath)paket.bootstrapper.exe
+ "$(PaketExePath)"
+ $(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"
+ "$(PaketBootStrapperExePath)" $(PaketBootStrapperCommandArgs)
+ $(MonoPath) --runtime=v4.0.30319 $(PaketBootStrapperExePath) $(PaketBootStrapperCommandArgs)
+
+ $(MSBuildProjectDirectory)\paket.references
+ $(MSBuildStartupDirectory)\paket.references
+ $(MSBuildProjectFullPath).paket.references
+ $(PaketCommand) restore --references-files "$(PaketReferences)"
+ $(PaketBootStrapperCommand)
+
+ RestorePackages; $(BuildDependsOn);
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build.cmd b/build.cmd
index 40aff4563e..b4babe508c 100644
--- a/build.cmd
+++ b/build.cmd
@@ -1,11 +1,6 @@
@echo off
cls
-.paket\paket.bootstrapper.exe
-if errorlevel 1 (
- exit /b %errorlevel%
-)
-
.paket\paket.exe restore
if errorlevel 1 (
exit /b %errorlevel%
diff --git a/build.fsx b/build.fsx
index 475b9e4151..ed97ab20d1 100644
--- a/build.fsx
+++ b/build.fsx
@@ -312,7 +312,7 @@ Target "FableCompilerNetcore" (fun _ ->
Target "NUnitTest" (fun _ ->
let testsBuildDir = "build/tests"
- !! "src/tests/Fable.Tests.fsproj"
+ !! "src/tests/Main/Fable.Tests.fsproj"
|> MSBuildRelease testsBuildDir "Build"
|> ignore
@@ -322,11 +322,10 @@ Target "NUnitTest" (fun _ ->
let compileAndRunMochaTests es2015 =
let testsBuildDir = "build/tests"
- let testCompileArgs = if es2015 then ["--ecma es2015"] else []
+ let testCompileArgs =
+ ["--verbose" + if es2015 then " --ecma es2015" else ""]
- MSBuildDebug "src/tests/DllRef/bin" "Build" ["src/tests/DllRef/Fable.Tests.DllRef.fsproj"] |> ignore
Node.run "." "build/fable" ["src/tests/DllRef"]
- Node.run "." "build/fable" ["src/tests/Other"]
Node.run "." "build/fable" ("src/tests/"::testCompileArgs)
FileUtils.cp "src/tests/package.json" testsBuildDir
Npm.install testsBuildDir []
diff --git a/build.sh b/build.sh
index 8ffb08d49e..8c0c661cc3 100755
--- a/build.sh
+++ b/build.sh
@@ -7,11 +7,6 @@ else
MONO="mono"
fi
-$MONO .paket/paket.bootstrapper.exe
-exit_code=$?
-if [ $exit_code -ne 0 ]; then
-exit $exit_code
-fi
if [ -e "paket.lock" ]; then
$MONO .paket/paket.exe restore
else
diff --git a/docs/source/docs/compiling.md b/docs/source/docs/compiling.md
index 6d35f194dc..bf868f87b4 100644
--- a/docs/source/docs/compiling.md
+++ b/docs/source/docs/compiling.md
@@ -40,7 +40,6 @@ Option | Short | Description
`--loose` | | Enable “loose” transformations for babel-preset-es2015 plugins (true by default).
`--babelrc` | | Use a `.babelrc` file for Babel configuration (invalidates other Babel related options).
`--refs` | | Specify dll or project references in `Reference=js/import/path` format (see below).
-`--msbuild` | | Pass MSBuild arguments like `Configuration=Release`.
`--clamp` | | Compile unsigned byte arrays as Uint8ClampedArray.
`--copyExt` | | Copy external files into `fable_external` folder (true by default).
`--coreLib` | | In some cases, you may need to pass a different route to the core library, like `--coreLib fable-core/es2015`.
diff --git a/paket.dependencies b/paket.dependencies
index ee7262cb9c..526e4f09b2 100644
--- a/paket.dependencies
+++ b/paket.dependencies
@@ -1,22 +1,17 @@
source https://www.nuget.org/api/v2
nuget FAKE
-nuget FSharp.Compiler.Service
-nuget FSharp.Compiler.Service.ProjectCracker
+nuget FSharp.Compiler.Service 8.0.0
nuget FSharp.Core
nuget Newtonsoft.Json
nuget Fable.JsonConverter
nuget NUnit
nuget NUnit.Runners
-github fsprojects/FSharp.TypeProviders.StarterPack src/ProvidedTypes.fs
-
-github fsprojects/Forge/1.0.1 src/Forge.ProjectSystem/Prelude.fs
-github fsprojects/Forge/1.0.1 src/Forge.ProjectSystem/XLinq.fs
-github fsprojects/Forge/1.0.1 src/Forge.ProjectSystem/ResizeArray.fs
-github fsprojects/Forge/1.0.1 src/Forge.ProjectSystem/Constants.fs
-github fsprojects/Forge/1.0.1 src/Forge.ProjectSystem/ProjectSystem.fs
-
nuget Suave
+github fable-compiler/Forge
+github fsprojects/FSharp.TypeProviders.StarterPack src/ProvidedTypes.fs
+github fsharp/FSharp.Compiler.Service src/fsharp/ReferenceResolver.fs
+github fsharp/FSharp.Compiler.Service src/fsharp/SimulatedMSBuildReferenceResolver.fs
group Docs
source https://www.nuget.org/api/v2
diff --git a/paket.lock b/paket.lock
index 4ab2b9151c..f4775045d8 100644
--- a/paket.lock
+++ b/paket.lock
@@ -1,14 +1,26 @@
NUGET
remote: https://www.nuget.org/api/v2
+ Argu (3.2)
Fable.JsonConverter (0.0.3)
FSharp.Core
Newtonsoft.Json
- FAKE (4.41.6)
+ FAKE (4.42)
+ FParsec (1.0.2)
FSharp.Compiler.Service (8.0)
System.Collections.Immutable (>= 1.2)
System.Reflection.Metadata (>= 1.4.1-beta-24227-04)
- FSharp.Compiler.Service.ProjectCracker (8.0)
FSharp.Core (4.0.0.1)
+ FSharp.Formatting (2.10)
+ FSharp.Compiler.Service (>= 0.0.87)
+ FSharpVSPowerTools.Core (1.8)
+ FSharpVSPowerTools.Core (1.8)
+ FSharp.Compiler.Service (>= 0.0.87)
+ FsUnit (2.3.2)
+ FSharp.Core (>= 3.1.2.5)
+ NUnit (3.5)
+ Microsoft.Bcl (1.1.10) - framework: net10, net11, net20, net30, net35, net40, net40-full
+ Microsoft.Bcl.Build (>= 1.0.14)
+ Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: net10, net11, net20, net30, net35, net40, net40-full
Microsoft.CSharp (4.0.1) - framework: >= netstandard10
System.Collections (>= 4.0.11) - framework: dnxcore50, >= netstandard13
System.Diagnostics.Debug (>= 4.0.11) - framework: dnxcore50, >= netstandard13
@@ -26,8 +38,12 @@ NUGET
System.Runtime.Extensions (>= 4.1) - framework: dnxcore50, >= netstandard13
System.Runtime.InteropServices (>= 4.1) - framework: dnxcore50, >= netstandard13
System.Threading (>= 4.0.11) - framework: dnxcore50, >= netstandard13
+ Microsoft.Net.Http (2.2.29) - framework: net10, net11, net20, net30, net35, net40, net40-full
+ Microsoft.Bcl (>= 1.1.10)
+ Microsoft.Bcl.Build (>= 1.0.14)
Microsoft.NETCore.Platforms (1.0.1) - framework: >= netstandard10
Microsoft.NETCore.Targets (1.0.1) - framework: >= netstandard10
+ Mono.Posix (4.0)
Newtonsoft.Json (9.0.1)
Microsoft.CSharp (>= 4.0.1) - framework: >= netstandard10
System.Collections (>= 4.0.11) - framework: >= netstandard10
@@ -65,12 +81,16 @@ NUGET
NUnit.Extension.NUnitV2ResultWriter (>= 3.5)
NUnit.Extension.TeamCityEventListener (>= 1.0.2)
NUnit.Extension.VSProjectLoader (>= 3.5)
+ Octokit (0.23)
+ Microsoft.Net.Http - framework: net10, net11, net20, net30, net35, net40, net40-full
runtime.native.System (4.0) - framework: >= netstandard13
Microsoft.NETCore.Platforms (>= 1.0.1)
Microsoft.NETCore.Targets (>= 1.0.1)
runtime.native.System.IO.Compression (4.1) - framework: >= netstandard13
Microsoft.NETCore.Platforms (>= 1.0.1)
Microsoft.NETCore.Targets (>= 1.0.1)
+ SharpZipLib (0.86)
+ SourceLink.Fake (1.1)
Suave (1.1.3)
FSharp.Core (>= 3.1.2.5)
System.Collections (4.0.11) - framework: >= netstandard10
@@ -311,19 +331,32 @@ NUGET
System.Threading (>= 4.0.11) - framework: dnxcore50, >= netstandard13
System.Xml.ReaderWriter (>= 4.0.11) - framework: dnxcore50, netstandard10, >= netstandard13
GITHUB
+ remote: fable-compiler/Forge
+ FULLPROJECT (7677a368304f0337047ed8ad925991aa7187a8bf)
+ Argu
+ FAKE
+ FParsec
+ FSharp.Core
+ FSharp.Formatting
+ FsUnit
+ Mono.Posix
+ NUnit
+ NUnit.Runners
+ SharpZipLib
+ SourceLink.Fake
+ remote: fsharp/FAKE
+ modules/Octokit/Octokit.fsx (f3f230ffde29fa370daf7d7be53e872e929dd487)
+ Octokit (>= 0.20)
remote: fsprojects/FSharp.TypeProviders.StarterPack
src/ProvidedTypes.fs (c50ace31d335b7bcb83b102d2cfd0ce2007ed681)
- remote: fsprojects/Forge
- src/Forge.ProjectSystem/Constants.fs (f75374896a2894e3187e3a2909e769fb920f3af4)
- src/Forge.ProjectSystem/Prelude.fs (f75374896a2894e3187e3a2909e769fb920f3af4)
- src/Forge.ProjectSystem/ProjectSystem.fs (f75374896a2894e3187e3a2909e769fb920f3af4)
- src/Forge.ProjectSystem/ResizeArray.fs (f75374896a2894e3187e3a2909e769fb920f3af4)
- src/Forge.ProjectSystem/XLinq.fs (f75374896a2894e3187e3a2909e769fb920f3af4)
+ remote: fsharp/FSharp.Compiler.Service
+ src/fsharp/ReferenceResolver.fs (174875dde3dcc5288616adca7b5b1468fda3bdb2)
+ src/fsharp/SimulatedMSBuildReferenceResolver.fs (174875dde3dcc5288616adca7b5b1468fda3bdb2)
GROUP Docs
NUGET
remote: https://www.nuget.org/api/v2
DotLiquid (2.0.55)
- FAKE (4.41.6)
+ FAKE (4.42)
FSharp.Compiler.Service (2.0.0.6)
FSharp.Core (4.0.0.1)
FSharp.Formatting (2.14.2)
diff --git a/src/fable/Fable.Client.Node/Fable.Client.Node.fsproj b/src/fable/Fable.Client.Node/Fable.Client.Node.fsproj
index ef8da59aac..06c3bef844 100644
--- a/src/fable/Fable.Client.Node/Fable.Client.Node.fsproj
+++ b/src/fable/Fable.Client.Node/Fable.Client.Node.fsproj
@@ -45,14 +45,28 @@
+
+
+ True
+ paket-files/ReferenceResolver.fs
+
+
+ True
+ paket-files/SimulatedMSBuildReferenceResolver.fs
+
+
+ Forge.ProjectSystem
+ {9029be0f-a72c-4281-9fd1-aa15f5722306}
+ True
+
Fable.Compiler
{d341ff6b-f526-4370-8318-0f5a654ba70c}
@@ -80,14 +94,7 @@
-
-
-
- <__paket__FSharp_Compiler_Service_ProjectCracker_targets>net45\FSharp.Compiler.Service.ProjectCracker
-
-
-
-
-
-
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 11
-
-
-
-
- $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets
-
-
-
-
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets
-
-
-
-
-
-
-
- Fable.Tests.Clamp
- {1e44403b-7834-4842-91b1-53a5fa731c58}
- True
-
-
-
-
-
-
- ..\..\packages\Fable.JsonConverter\lib\net45\Fable.JsonConverter.dll
- True
- True
-
-
-
-
-
-
-
-
- ..\..\packages\Microsoft.CSharp\ref\netstandard1.0\Microsoft.CSharp.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\Newtonsoft.Json\lib\net20\Newtonsoft.Json.dll
- True
- True
-
-
-
-
-
-
- ..\..\packages\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll
- True
- True
-
-
-
-
-
-
- ..\..\packages\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll
- True
- True
-
-
-
-
-
-
- ..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll
- True
- True
-
-
-
-
-
-
- ..\..\packages\Newtonsoft.Json\lib\netstandard1.0\Newtonsoft.Json.dll
- True
- True
-
-
-
-
-
-
- ..\..\packages\Newtonsoft.Json\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll
- True
- True
-
-
-
-
-
-
- ..\..\packages\Newtonsoft.Json\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll
- True
- True
-
-
-
-
-
-
-
-
- ..\..\packages\NUnit\lib\net20\NUnit.System.Linq.dll
- True
- True
-
-
- ..\..\packages\NUnit\lib\net20\nunit.framework.dll
- True
- True
-
-
-
-
-
-
- ..\..\packages\NUnit\lib\net35\nunit.framework.dll
- True
- True
-
-
-
-
-
-
- ..\..\packages\NUnit\lib\net40\nunit.framework.dll
- True
- True
-
-
-
-
-
-
- ..\..\packages\NUnit\lib\net45\nunit.framework.dll
- True
- True
-
-
-
-
-
-
- ..\..\packages\NUnit\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10\nunit.framework.dll
- True
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Collections\ref\netstandard1.0\System.Collections.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Collections\ref\netstandard1.3\System.Collections.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Diagnostics.Debug\ref\netstandard1.0\System.Diagnostics.Debug.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Diagnostics.Debug\ref\netstandard1.3\System.Diagnostics.Debug.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Diagnostics.Tools\ref\netstandard1.0\System.Diagnostics.Tools.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Dynamic.Runtime\ref\netstandard1.0\System.Dynamic.Runtime.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Dynamic.Runtime\ref\netstandard1.3\System.Dynamic.Runtime.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Globalization\ref\netstandard1.0\System.Globalization.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Globalization\ref\netstandard1.3\System.Globalization.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.IO\ref\netstandard1.0\System.IO.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.IO\ref\netstandard1.3\System.IO.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.IO\ref\netstandard1.5\System.IO.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.IO.FileSystem\ref\netstandard1.3\System.IO.FileSystem.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.IO.FileSystem.Primitives\ref\netstandard1.3\System.IO.FileSystem.Primitives.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Linq\ref\netstandard1.0\System.Linq.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Linq\ref\netstandard1.6\System.Linq.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Linq.Expressions\ref\netstandard1.0\System.Linq.Expressions.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Linq.Expressions\ref\netstandard1.3\System.Linq.Expressions.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Linq.Expressions\ref\netstandard1.6\System.Linq.Expressions.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.ObjectModel\ref\netstandard1.0\System.ObjectModel.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.ObjectModel\ref\netstandard1.3\System.ObjectModel.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Reflection\ref\netstandard1.0\System.Reflection.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Reflection\ref\netstandard1.3\System.Reflection.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Reflection\ref\netstandard1.5\System.Reflection.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Reflection.Emit\ref\netstandard1.1\System.Reflection.Emit.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Reflection.Emit.ILGeneration\ref\netstandard1.0\System.Reflection.Emit.ILGeneration.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Reflection.Emit.Lightweight\ref\netstandard1.0\System.Reflection.Emit.Lightweight.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Reflection.Extensions\ref\netstandard1.0\System.Reflection.Extensions.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Reflection.Primitives\ref\netstandard1.0\System.Reflection.Primitives.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Reflection.TypeExtensions\ref\netstandard1.3\System.Reflection.TypeExtensions.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Reflection.TypeExtensions\ref\netstandard1.5\System.Reflection.TypeExtensions.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Resources.ResourceManager\ref\netstandard1.0\System.Resources.ResourceManager.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Runtime\ref\netstandard1.0\System.Runtime.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Runtime\ref\netstandard1.2\System.Runtime.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Runtime\ref\netstandard1.3\System.Runtime.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Runtime\ref\netstandard1.5\System.Runtime.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Runtime.Extensions\ref\netstandard1.0\System.Runtime.Extensions.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Runtime.Extensions\ref\netstandard1.3\System.Runtime.Extensions.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Runtime.Extensions\ref\netstandard1.5\System.Runtime.Extensions.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Runtime.Handles\ref\netstandard1.3\System.Runtime.Handles.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.1\System.Runtime.InteropServices.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.2\System.Runtime.InteropServices.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.3\System.Runtime.InteropServices.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.5\System.Runtime.InteropServices.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Runtime.Serialization.Primitives\ref\netstandard1.0\System.Runtime.Serialization.Primitives.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Runtime.Serialization.Primitives\ref\netstandard1.3\System.Runtime.Serialization.Primitives.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Text.Encoding\ref\netstandard1.0\System.Text.Encoding.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Text.Encoding\ref\netstandard1.3\System.Text.Encoding.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Text.Encoding.Extensions\ref\netstandard1.0\System.Text.Encoding.Extensions.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Text.Encoding.Extensions\ref\netstandard1.3\System.Text.Encoding.Extensions.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Text.RegularExpressions\ref\netstandard1.0\System.Text.RegularExpressions.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Text.RegularExpressions\ref\netstandard1.3\System.Text.RegularExpressions.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Text.RegularExpressions\ref\netstandard1.6\System.Text.RegularExpressions.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Threading\ref\netstandard1.0\System.Threading.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Threading\ref\netstandard1.3\System.Threading.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Threading.Tasks\ref\netstandard1.0\System.Threading.Tasks.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Threading.Tasks\ref\netstandard1.3\System.Threading.Tasks.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Threading.Tasks.Extensions\lib\netstandard1.0\System.Threading.Tasks.Extensions.dll
- True
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Xml.ReaderWriter\ref\netstandard1.0\System.Xml.ReaderWriter.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Xml.ReaderWriter\ref\netstandard1.3\System.Xml.ReaderWriter.dll
- False
- True
-
-
-
-
-
-
-
-
- ..\..\packages\System.Xml.XDocument\ref\netstandard1.0\System.Xml.XDocument.dll
- False
- True
-
-
-
-
-
-
- ..\..\packages\System.Xml.XDocument\ref\netstandard1.3\System.Xml.XDocument.dll
- False
- True
-
-
-
-
-
\ No newline at end of file
diff --git a/src/tests/Fable.Tests.sln b/src/tests/Fable.Tests.sln
deleted file mode 100644
index af08590a87..0000000000
--- a/src/tests/Fable.Tests.sln
+++ /dev/null
@@ -1,32 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{830F1EC7-4FC9-4250-B0A9-619F0A6AC2B7}"
- ProjectSection(SolutionItems) = preProject
- ..\..\paket.dependencies = ..\..\paket.dependencies
- EndProjectSection
-EndProject
-Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fable.Tests", "Fable.Tests.fsproj", "{6EF06954-FBDF-42C7-815C-B13BA2926C93}"
-EndProject
-Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fable.Tests.Clamp", "Other\Fable.Tests.Clamp.fsproj", "{1E44403B-7834-4842-91B1-53A5FA731C58}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {6EF06954-FBDF-42C7-815C-B13BA2926C93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6EF06954-FBDF-42C7-815C-B13BA2926C93}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6EF06954-FBDF-42C7-815C-B13BA2926C93}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6EF06954-FBDF-42C7-815C-B13BA2926C93}.Release|Any CPU.Build.0 = Release|Any CPU
- {1E44403B-7834-4842-91B1-53A5FA731C58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1E44403B-7834-4842-91B1-53A5FA731C58}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1E44403B-7834-4842-91B1-53A5FA731C58}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1E44403B-7834-4842-91B1-53A5FA731C58}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/src/tests/ApplicativeTests.fs b/src/tests/Main/ApplicativeTests.fs
similarity index 92%
rename from src/tests/ApplicativeTests.fs
rename to src/tests/Main/ApplicativeTests.fs
index 472fb58921..bb25bdbc10 100644
--- a/src/tests/ApplicativeTests.fs
+++ b/src/tests/Main/ApplicativeTests.fs
@@ -1,7 +1,7 @@
-[]
+[]
module Fable.Tests.Applicative
open System
-open NUnit.Framework
+open Util.Testing
type Result<'s, 'f> =
| Ok of 's
diff --git a/src/tests/ArithmeticTests.fs b/src/tests/Main/ArithmeticTests.fs
similarity index 67%
rename from src/tests/ArithmeticTests.fs
rename to src/tests/Main/ArithmeticTests.fs
index 84218151b1..02a9dbadf9 100644
--- a/src/tests/ArithmeticTests.fs
+++ b/src/tests/Main/ArithmeticTests.fs
@@ -1,7 +1,7 @@
-[]
+[]
module Fable.Tests.Arithmetic
open System
-open NUnit.Framework
+open Util.Testing
[]
let ``Infix add can be generated``() =
@@ -56,74 +56,74 @@ let ``abs works``() =
[]
let ``round works``() =
- Assert.AreEqual (round -12.5, -12)
+ Assert.AreEqual (round -12.5, -12.)
[]
let ``ceil works``() =
- Assert.AreEqual (ceil 11.25, 12)
+ Assert.AreEqual (ceil 11.25, 12.)
[]
let ``floor works``() =
- Assert.AreEqual (floor 11.75, 11)
+ Assert.AreEqual (floor 11.75, 11.)
-let checkTo3dp expected actual =
+let checkTo3dp (expected: float) actual =
Assert.AreEqual (floor(actual * 1000.), expected)
[]
let ``pown works``() =
- pown 2.2 3 |> checkTo3dp 10648
+ pown 2.2 3 |> checkTo3dp 10648.
[]
let ``sqrt works``() =
- sqrt 4.5 |> checkTo3dp 2121
-
+ sqrt 4.5 |> checkTo3dp 2121.
+
[]
let ``acos works``() =
- acos 0.25 |> checkTo3dp 1318
+ acos 0.25 |> checkTo3dp 1318.
[]
let ``asin works``() =
- asin 0.25 |> checkTo3dp 252
+ asin 0.25 |> checkTo3dp 252.
[]
let ``atan works``() =
- atan 0.25 |> checkTo3dp 244
+ atan 0.25 |> checkTo3dp 244.
[]
let ``atan2 works``() =
- atan2 90. 15. |> checkTo3dp 1405
+ atan2 90. 15. |> checkTo3dp 1405.
[]
let ``cos works``() =
- cos 0.25 |> checkTo3dp 968
+ cos 0.25 |> checkTo3dp 968.
[]
let ``sin works``() =
- sin 0.25 |> checkTo3dp 247
+ sin 0.25 |> checkTo3dp 247.
[]
let ``tan works``() =
- tan 0.25 |> checkTo3dp 255
+ tan 0.25 |> checkTo3dp 255.
[]
let ``exp works``() =
- exp 8.0 |> checkTo3dp 2980957
+ exp 8.0 |> checkTo3dp 2980957.
[]
let ``log works``() =
- log 232.12 |> checkTo3dp 5447
+ log 232.12 |> checkTo3dp 5447.
[]
let ``log10 works``() =
- log10 232.12 |> checkTo3dp 2365
+ log10 232.12 |> checkTo3dp 2365.
[]
let ``PI works``() =
- checkTo3dp 3141 Math.PI
+ checkTo3dp 3141. Math.PI
[]
let ``E works``() =
- checkTo3dp 2718 Math.E
+ checkTo3dp 2718. Math.E
[]
let ``Math.abs works``() =
@@ -131,76 +131,76 @@ let ``Math.abs works``() =
[]
let ``Math.pown works``() =
- Math.Pow(2.2, 3.0) |> checkTo3dp 10648
+ Math.Pow(2.2, 3.0) |> checkTo3dp 10648.
[]
let ``Math.sqrt works``() =
- Math.Sqrt 4.5 |> checkTo3dp 2121
+ Math.Sqrt 4.5 |> checkTo3dp 2121.
[]
let ``Math.round works``() =
- Assert.AreEqual(Math.Round -12.5, -12)
+ Assert.AreEqual(Math.Round -12.5, -12.)
[]
let ``Math.ceil works``() =
- Assert.AreEqual(Math.Ceiling 11.25, 12)
+ Assert.AreEqual(Math.Ceiling 11.25, 12.)
[]
let ``Math.floor works``() =
- Assert.AreEqual(Math.Floor 11.75, 11)
+ Assert.AreEqual(Math.Floor 11.75, 11.)
[]
let ``Math.acos works``() =
- Math.Acos 0.25 |> checkTo3dp 1318
+ Math.Acos 0.25 |> checkTo3dp 1318.
[]
let ``Math.asin works``() =
- Math.Asin 0.25 |> checkTo3dp 252
+ Math.Asin 0.25 |> checkTo3dp 252.
[]
let ``Math.atan works``() =
- Math.Atan 0.25 |> checkTo3dp 244
+ Math.Atan 0.25 |> checkTo3dp 244.
[]
let ``Math.atan2 works``() =
- Math.Atan2(90., 15.) |> checkTo3dp 1405
+ Math.Atan2(90., 15.) |> checkTo3dp 1405.
[]
let ``Math.cos works``() =
- Math.Cos(0.1 * Math.PI) |> checkTo3dp 951
+ Math.Cos(0.1 * Math.PI) |> checkTo3dp 951.
[]
let ``Math.sin works``() =
- Math.Sin(0.25 * Math.PI) |> checkTo3dp 707
+ Math.Sin(0.25 * Math.PI) |> checkTo3dp 707.
[]
let ``Math.tan works``() =
- Math.Tan(0.5) |> checkTo3dp 546
+ Math.Tan(0.5) |> checkTo3dp 546.
[]
let ``Math.exp works``() =
- Math.Exp 8.0 |> checkTo3dp 2980957
+ Math.Exp 8.0 |> checkTo3dp 2980957.
[]
let ``Math.log works``() =
- Math.Log 232.12 |> checkTo3dp 5447
+ Math.Log 232.12 |> checkTo3dp 5447.
[]
let ``Math.log10 works``() =
- Math.Log10 232.12 |> checkTo3dp 2365
+ Math.Log10 232.12 |> checkTo3dp 2365.
[]
let ``incr works``() =
let i = ref 5
incr i
Assert.AreEqual(!i, 6)
-
+
[]
let ``decr works``() =
let i = ref 5
decr i
Assert.AreEqual(!i, 4)
-
+
[]
let ``System.Random works``() =
let rnd = System.Random()
diff --git a/src/tests/ArrayTests.fs b/src/tests/Main/ArrayTests.fs
similarity index 83%
rename from src/tests/ArrayTests.fs
rename to src/tests/Main/ArrayTests.fs
index b0df4d9c8e..8bfcab27ee 100644
--- a/src/tests/ArrayTests.fs
+++ b/src/tests/Main/ArrayTests.fs
@@ -1,8 +1,8 @@
-[]
+[]
module Fable.Tests.Arrays
open System
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
open System.Collections.Generic
@@ -21,25 +21,25 @@ type ParamArrayTest =
let add (xs: int[]) = ParamArrayTest.Add(xs)
[]
-let ``ParamArrayAttribute works``() =
+let ``ParamArrayAttribute works``() =
ParamArrayTest.Add(1, 2) |> equal 3
[]
-let ``Passing an array to ParamArrayAttribute works``() =
+let ``Passing an array to ParamArrayAttribute works``() =
ParamArrayTest.Add([|3; 2|]) |> equal 5
[]
-let ``Passing an array to ParamArrayAttribute from another function works``() =
+let ``Passing an array to ParamArrayAttribute from another function works``() =
add [|5;-7|] |> equal -2
#if FABLE_COMPILER
open Fable.Core
[]
-let jsConstructorIs (s: string) (ar: 'T[]) = true
+let jsConstructorIs (s: string) (ar: 'T[]) = true
[]
-let ``Typed Arrays work``() =
+let ``Typed Arrays work``() =
let xs = [| 1; 2; 3; |]
let ys = [| 1.; 2.; 3.; |]
let zs = [| "This is a string" |]
@@ -48,19 +48,19 @@ let ``Typed Arrays work``() =
zs |> jsConstructorIs "Array" |> equal true
[]
-let ``Mapping from Typed Arrays work``() =
+let ``Mapping from Typed Arrays work``() =
[| 1; 2; 3; |]
|> Array.map string
|> jsConstructorIs "Int32Array"
|> equal false
[]
-let ``Mapping to Typed Arrays work``() =
+let ``Mapping to Typed Arrays work``() =
[| "1"; "2"; "3"; |]
|> Array.map int
|> jsConstructorIs "Int32Array"
|> equal true
-
+
[| 1; 2; 3; |]
|> Array.map float
|> jsConstructorIs "Float64Array"
@@ -70,7 +70,7 @@ let ``Mapping to Typed Arrays work``() =
let f (x:obj) (y:obj) (z:obj) = (string x) + (string y) + (string z)
[]
-let ``Mapping from values to functions works``() =
+let ``Mapping from values to functions works``() =
let a = [| "a"; "b"; "c" |]
let b = [| 1; 2; 3 |]
let concaters1 = a |> Array.map (fun x y -> y + x)
@@ -97,42 +97,42 @@ let ``Mapping from typed arrays to non-numeric arrays doesn't coerce values``()
[]
let ``Byte arrays are not clamped by default``() =
- let ar = [|5uy|]
+ let ar = Util2.Helper2.CreateArray()
ar.[0] <- ar.[0] + 255uy
equal 4uy ar.[0]
#if FABLE_COMPILER && !DOTNETCORE
[]
let ``Clamped byte arrays work``() =
- let ar = Util2.Helper2.CreateClampedArray()
+ let ar = DllRef.Lib.createClampedArray()
ar.[0] <- ar.[0] + 255uy
equal 255uy ar.[0]
#endif
[]
-let ``Array slice with upper index work``() =
+let ``Array slice with upper index work``() =
let xs = [| 1; 2; 3; 4; 5; 6 |]
let ys = [| 8; 8; 8; 8; 8; 8; 8; 8; |]
xs.[..2] |> Array.sum |> equal 6
xs.[..2] <- ys
xs |> Array.sum |> equal 39
-
+
[]
-let ``Array slice with lower index work``() =
+let ``Array slice with lower index work``() =
let xs = [| 1; 2; 3; 4; 5; 6 |]
let ys = [| 8; 8; 8; 8; 8; 8; 8; 8; |]
xs.[4..] |> Array.sum |> equal 11
xs.[4..] <- ys
xs |> Array.sum |> equal 26
-
+
[]
-let ``Array slice with both indices work``() =
+let ``Array slice with both indices work``() =
let xs = [| 1; 2; 3; 4; 5; 6 |]
let ys = [| 8; 8; 8; 8; 8; 8; 8; 8; |]
xs.[1..3] |> Array.sum |> equal 9
xs.[1..3] <- ys
xs |> Array.sum |> equal 36
-
+
[]
let ``Array slice with non-numeric arrays work``() =
let xs = [|"A";"B";"C";"D"|]
@@ -141,77 +141,77 @@ let ``Array slice with non-numeric arrays work``() =
equal xs.[3] "D"
[]
-let ``Array literals work``() =
+let ``Array literals work``() =
let x = [| 1; 2; 3; 4; 5 |]
equal 5 x.Length
[]
-let ``Array indexer getter works``() =
+let ``Array indexer getter works``() =
let x = [| 1.; 2.; 3.; 4.; 5. |]
x.[2] |> equal 3.
[]
-let ``Array indexer setter works``() =
+let ``Array indexer setter works``() =
let x = [| 1.; 2.; 3.; 4.; 5. |]
x.[3] <- 10.
equal 10. x.[3]
[]
-let ``Array getter works``() =
+let ``Array getter works``() =
let x = [| 1.; 2.; 3.; 4.; 5. |]
Array.get x 2 |> equal 3.
[]
-let ``Array setter works``() =
+let ``Array setter works``() =
let x = [| 1.; 2.; 3.; 4.; 5. |]
Array.set x 3 10.
equal 10. x.[3]
[]
-let ``Array.Length works``() =
+let ``Array.Length works``() =
let xs = [|1.; 2.; 3.; 4.|]
xs.Length |> equal 4
[]
-let ``Array.zeroCreate works``() =
+let ``Array.zeroCreate works``() =
let xs = Array.zeroCreate 2
equal 2 xs.Length
equal 0 xs.[1]
[]
-let ``Array.create works``() =
+let ``Array.create works``() =
let xs = Array.create 2 5
equal 2 xs.Length
Array.sum xs |> equal 10
[]
-let ``Array.blit works``() =
+let ``Array.blit works``() =
let xs = [|1..10|]
let ys = Array.zeroCreate 20
Array.blit xs 3 ys 5 4 // [|0; 0; 0; 0; 0; 4; 5; 6; 7; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0|]
ys.[5] + ys.[6] + ys.[7] + ys.[8] |> equal 22
[]
-let ``Array.copy works``() =
+let ``Array.copy works``() =
let xs = [|1; 2; 3; 4|]
let ys = Array.copy xs
xs.[0] <- 0 // Ensure a deep copy
ys |> Array.sum |> equal 10
[]
-let ``Array.sub works``() =
+let ``Array.sub works``() =
let xs = [|0..99|]
let ys = Array.sub xs 5 10 // [|5; 6; 7; 8; 9; 10; 11; 12; 13; 14|]
ys |> Array.sum |> equal 95
[]
-let ``Array.fill works``() =
+let ``Array.fill works``() =
let xs = Array.zeroCreate 4 // [|0; 0; 0; 0|]
Array.fill xs 1 2 3 // [|0; 3; 3; 0|]
xs |> Array.sum |> equal 6
[]
-let ``Array.empty works``() =
+let ``Array.empty works``() =
let xs = Array.empty
xs.Length |> equal 0
@@ -225,72 +225,72 @@ let ``Array.append works``() =
zs2.[1] + zs2.[3] |> equal "yb"
[]
-let ``Array.average works``() =
+let ``Array.average works``() =
let xs = [|1.; 2.; 3.; 4.|]
Array.average xs
|> equal 2.5
[]
-let ``Array.averageBy works``() =
+let ``Array.averageBy works``() =
let xs = [|1.; 2.; 3.; 4.|]
Array.averageBy ((*) 2.) xs
|> equal 5.
[]
-let ``Array.choose works``() =
+let ``Array.choose works``() =
let xs = [|1L; 2L; 3L; 4L|]
let result = xs |> Array.choose (fun x ->
if x > 2L then Some x
- else None)
+ else None)
result.[0] + result.[1]
|> equal 7L
[]
-let ``Array.collect works``() =
+let ``Array.collect works``() =
let xs = [|[|1|]; [|2|]; [|3|]; [|4|]|]
let ys = xs |> Array.collect id
ys.[0] + ys.[1]
|> equal 3
-
+
let xs1 = [|[|1.; 2.|]; [|3.|]; [|4.; 5.; 6.;|]; [|7.|]|]
let ys1 = xs1 |> Array.collect id
ys1.[0] + ys1.[1] + ys1.[2] + ys1.[3] + ys1.[4]
- |> equal 15.
+ |> equal 15.
[]
-let ``Array.concat works``() =
+let ``Array.concat works``() =
let xs = [|[|1.|]; [|2.|]; [|3.|]; [|4.|]|]
let ys = xs |> Array.concat
ys.[0] + ys.[1]
|> equal 3.
[]
-let ``Array.exists works``() =
+let ``Array.exists works``() =
let xs = [|1u; 2u; 3u; 4u|]
xs |> Array.exists (fun x -> x = 2u)
|> equal true
[]
-let ``Array.exists2 works``() =
+let ``Array.exists2 works``() =
let xs = [|1UL; 2UL; 3UL; 4UL|]
let ys = [|1UL; 2UL; 3UL; 4UL|]
Array.exists2 (fun x y -> x * y = 16UL) xs ys
|> equal true
[]
-let ``Array.filter works``() =
+let ``Array.filter works``() =
let xs = [|1s; 2s; 3s; 4s|]
let ys = xs |> Array.filter (fun x -> x > 2s)
ys.Length |> equal 2
[]
-let ``Array.find works``() =
+let ``Array.find works``() =
let xs = [|1us; 2us; 3us; 4us|]
xs |> Array.find ((=) 2us)
|> equal 2us
[]
-let ``Array.findIndex works``() =
+let ``Array.findIndex works``() =
let xs = [|1.f; 2.f; 3.f; 4.f|]
xs |> Array.findIndex ((=) 2.f)
|> equal 1
@@ -322,39 +322,39 @@ let ``Array.tryFindIndexBack works``() =
xs |> Array.tryFindIndexBack ((=) 5.) |> equal None
[]
-let ``Array.fold works``() =
+let ``Array.fold works``() =
let xs = [|1y; 2y; 3y; 4y|]
let total = xs |> Array.fold (+) 0y
total |> equal 10y
[]
-let ``Array.fold2 works``() =
+let ``Array.fold2 works``() =
let xs = [|1uy; 2uy; 3uy; 4uy|]
let ys = [|1uy; 2uy; 3uy; 4uy|]
let total = Array.fold2 (fun x y z -> x + y + z) 0uy xs ys
total |> equal 20uy
[]
-let ``Array.foldBack works``() =
+let ``Array.foldBack works``() =
let xs = [|1.; 2.; 3.; 4.|]
let total = Array.foldBack (fun x acc -> acc - x) xs 0.
total |> equal -10.
[]
-let ``Array.foldBack2 works``() =
+let ``Array.foldBack2 works``() =
let xs = [|1; 2; 3; 4|]
let ys = [|1; 2; 3; 4|]
let total = Array.foldBack2 (fun x y acc -> x + y - acc) xs ys 0
total |> equal -4
[]
-let ``Array.forall works``() =
+let ``Array.forall works``() =
let xs = [|1.; 2.; 3.; 4.|]
Array.forall ((>) 5.) xs
|> equal true
[]
-let ``Array.forall2 works``() =
+let ``Array.forall2 works``() =
let xs = [|1.; 2.; 3.; 4.|]
let ys = [|1.; 2.; 3.; 5.|]
Array.forall2 (=) xs ys
@@ -363,7 +363,7 @@ let ``Array.forall2 works``() =
|> equal true
[]
-let ``Array.init works``() =
+let ``Array.init works``() =
let xs = Array.init 4 (float >> sqrt)
xs.[0] + xs.[1]
|> equal 1.
@@ -371,12 +371,12 @@ let ``Array.init works``() =
|> equal true
[]
-let ``Array.isEmpty works``() =
+let ``Array.isEmpty works``() =
Array.isEmpty [|"a"|] |> equal false
Array.isEmpty [||] |> equal true
[]
-let ``Array.iter works``() =
+let ``Array.iter works``() =
let xs = [|1.; 2.; 3.; 4.|]
let total = ref 0.
xs |> Array.iter (fun x ->
@@ -385,7 +385,7 @@ let ``Array.iter works``() =
!total |> equal 10.
[]
-let ``Array.iter2 works``() =
+let ``Array.iter2 works``() =
let xs = [|1; 2; 3; 4|]
let mutable total = 0
Array.iter2 (fun x y ->
@@ -394,7 +394,7 @@ let ``Array.iter2 works``() =
total |> equal -20
[]
-let ``Array.iteri works``() =
+let ``Array.iteri works``() =
let xs = [|1.; 2.; 3.; 4.|]
let total = ref 0.
xs |> Array.iteri (fun i x ->
@@ -403,7 +403,7 @@ let ``Array.iteri works``() =
!total |> equal 20.
[]
-let ``Array.iteri2 works``() =
+let ``Array.iteri2 works``() =
let xs = [|1.; 2.; 3.; 4.|]
let total = ref 0.
Array.iteri2 (fun i x y ->
@@ -412,101 +412,101 @@ let ``Array.iteri2 works``() =
!total |> equal 40.
[]
-let ``Array.length works``() =
+let ``Array.length works``() =
let xs = [|"a"; "a"; "a"; "a"|]
Array.length xs |> equal 4
[]
-let ``Array.map works``() =
+let ``Array.map works``() =
let xs = [|1.|]
let ys = xs |> Array.map ((*) 2.)
ys.[0] |> equal 2.
[]
-let ``Array.map2 works``() =
+let ``Array.map2 works``() =
let xs = [|1.|]
let ys = [|2.|]
let zs = Array.map2 (*) xs ys
zs.[0] |> equal 2.
[]
-let ``Array.mapi works``() =
+let ``Array.mapi works``() =
let xs = [|1.; 2.|]
let ys = xs |> Array.mapi (fun i x -> float i + x)
ys.[1] |> equal 3.
[]
-let ``Array.mapi2 works``() =
+let ``Array.mapi2 works``() =
let xs = [|1.; 2.|]
let ys = [|2.; 3.|]
let zs = Array.mapi2 (fun i x y -> float i + x * y) xs ys
zs.[1] |> equal 7.
[]
-let ``Array.mapFold works`` () =
+let ``Array.mapFold works`` () =
let xs = [|1y; 2y; 3y; 4y|]
let result = xs |> Array.mapFold (fun acc x -> (x * 2y, acc + x)) 0y
fst result |> Array.sum |> equal 20y
snd result |> equal 10y
[]
-let ``Array.mapFoldBack works`` () =
+let ``Array.mapFoldBack works`` () =
let xs = [|1.; 2.; 3.; 4.|]
let result = Array.mapFoldBack (fun x acc -> (x * -2., acc - x)) xs 0.
fst result |> Array.sum |> equal -20.
snd result |> equal -10.
[]
-let ``Array.max works``() =
+let ``Array.max works``() =
let xs = [|1.; 2.|]
xs |> Array.max
|> equal 2.
[]
-let ``Array.maxBy works``() =
+let ``Array.maxBy works``() =
let xs = [|1.; 2.|]
xs |> Array.maxBy (fun x -> -x)
|> equal 1.
[]
-let ``Array.min works``() =
+let ``Array.min works``() =
let xs = [|1.; 2.|]
xs |> Array.min
|> equal 1.
[]
-let ``Array.minBy works``() =
+let ``Array.minBy works``() =
let xs = [|1.; 2.|]
xs |> Array.minBy (fun x -> -x)
|> equal 2.
[]
-let ``Array.ofList works``() =
+let ``Array.ofList works``() =
let xs = [1.; 2.]
let ys = Array.ofList xs
ys.Length |> equal 2
[]
-let ``Array.ofSeq works``() =
+let ``Array.ofSeq works``() =
let xs = seq { yield 1; yield 2 }
let ys = Array.ofSeq xs
ys.[0] |> equal 1
[]
-let ``Array.partition works``() =
+let ``Array.partition works``() =
let xs = [|1.; 2.|]
let ys, zs = xs |> Array.partition (fun x -> x <= 1.)
ys.[0] - zs.[0]
|> equal -1.
[]
-let ``Array.permute works``() =
+let ``Array.permute works``() =
let xs = [|1.; 2.|]
let ys = xs |> Array.permute (fun i -> i + 1 - 2 * (i % 2))
ys.[0] |> equal 2.
[]
-let ``Array.pick works``() =
+let ``Array.pick works``() =
let xs = [|1.; 2.|]
xs |> Array.pick (fun x ->
match x with
@@ -524,32 +524,32 @@ let ``Array.range works``() =
|> equal 20
[]
-let ``Array.reduce works``() =
+let ``Array.reduce works``() =
let xs = [|1.; 2.; 3.; 4.|]
xs |> Array.reduce (-)
|> equal -8.
[]
-let ``Array.reduceBack works``() =
+let ``Array.reduceBack works``() =
let xs = [|1.; 2.; 3.; 4.|]
xs |> Array.reduceBack (-)
|> equal -2.
[]
-let ``Array.rev works``() =
+let ``Array.rev works``() =
let xs = [|1.; 2.|]
let ys = xs |> Array.rev
ys.[0] |> equal 2.
[]
-let ``Array.scan works``() =
+let ``Array.scan works``() =
let xs = [|1.; 2.; 3.; 4.|]
let ys = xs |> Array.scan (+) 0.
ys.[2] + ys.[3]
|> equal 9.
[]
-let ``Array.scanBack works``() =
+let ``Array.scanBack works``() =
let xs = [|1.; 2.; 3.; 4.|]
let ys = Array.scanBack (-) xs 0.
ys.[2] + ys.[3]
@@ -560,7 +560,7 @@ let ``Array.sort works``() =
let xs = [|3; 4; 1; -3; 2; 10|]
let ys = [|"a"; "c"; "B"; "d"|]
xs |> Array.sort |> Array.take 3 |> Array.sum |> equal 0
- ys |> Array.sort |> Array.item 1 |> equal "a"
+ ys |> Array.sort |> Array.item 1 |> equal "a"
[]
let ``Array.truncate works``() =
@@ -568,7 +568,7 @@ let ``Array.truncate works``() =
xs |> Array.truncate 2
|> Array.last
|> equal 2.
- // Array.truncate shouldn't throw an exception if there're not enough elements
+ // Array.truncate shouldn't throw an exception if there're not enough elements
try xs |> Array.truncate 20 |> Array.length with _ -> -1
|> equal 5
@@ -577,71 +577,71 @@ let ``Array.sortDescending works``() =
let xs = [|3; 4; 1; -3; 2; 10|]
let ys = [|"a"; "c"; "B"; "d"|]
xs |> Array.sortDescending |> Array.take 3 |> Array.sum |> equal 17
- ys |> Array.sortDescending |> Array.item 1 |> equal "c"
+ ys |> Array.sortDescending |> Array.item 1 |> equal "c"
[]
-let ``Array.sortBy works``() =
+let ``Array.sortBy works``() =
let xs = [|3.; 4.; 1.; 2.|]
let ys = xs |> Array.sortBy (fun x -> -x)
ys.[0] + ys.[1]
|> equal 7.
[]
-let ``Array.sortWith works``() =
+let ``Array.sortWith works``() =
let xs = [|3.; 4.; 1.; 2.|]
let ys = xs |> Array.sortWith (fun x y -> int(x - y))
ys.[0] + ys.[1]
|> equal 3.
[]
-let ``Array.sortInPlace works``() =
+let ``Array.sortInPlace works``() =
let xs = [|3.; 4.; 1.; 2.; 10.|]
Array.sortInPlace xs
xs.[0] + xs.[1]
|> equal 3.
[]
-let ``Array.sortInPlaceBy works``() =
+let ``Array.sortInPlaceBy works``() =
let xs = [|3.; 4.; 1.; 2.; 10.|]
Array.sortInPlaceBy (fun x -> -x) xs
xs.[0] + xs.[1]
|> equal 14.
[]
-let ``Array.sortInPlaceWith works``() =
+let ``Array.sortInPlaceWith works``() =
let xs = [|3.; 4.; 1.; 2.; 10.|]
Array.sortInPlaceWith (fun x y -> int(x - y)) xs
xs.[0] + xs.[1]
|> equal 3.
[]
-let ``Array.sum works``() =
+let ``Array.sum works``() =
let xs = [|1.; 2.|]
xs |> Array.sum
|> equal 3.
[]
-let ``Array.sumBy works``() =
+let ``Array.sumBy works``() =
let xs = [|1.; 2.|]
xs |> Array.sumBy ((*) 2.)
|> equal 6.
[]
-let ``Array.toList works``() =
+let ``Array.toList works``() =
let xs = [|1.; 2.|]
let ys = xs |> Array.toList
ys.[0] + ys.[1]
|> equal 3.
[]
-let ``Array.toSeq works``() =
+let ``Array.toSeq works``() =
let xs = [|1.; 2.|]
let ys = xs |> Array.toSeq
ys |> Seq.head
|> equal 1.
[]
-let ``Array.tryFind works``() =
+let ``Array.tryFind works``() =
let xs = [|1.; 2.|]
xs |> Array.tryFind ((=) 1.)
|> Option.isSome |> equal true
@@ -649,7 +649,7 @@ let ``Array.tryFind works``() =
|> Option.isSome |> equal false
[]
-let ``Array.tryFindIndex works``() =
+let ``Array.tryFindIndex works``() =
let xs = [|1.; 2.|]
xs |> Array.tryFindIndex ((=) 2.)
|> equal (Some 1)
@@ -657,7 +657,7 @@ let ``Array.tryFindIndex works``() =
|> equal None
[]
-let ``Array.tryPick works``() =
+let ``Array.tryPick works``() =
let xs = [|1.; 2.|]
let r = xs |> Array.tryPick (fun x ->
match x with
@@ -669,21 +669,21 @@ let ``Array.tryPick works``() =
|> equal 2.
[]
-let ``Array.unzip works``() =
+let ``Array.unzip works``() =
let xs = [|1., 2.|]
let ys, zs = xs |> Array.unzip
ys.[0] + zs.[0]
|> equal 3.
[]
-let ``Array.unzip3 works``() =
+let ``Array.unzip3 works``() =
let xs = [|1., 2., 3.|]
let ys, zs, ks = xs |> Array.unzip3
ys.[0] + zs.[0] + ks.[0]
|> equal 6.
[]
-let ``Array.zip works``() =
+let ``Array.zip works``() =
let xs = [|1.; 2.; 3.|]
let ys = [|1.; 2.; 3.|]
let zs = Array.zip xs ys
@@ -691,7 +691,7 @@ let ``Array.zip works``() =
x + y |> equal 2.
[]
-let ``Array.zip3 works``() =
+let ``Array.zip3 works``() =
let xs = [|1.; 2.; 3.|]
let ys = [|1.; 2.; 3.|]
let zs = [|1.; 2.; 3.|]
@@ -764,7 +764,7 @@ let ``Array.last works``() =
let xs = [|1.; 2.; 3.; 4.|]
xs |> Array.last
|> equal 4.
-
+
[]
let ``Array.tryLast works``() =
let xs = [|1.; 2.; 3.; 4.|]
diff --git a/src/tests/AsyncTests.fs b/src/tests/Main/AsyncTests.fs
similarity index 95%
rename from src/tests/AsyncTests.fs
rename to src/tests/Main/AsyncTests.fs
index e7dfbf100f..cb9c68d7f2 100644
--- a/src/tests/AsyncTests.fs
+++ b/src/tests/Main/AsyncTests.fs
@@ -1,7 +1,7 @@
-[]
+[]
module Fable.Tests.Async
open System
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
[]
@@ -12,7 +12,7 @@ let ``Simple async translates without exception``() =
[]
let ``Async while binding works correctly``() =
let mutable result = 0
- async {
+ async {
while result < 10 do
result <- result + 1
} |> Async.StartImmediate
@@ -22,7 +22,7 @@ let ``Async while binding works correctly``() =
let ``Async for binding works correctly``() =
let inputs = [|1; 2; 3|]
let result = ref 0
- async {
+ async {
for inp in inputs do
result := !result + inp
} |> Async.StartImmediate
@@ -32,7 +32,7 @@ let ``Async for binding works correctly``() =
let ``Async exceptions are handled correctly``() =
let result = ref 0
let f shouldThrow =
- async {
+ async {
try
if shouldThrow then failwith "boom!"
else result := 12
@@ -45,13 +45,13 @@ let ``Async exceptions are handled correctly``() =
let ``Simple async is executed correctly``() =
let result = ref false
let x = async { return 99 }
- async {
+ async {
let! x = x
let y = 99
result := x = y
}
//TODO: RunSynchronously would make more sense here but in JS I think this will be ok.
- |> Async.StartImmediate
+ |> Async.StartImmediate
equal !result true
type DisposableAction(f) =
@@ -66,12 +66,12 @@ let ``async use statements should dispose of resources when they go out of scope
let resource = async {
return new DisposableAction(fun () -> isDisposed := true)
}
- async {
+ async {
use! r = resource
step1ok := not !isDisposed
}
//TODO: RunSynchronously would make more sense here but in JS I think this will be ok.
- |> Async.StartImmediate
+ |> Async.StartImmediate
step2ok := !isDisposed
(!step1ok && !step2ok) |> equal true
@@ -80,7 +80,7 @@ let ``Try ... with ... expressions inside async expressions work the same``() =
let result = ref ""
let throw() : unit =
raise(exn "Boo!")
- let append(x) =
+ let append(x) =
result := !result + x
let innerAsync() =
async {
@@ -91,7 +91,7 @@ let ``Try ... with ... expressions inside async expressions work the same``() =
with _ -> append "d"
append "e"
}
- async {
+ async {
append "a"
try do! innerAsync()
with _ -> append "2"
@@ -209,7 +209,7 @@ let ``Interaction between Async and Promise works``() =
} |> Async.RunSynchronously
[]
-let ``Promises can be cancelled``() =
+let ``Promises can be cancelled``() =
async {
let res = ref 0
let tcs = new System.Threading.CancellationTokenSource(50)
@@ -262,7 +262,7 @@ let ``MailboxProcessor.postAndAsyncReply works``() =
async {
let formatString = "Msg: {0} - {1}"
let agent = MailboxProcessor.Start(fun inbox ->
- let rec loop n = async {
+ let rec loop n = async {
let! (message, replyChannel) = inbox.Receive()
do! Async.Sleep(100) // Delay a bit
replyChannel.Reply(String.Format(formatString, n, message))
@@ -277,8 +277,8 @@ let ``MailboxProcessor.postAndAsyncReply works``() =
[]
let ``Async try .. with returns correctly from 'with' branch``() =
- let work = async {
- try
+ let work = async {
+ try
failwith "testing"
return -1
with e ->
@@ -305,29 +305,29 @@ let ``Deep recursion with async doesn't cause stack overflow``() =
let ``Nested failure propagates in async expressions``() =
async {
let data = ref ""
- let f1 x =
+ let f1 x =
async {
try
failwith "1"
return x
with
- | e -> return! failwith ("2 " + e.Message.Trim('"'))
+ | e -> return! failwith ("2 " + e.Message.Trim('"'))
}
- let f2 x =
+ let f2 x =
async {
try
return! f1 x
with
- | e -> return! failwith ("3 " + e.Message.Trim('"'))
+ | e -> return! failwith ("3 " + e.Message.Trim('"'))
}
let f() =
- async {
+ async {
try
let! y = f2 4
return ()
with
| e -> data := e.Message.Trim('"')
- }
+ }
|> Async.StartImmediate
f()
do! Async.Sleep 100
@@ -360,13 +360,13 @@ let ``Final statement inside async expressions can throw``() =
try data := !data + "1 "
finally failwith "boom!"
}
- async {
+ async {
try
do! f()
return ()
with
| e -> data := !data + e.Message.Trim('"')
- }
+ }
|> Async.StartImmediate
do! Async.Sleep 100
equal "1 boom!" !data
diff --git a/src/tests/ComparisonTests.fs b/src/tests/Main/ComparisonTests.fs
similarity index 90%
rename from src/tests/ComparisonTests.fs
rename to src/tests/Main/ComparisonTests.fs
index e922c6dfe9..bab5f10ab7 100644
--- a/src/tests/ComparisonTests.fs
+++ b/src/tests/Main/ComparisonTests.fs
@@ -1,12 +1,12 @@
-[]
+[]
module Fable.Tests.Comparison
open System
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
open System.Collections.Generic
[]
-let ``Typed array equality works``() =
+let ``Typed array equality works``() =
let xs1 = [| 1; 2; 3 |]
let xs2 = [| 1; 2; 3 |]
let xs3 = [| 1; 2; 4 |]
@@ -18,7 +18,7 @@ let ``Typed array equality works``() =
equal true (xs1 <> xs4)
[]
-let ``Array equality works``() =
+let ``Array equality works``() =
let xs1 = [| "1"; "2"; "3" |]
let xs2 = [| "1"; "2"; "3" |]
let xs3 = [| "1"; "2"; "4" |]
@@ -30,7 +30,7 @@ let ``Array equality works``() =
equal true (xs1 <> xs4)
[]
-let ``Tuple equality works``() =
+let ``Tuple equality works``() =
let xs1 = ( 1, 2, 3 )
let xs2 = ( 1, 2, 3 )
let xs3 = ( 1, 2, 4 )
@@ -40,7 +40,7 @@ let ``Tuple equality works``() =
equal false (xs1 <> xs2)
[]
-let ``List equality works``() =
+let ``List equality works``() =
let xs1 = [ 1; 2; 3 ]
let xs2 = [ 1; 2; 3 ]
let xs3 = [ 1; 2; 4 ]
@@ -50,7 +50,7 @@ let ``List equality works``() =
equal false (xs1 <> xs2)
[]
-let ``Set equality works``() =
+let ``Set equality works``() =
let xs1 = Set [ 1; 2; 3 ]
let xs2 = Set [ 1; 2; 3 ]
let xs3 = Set [ 1; 2; 4 ]
@@ -62,9 +62,9 @@ let ``Set equality works``() =
equal false (xs1 <> xs2)
equal true (xs1 = xs4)
equal false (xs1 <> xs5)
-
+
[]
-let ``Map equality works``() =
+let ``Map equality works``() =
let xs1 = Map [ ("a", 1); ("b", 2); ("c", 3) ]
let xs2 = Map [ ("a", 1); ("b", 2); ("c", 3) ]
let xs3 = Map [ ("a", 1); ("b", 2); ("c", 4) ]
@@ -74,11 +74,11 @@ let ``Map equality works``() =
equal true (xs1 <> xs3)
equal false (xs1 <> xs2)
equal true (xs1 = xs4)
-
+
type UTest = A of int | B of int
[]
-let ``Union equality works``() =
+let ``Union equality works``() =
let u1 = A 2
let u2 = A 2
let u3 = A 4
@@ -120,7 +120,7 @@ type UTest2 =
#endif
[]
-let ``Union custom equality works``() =
+let ``Union custom equality works``() =
let u1 = String "A"
let u2 = String "A"
let u3 = String "AA"
@@ -130,7 +130,7 @@ let ``Union custom equality works``() =
type RTest = { a: int; b: int }
[]
-let ``Record equality works``() =
+let ``Record equality works``() =
let r1 = { a = 1; b = 2 }
let r2 = { a = 1; b = 2 }
let r3 = { a = 1; b = 4 }
@@ -145,7 +145,7 @@ let ``Record equality works``() =
type RTest2 = { a2: int; b2: int }
[]
-let ``Record reference equality works``() =
+let ``Record reference equality works``() =
let r1 = { a2 = 1; b2 = 2 }
let r2 = { a2 = 1; b2 = 2 }
equal false (r1 = r2)
@@ -156,7 +156,7 @@ type Test(i: int) =
override x.Equals(yobj) =
match yobj with
| :? Test as y -> y.Value + 1 = x.Value
- | _ -> false
+ | _ -> false
interface System.IComparable with
member x.CompareTo(yobj) =
match yobj with
@@ -170,9 +170,9 @@ type Test(i: int) =
interface System.IEquatable with
member x.Equals(y) =
y.Value + 1 = x.Value
-
+
[]
-let ``Equality with objects implementing IEquatable works``() =
+let ``Equality with objects implementing IEquatable works``() =
let c1 = Test(5)
let c2 = Test(4)
let c3 = Test(5)
@@ -184,7 +184,7 @@ let ``Equality with objects implementing IEquatable works``() =
Object.ReferenceEquals(c1, c2) |> equal false
[]
-let ``Typed array comparison works``() =
+let ``Typed array comparison works``() =
let xs1 = [| 1; 2; 3 |]
let xs2 = [| 1; 2; 3 |]
let xs3 = [| 1; 2; 4 |]
@@ -202,7 +202,7 @@ let ``Typed array comparison works``() =
equal false (xs1 > xs6)
[]
-let ``Array comparison works``() =
+let ``Array comparison works``() =
let xs1 = [| "1"; "2"; "3" |]
let xs2 = [| "1"; "2"; "3" |]
let xs3 = [| "1"; "2"; "4" |]
@@ -220,7 +220,7 @@ let ``Array comparison works``() =
equal false (xs1 > xs6)
[]
-let ``Tuple comparison works``() =
+let ``Tuple comparison works``() =
let xs1 = ( 1, 2, 3 )
let xs2 = ( 1, 2, 3 )
let xs3 = ( 1, 2, 4 )
@@ -232,7 +232,7 @@ let ``Tuple comparison works``() =
equal false (xs1 < xs4)
[]
-let ``List comparison works``() =
+let ``List comparison works``() =
let xs1 = [ 1; 2; 3 ]
let xs2 = [ 1; 2; 3 ]
let xs3 = [ 1; 2; 4 ]
@@ -250,7 +250,7 @@ let ``List comparison works``() =
equal false (xs1 > xs6)
[]
-let ``Set comparison works``() =
+let ``Set comparison works``() =
let xs1 = Set [ 1; 2; 3 ]
let xs2 = Set [ 1; 2; 3 ]
let xs3 = Set [ 1; 2; 4 ]
@@ -265,9 +265,9 @@ let ``Set comparison works``() =
equal 1 (compare xs1 xs5)
equal true (xs1 > xs5)
equal 0 (compare xs1 xs6)
-
+
[]
-let ``Map comparison works``() =
+let ``Map comparison works``() =
let xs1 = Map [ ("a", 1); ("b", 2); ("c", 3) ]
let xs2 = Map [ ("a", 1); ("b", 2); ("c", 3) ]
let xs3 = Map [ ("a", 1); ("b", 2); ("c", 4) ]
@@ -285,7 +285,7 @@ let ``Map comparison works``() =
equal false (xs1 > xs6)
[]
-let ``Union comparison works``() =
+let ``Union comparison works``() =
let u1 = A 2
let u2 = A 2
let u3 = A 4
@@ -299,36 +299,36 @@ let ``Union comparison works``() =
(compare u1 u5) = 0 |> equal false
[]
-let ``Union custom comparison works``() =
+let ``Union custom comparison works``() =
let u1 = String "A"
let u2 = String "A"
let u3 = String "AA"
equal 0 (compare u1 u3)
equal true (compare u1 u2 > 0)
-
+
[]
-let ``Record comparison works``() =
+let ``Record comparison works``() =
let r1 = { a = 1; b = 2 }
let r2 = { a = 1; b = 2 }
let r3 = { a = 1; b = 4 }
equal 0 (compare r1 r2)
(compare r1 r3) = 0 |> equal false
-
+
[]
-let ``Comparison with objects implementing IComparable works``() =
+let ``Comparison with objects implementing IComparable works``() =
let c1 = Test(5)
let c2 = Test(4)
let c3 = Test(5)
equal 0 (compare c1 c2)
equal 1 (compare c1 c3)
- equal true (c1 > c3)
+ equal true (c1 > c3)
[]
-let ``max works with primitives``() =
+let ``max works with primitives``() =
max 1 2 |> equal 2
Math.Max(1, 2) |> equal 2
max "a" "b" |> equal "b"
-
+
[]
let ``max works with records``() =
let r1 = {a=1; b=1}
@@ -336,31 +336,31 @@ let ``max works with records``() =
max r1 r2 |> equal r2
[]
-let ``max with objects implementing IComparable works``() =
+let ``max with objects implementing IComparable works``() =
let c1 = Test(5)
let c2 = Test(5)
max c1 c2 |> equal c1
-
+
[]
-let ``min works with primitives``() =
+let ``min works with primitives``() =
min 1 2 |> equal 1
Math.Min(1, 2) |> equal 1
min "a" "b" |> equal "a"
-
+
[]
let ``min works with records``() =
let r1 = {a=1; b=1}
let r2 = {a=1; b=2}
min r1 r2 |> equal r1
-
+
[]
-let ``min with objects implementing IComparable works``() =
+let ``min with objects implementing IComparable works``() =
let c1 = Test(5)
let c2 = Test(5)
min c1 c2 |> equal c2
[]
-let ``isNull works with primitives``() =
+let ``isNull works with primitives``() =
isNull null |> equal true
isNull "" |> equal false
isNull "0" |> equal false
diff --git a/src/tests/ConvertTests.fs b/src/tests/Main/ConvertTests.fs
similarity index 99%
rename from src/tests/ConvertTests.fs
rename to src/tests/Main/ConvertTests.fs
index 03b2cd080e..c0d2dc11be 100644
--- a/src/tests/ConvertTests.fs
+++ b/src/tests/Main/ConvertTests.fs
@@ -1,7 +1,7 @@
-[]
+[]
module Fable.Tests.Convert
open System
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
[]
diff --git a/src/tests/DateTimeTests.fs b/src/tests/Main/DateTimeTests.fs
similarity index 99%
rename from src/tests/DateTimeTests.fs
rename to src/tests/Main/DateTimeTests.fs
index 40af95c4c7..fa0c202096 100644
--- a/src/tests/DateTimeTests.fs
+++ b/src/tests/Main/DateTimeTests.fs
@@ -1,7 +1,7 @@
-[]
+[]
module Fable.Tests.DateTime
open System
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
#if DOTNETCORE
@@ -40,8 +40,8 @@ let ``DateTime.ToString with format works``() =
let ``DateTime can be JSON serialized forth and back``() =
let utc = DateTime(2016, 8, 4, 17, 30, 0, DateTimeKind.Utc)
#if FABLE_COMPILER
- let json = Fable.Core.Serialize.toJson utc
- let utc = Fable.Core.Serialize.ofJson json
+ let json = Fable.Core.JsInterop.toJson utc
+ let utc = Fable.Core.JsInterop.ofJson json
#else
let json = Newtonsoft.Json.JsonConvert.SerializeObject utc
let utc = Newtonsoft.Json.JsonConvert.DeserializeObject json
diff --git a/src/tests/DictionaryTests.fs b/src/tests/Main/DictionaryTests.fs
similarity index 92%
rename from src/tests/DictionaryTests.fs
rename to src/tests/Main/DictionaryTests.fs
index 0ee8ce67cb..acbf5ed0bf 100644
--- a/src/tests/DictionaryTests.fs
+++ b/src/tests/Main/DictionaryTests.fs
@@ -1,8 +1,8 @@
-[]
+[]
module Fable.Tests.Dictionaries
open System
open System.Collections.Generic
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
[]
@@ -21,7 +21,7 @@ let ``Dictionary creation from IDictionary works``() =
let dic = Dictionary<_,_>(idic)
dic.Add("100", 100)
equal 10 idic.Count
- equal 11 dic.Count
+ equal 11 dic.Count
[]
let ``Interface IDictionary iteration works``() =
@@ -93,7 +93,7 @@ let ``Dictionary.Keys works``() =
dic.Add("B", 2)
dic.Keys |> Seq.fold (fun acc k -> acc + dic.[k]) 0
|> equal 3
-
+
[]
let ``Dictionary.Keys.Count works``() =
let dic = Dictionary<_,_>()
@@ -101,7 +101,7 @@ let ``Dictionary.Keys.Count works``() =
dic.Add("B", 2)
dic.Keys.Count
|> equal 2
-
+
[]
let ``Dictionary.Values works``() =
let dic = Dictionary<_,_>()
@@ -197,14 +197,14 @@ type R = { i: int; s: string }
let ``Dictionaries can be JSON serialized forth and back``() =
let x = Dictionary<_,_>()
x.Add("a", { i=1; s="1" })
- x.Add("b", { i=2; s="2" })
+ x.Add("b", { i=2; s="2" })
#if FABLE_COMPILER
- let json = Fable.Core.Serialize.toJson x
- let x2 = Fable.Core.Serialize.ofJson> json
+ let json = Fable.Core.JsInterop.toJson x
+ let x2 = Fable.Core.JsInterop.ofJson> json
(0, x2) ||> Seq.fold (fun acc kv -> acc + kv.Value.i)
- |> equal 3
- let json = Fable.Core.Serialize.toJsonWithTypeInfo x
- let x2 = Fable.Core.Serialize.ofJsonWithTypeInfo> json
+ |> equal 3
+ let json = Fable.Core.JsInterop.toJsonWithTypeInfo x
+ let x2 = Fable.Core.JsInterop.ofJsonWithTypeInfo> json
#else
let json = Newtonsoft.Json.JsonConvert.SerializeObject x
let x2 = Newtonsoft.Json.JsonConvert.DeserializeObject> json
@@ -216,11 +216,11 @@ let ``Dictionaries can be JSON serialized forth and back``() =
let ``Dictionaries serialized with Json.NET can be deserialized``() =
// let x = Dictionary<_,_>()
// x.Add("a", { i=1; s="1" })
- // x.Add("b", { i=2; s="2" })
+ // x.Add("b", { i=2; s="2" })
// let json = JsonConvert.SerializeObject(x, JsonSerializerSettings(TypeNameHandling=TypeNameHandling.All))
let json = """{"$type":"System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[Fable.Tests.Maps+R, Fable.Tests]], FSharp.Core","a":{"$type":"Fable.Tests.Maps+R, Fable.Tests","i":1,"s":"1"},"b":{"$type":"Fable.Tests.Maps+R, Fable.Tests","i":2,"s":"2"}}"""
#if FABLE_COMPILER
- let x2 = Fable.Core.Serialize.ofJsonWithTypeInfo> json
+ let x2 = Fable.Core.JsInterop.ofJsonWithTypeInfo> json
#else
let x2 = Newtonsoft.Json.JsonConvert.DeserializeObject> json
#endif
diff --git a/src/tests/EnumTests.fs b/src/tests/Main/EnumTests.fs
similarity index 98%
rename from src/tests/EnumTests.fs
rename to src/tests/Main/EnumTests.fs
index 875ecf1309..19dce3ab20 100644
--- a/src/tests/EnumTests.fs
+++ b/src/tests/Main/EnumTests.fs
@@ -1,9 +1,9 @@
-[]
+[]
module Fable.Tests.Enum
open System
open FSharp.Core.LanguagePrimitives
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
type Fruits =
diff --git a/src/tests/EnumerableTests.fs b/src/tests/Main/EnumerableTests.fs
similarity index 82%
rename from src/tests/EnumerableTests.fs
rename to src/tests/Main/EnumerableTests.fs
index df06ef9ad8..e3b87f8cbc 100644
--- a/src/tests/EnumerableTests.fs
+++ b/src/tests/Main/EnumerableTests.fs
@@ -1,15 +1,15 @@
-[]
+[]
module Fable.Tests.Enumerable
open System
open System.Collections
open System.Collections.Generic
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
type Enumerator<'T>(gen) =
- interface IEnumerable<'T> with
+ interface IEnumerable<'T> with
member x.GetEnumerator() = gen()
- interface IEnumerable with
+ interface IEnumerable with
member x.GetEnumerator() = (gen() :> IEnumerator)
type Fibonacci() =
@@ -20,7 +20,7 @@ type Fibonacci() =
member x.Current = box (fst state)
member x.MoveNext() = state <- (snd state, fst state + snd state); (fst state) < 1000
member x.Reset() = state <- (1,1)
- interface System.IDisposable with
+ interface System.IDisposable with
member x.Dispose() = ()
let fibGen() =
@@ -31,13 +31,13 @@ let fibGen() =
member x.Current = box (fst state)
member x.MoveNext() = state <- (snd state, fst state + snd state); (fst state) < 1000
member x.Reset() = state <- (1,1)
- interface System.IDisposable with
+ interface System.IDisposable with
member x.Dispose() = () }
-let toSeq gen =
- { new IEnumerable<'T> with
- member x.GetEnumerator() = gen()
- interface IEnumerable with
+let toSeq gen =
+ { new IEnumerable<'T> with
+ member x.GetEnumerator() = gen()
+ interface IEnumerable with
member x.GetEnumerator() = (gen() :> IEnumerator) }
let fib() = Seq.unfold (fun state ->
diff --git a/src/tests/EventTests.fs b/src/tests/Main/EventTests.fs
similarity index 88%
rename from src/tests/EventTests.fs
rename to src/tests/Main/EventTests.fs
index 4f48571a66..bdd97635b6 100644
--- a/src/tests/EventTests.fs
+++ b/src/tests/Main/EventTests.fs
@@ -1,7 +1,7 @@
-[]
+[]
module Fable.Tests.Event
open System
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
[]
@@ -22,16 +22,16 @@ let ``Event.choose works``() =
|> Event.add (fun n -> result <- n)
source.Trigger (Choice1Of2 2)
source.Trigger (Choice2Of2 3)
-
+
equal 3 result
[]
let ``Event.filter works``() =
- let mutable result = 0
-
+ let mutable result = 0
+
let source = Event<_>()
source.Publish
- |> Event.filter ((>) 5)
+ |> Event.filter ((>) 5)
|> Event.add (fun n -> result <- n )
source.Trigger 3
equal 3 result
@@ -40,14 +40,14 @@ let ``Event.filter works``() =
[]
let ``Event.map works``() =
- let mutable result = 0
+ let mutable result = 0
let source = Event<_>()
- source.Publish
+ source.Publish
|> Event.map ((+) 3)
|> Event.add (fun n -> result <- n)
source.Trigger 10
-
+
equal 13 result
[]
@@ -77,10 +77,10 @@ let ``Event.pairwise works``() =
result2 <- y)
source.Trigger 1
source.Trigger 2
-
+
equal 1 result1
equal 2 result2
-
+
[]
let ``Event.partition works``() =
@@ -94,7 +94,7 @@ let ``Event.partition works``() =
Event.add (fun n -> result2 <- n) source2
source.Trigger 8
source.Trigger 3
-
+
equal 3 result1
equal 8 result2
@@ -109,7 +109,7 @@ let ``Event.scan works``() =
)
source.Trigger 1
source.Trigger 1
-
+
equal state 7
[]
@@ -127,50 +127,50 @@ let ``Event.split works``() =
Event.add (fun n -> result2 <- n) source2
source.Trigger 6
source.Trigger 2
-
+
equal 6 result1
- equal 12 result2
-
+ equal 12 result2
+
[]
let ``IEvent.add works``() =
- let mutable result = 0
-
+ let mutable result = 0
+
let source = Event<_> ()
source.Publish.Add(fun n -> result <- n)
-
+
source.Trigger 6
equal 6 result
-
+
[]
let ``IEvent.Subscribe works``() =
- let mutable result = 0
-
- let source = Event<_> ()
+ let mutable result = 0
+
+ let source = Event<_> ()
source.Publish.Subscribe(fun n -> result <- n) |> ignore
-
+
source.Trigger 6
equal 6 result
[]
let ``IEvent.AddHandler works``() =
- let mutable result = 0
-
- let source = Event<_> ()
+ let mutable result = 0
+
+ let source = Event<_> ()
source.Publish.AddHandler(new Handler<_>(fun sender n -> result <- n)) |> ignore
-
+
source.Trigger 6
equal 6 result
-
+
[]
let ``IEvent.RemoveHandler works``() =
- let mutable result = 0
-
+ let mutable result = 0
+
let handler = new Handler<_>(fun sender n -> result <- n)
-
- let source = Event<_> ()
+
+ let source = Event<_> ()
source.Publish.AddHandler(handler) |> ignore
source.Publish.RemoveHandler(handler)
-
+
source.Trigger 6
equal 0 result
@@ -202,5 +202,5 @@ let ``Classes can trigger non-CLI events``() =
let disp = classWithEvent.Event.Subscribe(fun (sender, arg) -> result <- arg)
classWithEvent.TestEvent("Hello")
disp.Dispose()
- classWithEvent.TestEvent("Bye")
+ classWithEvent.TestEvent("Bye")
equal "Hello" result
diff --git a/src/tests/Other/Fable.Tests.Clamp.fsproj b/src/tests/Main/Fable.Tests.fsproj
similarity index 87%
rename from src/tests/Other/Fable.Tests.Clamp.fsproj
rename to src/tests/Main/Fable.Tests.fsproj
index 462ca2f3b7..80add10b40 100644
--- a/src/tests/Other/Fable.Tests.Clamp.fsproj
+++ b/src/tests/Main/Fable.Tests.fsproj
@@ -1,56 +1,90 @@
-
+
-
+ Fable.Tests
+ Fable.Tests
+ Fable.Tests
Debug
AnyCPU
2.0
- 1e44403b-7834-4842-91b1-53a5fa731c58
+ 6ef06954-fbdf-42c7-815c-b13ba2926c93
Library
- Fable.Tests.Clamped
- Fable.Tests.Clamped
v4.5
- true
4.4.0.0
- Fable.Tests.Clamp
true
- full
+ Full
false
false
bin\Debug\
DEBUG;TRACE
3
- AnyCPU
- true
- pdbonly
+ PdbOnly
true
true
bin\Release\
TRACE
3
- AnyCPU
- true
-
- True
-
+
+ ../../../build/fable-core/Fable.Core.dll
+
+
+ ../../../build/tests_dll/Fable.Tests.DllRef.dll
+
-
-
+
+ Fable.Tests.Spaces.fsproj
+ {1e44403b-7834-4842-91b1-53a5fa731c58}
+
+
+ Fable.Tests.External.fsproj
+ {c842c174-2ce4-4d85-b694-7a5f1c357ee4}
+
-
- 11
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -64,13 +98,6 @@
-
@@ -82,6 +109,71 @@
+
+
+
+
+ ..\..\..\packages\FSharp.Core\lib\net20\FSharp.Core.dll
+ True
+ True
+
+
+
+
+
+
+ ..\..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll
+ True
+ True
+
+
+
+
+
+
+ ..\..\..\packages\FSharp.Core\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll
+ True
+ True
+
+
+
+
+
+
+ ..\..\..\packages\FSharp.Core\lib\portable-net45+netcore45\FSharp.Core.dll
+ True
+ True
+
+
+
+
+
+
+ ..\..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wp8\FSharp.Core.dll
+ True
+ True
+
+
+
+
+
+
+ ..\..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wpa81+wp8\FSharp.Core.dll
+ True
+ True
+
+
+
+
+
+
+ ..\..\..\packages\FSharp.Core\lib\portable-net45+sl5+netcore45\FSharp.Core.dll
+ True
+ True
+
+
+
+
diff --git a/src/tests/HashSetTests.fs b/src/tests/Main/HashSetTests.fs
similarity index 89%
rename from src/tests/HashSetTests.fs
rename to src/tests/Main/HashSetTests.fs
index 01ebac013c..5cd3e8b8a6 100644
--- a/src/tests/HashSetTests.fs
+++ b/src/tests/Main/HashSetTests.fs
@@ -1,6 +1,6 @@
-[]
+[]
module Fable.Tests.HashSets
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
open System.Collections.Generic
@@ -30,19 +30,19 @@ let ``HashSet.Add returns false if already present``() =
[]
let ``HashSet.Remove works when item is present``() =
- let xs = set [1]
+ let xs = set [1]
xs.Remove 1 |> equal true
xs.Count |> equal 0
[]
let ``HashSet.Remove works when item is not present``() =
- let xs = set [1; 2]
+ let xs = set [1; 2]
xs.Remove 3 |> equal false
xs.Count |> equal 2
[]
let ``HashSet.UnionWith works``() =
- let xs = set [1; 2]
+ let xs = set [1; 2]
let ys = set [2; 4]
xs.UnionWith ys
(xs.Contains 1 && xs.Contains 2 && xs.Contains 4)
@@ -50,7 +50,7 @@ let ``HashSet.UnionWith works``() =
[]
let ``HashSet.IntersectWith works``() =
- let xs = set [1; 2]
+ let xs = set [1; 2]
let ys = set [2; 4]
xs.IntersectWith ys
xs.Contains 1 |> equal false
@@ -58,7 +58,7 @@ let ``HashSet.IntersectWith works``() =
[]
let ``HashSet.ExceptWith works``() =
- let xs = set [1; 2]
+ let xs = set [1; 2]
let ys = set [2; 4]
xs.ExceptWith ys
xs.Contains 1 |> equal true
@@ -99,7 +99,7 @@ let ``HashSet.Count works``() =
let zs = set [1; 1]
zs.Count |> equal 1
let zs' = set [1; 2]
- zs'.Count |> equal 2
+ zs'.Count |> equal 2
[]
let ``HashSet.Add works``() =
@@ -122,7 +122,7 @@ let ``HashSet.Contains works``() =
hs.Add("Hello") |> equal true
hs.Add("World!") |> equal true
hs.Contains("Hello") |> equal true
- hs.Contains("Everybody!") |> equal false
+ hs.Contains("Everybody!") |> equal false
[]
let ``HashSet.CopyTo works``() =
@@ -163,12 +163,12 @@ let ``HashSet can be JSON serialized forth and back``() =
x.Add(1) |> ignore
x.Add(2) |> ignore
#if FABLE_COMPILER
- let json = Fable.Core.Serialize.toJson x
- let x2 = Fable.Core.Serialize.ofJson> json
+ let json = Fable.Core.JsInterop.toJson x
+ let x2 = Fable.Core.JsInterop.ofJson> json
x2.IsSubsetOf x |> equal true
(0, x2) ||> Seq.fold (fun acc v -> acc + v) |> equal 3
- let json = Fable.Core.Serialize.toJsonWithTypeInfo x
- let x2 = Fable.Core.Serialize.ofJsonWithTypeInfo> json
+ let json = Fable.Core.JsInterop.toJsonWithTypeInfo x
+ let x2 = Fable.Core.JsInterop.ofJsonWithTypeInfo> json
#else
let json = Newtonsoft.Json.JsonConvert.SerializeObject x
let x2 = Newtonsoft.Json.JsonConvert.DeserializeObject> json
@@ -184,7 +184,7 @@ let ``HashSet serialized with Json.NET can be deserialized``() =
// let json = JsonConvert.SerializeObject(x, JsonSerializerSettings(TypeNameHandling=TypeNameHandling.All))
let json = """{"$type":"System.Collections.Generic.HashSet`1[[Fable.Tests.HashSets+R, Fable.Tests]], FSharp.Core","$values":[{"$type":"Fable.Tests.HashSets+R, Fable.Tests","i":1,"s":"1"},{"$type":"Fable.Tests.HashSets+R, Fable.Tests","i":2,"s":"2"}]}"""
#if FABLE_COMPILER
- let x2 = Fable.Core.Serialize.ofJsonWithTypeInfo> json
+ let x2 = Fable.Core.JsInterop.ofJsonWithTypeInfo> json
#else
let x2 = Newtonsoft.Json.JsonConvert.DeserializeObject> json
#endif
diff --git a/src/tests/JsonTests.fs b/src/tests/Main/JsonTests.fs
similarity index 75%
rename from src/tests/JsonTests.fs
rename to src/tests/Main/JsonTests.fs
index 973d6d7750..e00dcdd40c 100644
--- a/src/tests/JsonTests.fs
+++ b/src/tests/Main/JsonTests.fs
@@ -1,17 +1,15 @@
-[]
+[]
module Fable.Tests.Json
-open NUnit.Framework
+open Util.Testing
open Fable.Tests.Util
-open Newtonsoft.Json
-type S =
#if FABLE_COMPILER
- static member toJson(x) = Fable.Core.Serialize.toJson(x)
- static member ofJson<'T>(x, []?t) =
- Fable.Core.Serialize.ofJson<'T>(x, ?t=t)
+let inline toJson(x) = Fable.Core.JsInterop.toJson(x)
+let inline ofJson<'T>(x) = Fable.Core.JsInterop.ofJson<'T>(x)
#else
- static member toJson x = JsonConvert.SerializeObject(x, Fable.JsonConverter())
- static member ofJson<'T> x = JsonConvert.DeserializeObject<'T>(x, Fable.JsonConverter())
+open Newtonsoft.Json
+let toJson x = JsonConvert.SerializeObject(x, Fable.JsonConverter())
+let ofJson<'T> x = JsonConvert.DeserializeObject<'T>(x, Fable.JsonConverter())
#endif
type Child =
@@ -37,13 +35,13 @@ type C<'T> = {c: B<'T>}
[]
let ``Nested generics``() =
let x = { c={ b={ a=R() } } }
- let json = S.toJson x
- let x2 = S.ofJson> json
+ let json = toJson x
+ let x2 = ofJson> json
x2.c.b.a.Foo() |> equal "foo"
[]
let ``Records``() =
- let json =
+ let json =
"""
{
"Name": "foo",
@@ -53,70 +51,70 @@ let ``Records``() =
}
}
"""
- let result: Simple = S.ofJson json
+ let result: Simple = ofJson json
result.Name |> equal "foo"
// Use the built in compare to ensure the fields are being hooked up.
// Should compile to something like: result.Child.Equals(new Child("Hi", 10))
- result.Child = {a="Hi"; b=10} |> equal true
+ result.Child = {a="Hi"; b=10} |> equal true
-[]
+[]
let ``Date``() =
let d = System.DateTime(2016, 1, 1, 0, 0, 0, System.DateTimeKind.Utc)
- let json = d |> S.toJson
- let result : System.DateTime = S.ofJson json
+ let json = d |> toJson
+ let result : System.DateTime = ofJson json
result.Year |> equal 2016
-type JsonDate = {
+type JsonDate = {
Date : System.DateTime
}
-
-[]
+
+[]
let ``Child Date``() =
let d = System.DateTime(2016, 1, 1, 0, 0, 0, System.DateTimeKind.Utc)
- let json = { Date = d } |> S.toJson
- let result : JsonDate = S.ofJson json
+ let json = { Date = d } |> toJson
+ let result : JsonDate = ofJson json
result.Date.Year |> equal 2016
type JsonArray = {
Name : string
}
-[]
+[]
let ``Arrays``() =
let json = """[{ "Name": "a" }, { "Name": "b" }]"""
- let result : JsonArray[] = S.ofJson json
+ let result : JsonArray[] = ofJson json
result |> Array.length |> equal 2
- result.[1] = { Name="b" } |> equal true
+ result.[1] = { Name="b" } |> equal true
type ChildArray = {
Children : JsonArray[]
}
-[]
+[]
let ``Child Array``() =
let json = """{ "Children": [{ "Name": "a" }, { "Name": "b" }] }"""
- let result : ChildArray = S.ofJson json
+ let result : ChildArray = ofJson json
result.Children |> Array.length |> equal 2
result.Children.[1] = { Name="b" } |> equal true
-[]
+[]
let ``String Generic List``() =
let json = """["a","b"]"""
- let result : System.Collections.Generic.List = S.ofJson json
+ let result : System.Collections.Generic.List = ofJson json
result.Count |> equal 2
result.[1] |> equal "b"
-[]
+[]
let ``Child Generic List``() =
let json = """[{ "Name": "a" }, { "Name": "b" }]"""
- let result : System.Collections.Generic.List = S.ofJson json
+ let result : System.Collections.Generic.List = ofJson json
result.Count |> equal 2
- result.[1] = { Name="b" } |> equal true
+ result.[1] = { Name="b" } |> equal true
-[]
+[]
let ``Lists``() =
let json = """["a","b"]"""
- let result : string list = S.ofJson json
+ let result : string list = ofJson json
result |> List.length |> equal 2
result.Tail |> List.length |> equal 1
result.[1] |> equal "b"
@@ -127,16 +125,16 @@ type ChildList = {
Children : JsonArray list
}
-[