Bläddra i källkod

Revert "Modern build (#260)"

This reverts commit a7c48081ae079c272f00b66db3b7388b5b12ccce.
Xanathar 6 år sedan
förälder
incheckning
492b0f9423
100 ändrade filer med 12247 tillägg och 727 borttagningar
  1. 0 6
      .dockerignore
  2. 12 9
      .travis.yml
  3. 0 28
      Dockerfile
  4. 0 22
      ci.sh
  5. 244 125
      src/DevTools/MoonSharp.VmDebugger/MoonSharp.VmDebugger.csproj
  6. 36 0
      src/DevTools/MoonSharp.VmDebugger/Properties/AssemblyInfo.cs
  7. 144 54
      src/DevTools/PerformanceComparison/PerformanceComparison.csproj
  8. 31 33
      src/DevTools/PerformanceComparison/Program.cs
  9. 36 0
      src/DevTools/PerformanceComparison/Properties/AssemblyInfo.cs
  10. BIN
      src/DevTools/PerformanceComparison/keypair.snk
  11. 83 72
      src/DevTools/Playground/Playground.csproj
  12. 36 0
      src/DevTools/Playground/Properties/AssemblyInfo.cs
  13. BIN
      src/DevTools/Playground/keypair.snk
  14. 166 0
      src/DevTools/SynchProjects/Program.cs
  15. 36 0
      src/DevTools/SynchProjects/Properties/AssemblyInfo.cs
  16. 73 0
      src/DevTools/SynchProjects/SynchProjects.csproj
  17. 36 0
      src/DevTools/VsCodeDebugger_Testbed/Properties/AssemblyInfo.cs
  18. 64 57
      src/DevTools/VsCodeDebugger_Testbed/VsCodeDebugger_Testbed.csproj
  19. BIN
      src/DevTools/VsCodeDebugger_Testbed/keypair.snk
  20. 3 3
      src/MoonSharp.Documentation/MoonSharp.Documentation.shfbproj
  21. 0 53
      src/MoonSharp.Hardwire/MoonSharp.Hardwire.csproj
  22. 82 0
      src/MoonSharp.Hardwire/MoonSharp.Hardwire.net35-client.csproj
  23. 36 0
      src/MoonSharp.Hardwire/Properties/AssemblyInfo.cs
  24. 99 80
      src/MoonSharp.Interpreter.Tests/EndToEnd/SimpleTests.cs
  25. 3 1
      src/MoonSharp.Interpreter.Tests/EndToEnd/UserDataOverloadsTests.cs
  26. 0 178
      src/MoonSharp.Interpreter.Tests/MoonSharp.Interpreter.Tests.csproj
  27. 119 0
      src/MoonSharp.Interpreter.Tests/MoonSharp.Interpreter.Tests.csproj.bak
  28. 328 0
      src/MoonSharp.Interpreter.Tests/MoonSharp.Interpreter.Tests.net35-client.csproj
  29. 36 0
      src/MoonSharp.Interpreter.Tests/Properties/AssemblyInfo.cs
  30. 8 0
      src/MoonSharp.Interpreter.Tests/TapRunner.cs
  31. 1 2
      src/MoonSharp.Interpreter.Tests/TestRunner.cs
  32. 4 4
      src/MoonSharp.Interpreter.Tests/_Hardwired.cs
  33. 257 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/MoonSharp.Interpreter.Tests.Embeddable.portable40.csproj
  34. 30 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/Properties/AssemblyInfo.cs
  35. 54 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/000-sanity.t
  36. 87 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/001-if.t
  37. 67 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/002-table.t
  38. 80 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/011-while.t
  39. 78 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/012-repeat.t
  40. 136 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/014-fornum.t
  41. 99 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/015-forlist.t
  42. 120 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/101-boolean.t
  43. 199 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/102-function.t
  44. 120 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/103-nil.t
  45. 190 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/104-number.t
  46. 183 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/105-string.t
  47. 125 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/106-table.t
  48. 128 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/107-thread.t
  49. 125 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/108-userdata.t
  50. 104 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/200-examples.t
  51. 125 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/201-assign.t
  52. 111 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/202-expr.t
  53. 122 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/203-lexico.t
  54. 106 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/204-grammar.t
  55. 83 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/211-scope.t
  56. 268 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/212-function.t
  57. 98 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/213-closure.t
  58. 193 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/214-coroutine.t
  59. 112 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/221-table.t
  60. 85 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/222-constructor.t
  61. 196 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/223-iterator.t
  62. 533 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/231-metatable.t
  63. 307 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/232-object.t
  64. 391 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/301-basic.t
  65. 318 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/304-string.t
  66. 253 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/305-table.t
  67. 153 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/306-math.t
  68. 94 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/307-bit.t
  69. 258 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/308-io.t
  70. 198 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/309-os.t
  71. 183 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/310-debug.t
  72. 346 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/314-regex.t
  73. 124 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/320-stdin.t
  74. 67 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/Makefile
  75. 392 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/Modules/Test/Builder.lua
  76. 383 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/Modules/Test/More.lua
  77. 68 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/makefile.mak
  78. 11 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/_NUnitWrapper.cs
  79. 376 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/MoonSharp.Interpreter.Tests.net40-client.csproj
  80. 36 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/Properties/AssemblyInfo.cs
  81. 54 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/000-sanity.t
  82. 87 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/001-if.t
  83. 67 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/002-table.t
  84. 80 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/011-while.t
  85. 78 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/012-repeat.t
  86. 136 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/014-fornum.t
  87. 99 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/015-forlist.t
  88. 120 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/101-boolean.t
  89. 199 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/102-function.t
  90. 120 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/103-nil.t
  91. 190 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/104-number.t
  92. 183 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/105-string.t
  93. 125 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/106-table.t
  94. 128 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/107-thread.t
  95. 125 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/108-userdata.t
  96. 104 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/200-examples.t
  97. 125 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/201-assign.t
  98. 111 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/202-expr.t
  99. 122 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/203-lexico.t
  100. 106 0
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/204-grammar.t

+ 0 - 6
.dockerignore

@@ -1,6 +0,0 @@
-.git/
-**/bin/
-**/obj/
-**/packages/
-src/Unity/
-

+ 12 - 9
.travis.yml

@@ -1,13 +1,16 @@
-language: minimal
+language: csharp
+solution: src/moonsharp.sln
+sudo: required
 
-language: minimal
-
-services:
-  - docker
-
-before_install:
-  - docker build -t moonsharp-ci .
+mono: 
+  - 2.10.8
 
 script:
-  - docker run moonsharp-ci
+  - xbuild /p:TargetFrameworkProfile='' /p:Configuration=Release src/moonsharp_ci_net35.sln
+  - cd src/TestRunners/ConsoleTestRunner/bin/Release
+  - mono ConsoleTestRunner.exe
+#  - chmod 777 aotregen.sh
+#  - chmod 777 aottest.sh
+#  - sudo ./aotregen.sh
+#  - sudo ./aottest.sh
 

+ 0 - 28
Dockerfile

@@ -1,28 +0,0 @@
-FROM mono:5.18.1.28
-
-# .NET Core
-
-RUN apt-get update \
-  && apt-get install -y apt-transport-https gnupg wget \
-  && wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \
-  && mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \
-  && wget -q https://packages.microsoft.com/config/debian/9/prod.list \
-  && mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \
-  && apt-get update \
-  && apt-get install -y dotnet-sdk-2.2
-
-# MoonSharp
-
-WORKDIR /build
-
-COPY ci.sh ci.sh
-COPY src/MoonSharp.Interpreter src/MoonSharp.Interpreter/
-COPY src/MoonSharp.Interpreter.Tests src/MoonSharp.Interpreter.Tests/
-COPY src/MoonSharp.RemoteDebugger src/MoonSharp.RemoteDebugger/
-COPY src/MoonSharp.VsCodeDebugger src/MoonSharp.VsCodeDebugger/
-COPY src/TestRunners/ConsoleTestRunner src/TestRunners/ConsoleTestRunner/
-COPY src/TestRunners/DotNetCoreTestRunner src/TestRunners/DotNetCoreTestRunner/
-COPY src/moonsharp_ci.sln src/moonsharp_ci.sln
-
-ENTRYPOINT ["sh", "/build/ci.sh"]
-

+ 0 - 22
ci.sh

@@ -1,22 +0,0 @@
-#!/usr/bin/env sh
-
-set -e
-
-# Build
-msbuild /t:Restore src/moonsharp_ci.sln
-msbuild /p:Configuration=Release src/moonsharp_ci.sln
-
-# Mono Tests
-cd src/TestRunners/ConsoleTestRunner/bin/Release/net35
-mono ConsoleTestRunner.exe
-
-# Mono ahead of time compilation tests
-#  - chmod 777 aotregen.sh
-#  - chmod 777 aottest.sh
-#  - sudo ./aotregen.sh
-#  - sudo ./aottest.sh
-
-# .NET Core Tests
-cd ../../../../DotNetCoreTestRunner/bin/Release/netcoreapp2.0
-dotnet DotNetCoreTestRunner.dll /unit
-

+ 244 - 125
src/DevTools/MoonSharp.VmDebugger/MoonSharp.VmDebugger.csproj

@@ -1,125 +1,244 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-    <PropertyGroup>
-        <TargetFramework>net35</TargetFramework>
-        <AssemblyOriginatorKeyFile>keypair.snk</AssemblyOriginatorKeyFile>
-        <Authors>MoonSharp</Authors>
-        <Description></Description>
-        <Copyright>Copyright © 2014-2015, Marco Mastropaolo</Copyright>
-        <PackageProjectUrl>https://www.moonsharp.org</PackageProjectUrl>
-        <PackageLicenseUrl>https://raw.githubusercontent.com/xanathar/moonsharp/master/LICENSE</PackageLicenseUrl>
-        <RepositoryUrl>https://github.com/xanathar/moonsharp/</RepositoryUrl>
-        <PackageId>Playground</PackageId>
-        <Title>Playground</Title>
-        <SignAssembly>true</SignAssembly>
-        <PackageVersion>2.0.0</PackageVersion>
-        <OutputType>WinExe</OutputType>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-        <DebugSymbols>true</DebugSymbols>
-        <DebugType>full</DebugType>
-        <Optimize>false</Optimize>
-        <OutputPath>bin\Debug\</OutputPath>
-        <DefineConstants>TRACE;DEBUG</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn>3021, 1591</NoWarn>
-        <DocumentationFile />
-    </PropertyGroup>
-
-    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-        <DebugType>pdbonly</DebugType>
-        <Optimize>true</Optimize>
-        <OutputPath>bin\Release\</OutputPath>
-        <DefineConstants>TRACE</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn />
-        <UseVSHostingProcess>false</UseVSHostingProcess>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(DebugType)' == 'portable'">
-        <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
-    </PropertyGroup>
-
-    <ItemGroup>
-        <Reference Include="System.Windows.Forms" />
-    </ItemGroup>
-
-    <ItemGroup>
-        <None Include="packages.config" />
-        <None Include="Properties\Settings.settings">
-            <Generator>SettingsSingleFileGenerator</Generator>
-            <LastGenOutput>Settings.Designer.cs</LastGenOutput>
-        </None>
-        <None Include="Modules\Test\Builder.lua">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="Modules\Test\More.lua">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-    </ItemGroup>
-
-    <ItemGroup>
-        <None Include="Resources\Restart_6322.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\StepIn_6326.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\Stepout_6327.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\StepOver_6328.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\Breakall_6323.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\BreakpointEnabled_6584_16x.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\Open_6529.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\RPCThread_10388.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\DisassemblyWindow_6536.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\Help_6522.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\startwithoutdebugging_6556.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\AddConnection_477.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\AddMark_10580.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\Clearallrequests_8816.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\FindSymbol_6263.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\NavigateBackwards_6270.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\NavigateForward_6271.png" />
-    </ItemGroup>
-    <ItemGroup>
-        <None Include="Resources\GoToDeclaration_5576.png" />
-    </ItemGroup>
-
-    <ItemGroup>
-      <ProjectReference Include="..\..\MoonSharp.Interpreter.Tests\MoonSharp.Interpreter.Tests.csproj" />
-      <ProjectReference Include="..\..\MoonSharp.VsCodeDebugger\MoonSharp.VsCodeDebugger.csproj" />
-      <ProjectReference Include="..\..\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj" />
-    </ItemGroup>
-
-</Project>
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{F4F82CCE-2E13-441B-939C-63CF2343B1C9}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MoonSharp.Debugger</RootNamespace>
+    <AssemblyName>MoonSharp.VmDebugger</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Dev\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Dev\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Devp4|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Devp4\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Devp4|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Devp4\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="nunit.framework">
+      <HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Deployment" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="DoubleBufferedListView.cs">
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="Ext_Methods.cs" />
+    <Compile Include="MainForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="MainForm.Designer.cs">
+      <DependentUpon>MainForm.cs</DependentUpon>
+    </Compile>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SourceCodeDebugControl.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="SourceCodeDebugControl.Designer.cs">
+      <DependentUpon>SourceCodeDebugControl.cs</DependentUpon>
+    </Compile>
+    <Compile Include="ValueBrowser.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="ValueBrowser.Designer.cs">
+      <DependentUpon>ValueBrowser.cs</DependentUpon>
+    </Compile>
+    <Compile Include="WatchInputDialog.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="WatchInputDialog.Designer.cs">
+      <DependentUpon>WatchInputDialog.cs</DependentUpon>
+    </Compile>
+    <EmbeddedResource Include="MainForm.resx">
+      <DependentUpon>MainForm.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Resources.resx</DependentUpon>
+      <DesignTime>True</DesignTime>
+    </Compile>
+    <EmbeddedResource Include="SourceCodeDebugControl.resx">
+      <DependentUpon>SourceCodeDebugControl.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="ValueBrowser.resx">
+      <DependentUpon>ValueBrowser.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="WatchInputDialog.resx">
+      <DependentUpon>WatchInputDialog.cs</DependentUpon>
+    </EmbeddedResource>
+    <None Include="packages.config" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <None Include="Modules\Test\Builder.lua">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="Modules\Test\More.lua">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\MoonSharp.Interpreter.Tests\MoonSharp.Interpreter.Tests.net35-client.csproj">
+      <Project>{4ad350e6-e296-43ef-9fea-cb70358467e4}</Project>
+      <Name>MoonSharp.Interpreter.Tests.net35-client</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\MoonSharp.Interpreter\MoonSharp.Interpreter.net35-client.csproj">
+      <Project>{91ea9b9d-fe03-4273-bdaf-8ad42ede1e59}</Project>
+      <Name>MoonSharp.Interpreter.net35-client</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\Restart_6322.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\StepIn_6326.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\Stepout_6327.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\StepOver_6328.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\Breakall_6323.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\BreakpointEnabled_6584_16x.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\Open_6529.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\RPCThread_10388.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\DisassemblyWindow_6536.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\Help_6522.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\startwithoutdebugging_6556.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\AddConnection_477.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\AddMark_10580.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\Clearallrequests_8816.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\FindSymbol_6263.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\NavigateBackwards_6270.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\NavigateForward_6271.png" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\GoToDeclaration_5576.png" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 36 - 0
src/DevTools/MoonSharp.VmDebugger/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MoonSharp.Debugger")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MoonSharp.Debugger")]
+[assembly: AssemblyCopyright("Copyright ©  2014-2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("43c6203a-fd70-44f6-bdd9-30588e7c9733")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.2.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 144 - 54
src/DevTools/PerformanceComparison/PerformanceComparison.csproj

@@ -1,54 +1,144 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-    <PropertyGroup>
-        <TargetFramework>netcoreapp2.0</TargetFramework>
-        <AssemblyOriginatorKeyFile>keypair.snk</AssemblyOriginatorKeyFile>
-        <Authors>MoonSharp</Authors>
-        <Description></Description>
-        <Copyright>Copyright © 2014-2015, Marco Mastropaolo</Copyright>
-        <PackageProjectUrl>https://www.moonsharp.org</PackageProjectUrl>
-        <PackageLicenseUrl>https://raw.githubusercontent.com/xanathar/moonsharp/master/LICENSE</PackageLicenseUrl>
-        <RepositoryUrl>https://github.com/xanathar/moonsharp/</RepositoryUrl>
-        <PackageId>PerformanceComparison</PackageId>
-        <Title>PerformanceComparison</Title>
-        <SignAssembly>true</SignAssembly>
-        <PackageVersion>2.0.0</PackageVersion>
-        <OutputType>WinExe</OutputType>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-        <DebugSymbols>true</DebugSymbols>
-        <DebugType>full</DebugType>
-        <Optimize>false</Optimize>
-        <OutputPath>bin\Debug\</OutputPath>
-        <DefineConstants>TRACE;DEBUG</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn>3021, 1591</NoWarn>
-        <DocumentationFile />
-    </PropertyGroup>
-
-    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-        <DebugType>pdbonly</DebugType>
-        <Optimize>true</Optimize>
-        <OutputPath>bin\Release\</OutputPath>
-        <DefineConstants>TRACE</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn />
-        <UseVSHostingProcess>false</UseVSHostingProcess>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(DebugType)' == 'portable'">
-        <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
-    </PropertyGroup>
-
-    <ItemGroup>
-        <ProjectReference Include="..\..\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj" />
-    </ItemGroup>
-
-    <ItemGroup>
-      <PackageReference Include="NLua" Version="1.4.20" />
-    </ItemGroup>
-
-</Project>
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{01C3C379-C816-4779-942D-0263763F8EA5}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>PerformanceComparison</RootNamespace>
+    <AssemblyName>PerformanceComparison</AssemblyName>
+    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SccProjectName>
+    </SccProjectName>
+    <SccLocalPath>
+    </SccLocalPath>
+    <SccAuxPath>
+    </SccAuxPath>
+    <SccProvider>
+    </SccProvider>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>0</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Dev\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <WarningLevel>0</WarningLevel>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Dev\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Devp4|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Devp4\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <WarningLevel>0</WarningLevel>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Devp4|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Devp4\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="NLua">
+      <HintPath>..\..\..\..\..\prg\NLua\NLua.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="CallbacksAndForthTests.cs" />
+    <Compile Include="CoroutineTest.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="HugeFile.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Sample.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\MoonSharp.Interpreter\MoonSharp.Interpreter.net35-client.csproj">
+      <Project>{91ea9b9d-fe03-4273-bdaf-8ad42ede1e59}</Project>
+      <Name>MoonSharp.Interpreter.net35-client</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 31 - 33
src/DevTools/PerformanceComparison/Program.cs

@@ -34,59 +34,59 @@ namespace PerformanceComparison
 					move(n - 1, via, dst, src)
 				end
 			end
-
+ 
 			for i = 1, 10000 do
 				move(4, 1, 2, 3)
 			end
 			";
 		static  string scriptText22 = @"
 N = 8
-
+ 
 board = {}
 for i = 1, N do
-	board[i] = {}
-	for j = 1, N do
+    board[i] = {}
+    for j = 1, N do
 		board[i][j] = false
-	end
+    end
 end
-
+ 
 function Allowed( x, y )
-	for i = 1, x-1 do
-	if ( board[i][y] ) or ( i <= y and board[x-i][y-i] ) or ( y+i <= N and board[x-i][y+i] ) then
-		return false
-	end
+    for i = 1, x-1 do
+	if ( board[i][y] ) or ( i <= y and board[x-i][y-i] ) or ( y+i <= N and board[x-i][y+i] ) then 
+  	    return false 
 	end
-	return true
+    end		
+    return true
 end
-
+ 
 function Find_Solution( x )
-	for y = 1, N do
-	if Allowed( x, y ) then
-		board[x][y] = true
-		if x == N or Find_Solution( x+1 ) then
+    for y = 1, N do
+	if Allowed( x, y ) then 
+  	    board[x][y] = true 
+	    if x == N or Find_Solution( x+1 ) then
 		return true
-		end
-		board[x][y] = false
-	end
-	end
-	return false
+	    end
+	    board[x][y] = false			 
+	end		
+    end
+    return false
 end
-
+ 
 if Find_Solution( 1 ) then
-	for i = 1, N do
+    for i = 1, N do
  	for j = 1, N do
-		if board[i][j] then
+  	    if board[i][j] then 
 		--print( 'Q' )
-		else
+	    else 
 		--print( 'x' )
-		end
+	    end
 	end
 	--print( '|' )
-	end
+    end
 else
-	--print( 'NO!' )
+    --print( 'NO!' )
 end
-
+  
 			";
 		static StringBuilder g_MoonSharpStr = new StringBuilder();
 		static StringBuilder g_NLuaStr = new StringBuilder();
@@ -166,13 +166,11 @@ end
 
 			lua.RegisterFunction("check", typeof(Program).GetMethod("NCheck"));
 
-			var hanoiPath = Path.GetTempPath() + Path.DirectorySeparatorChar + "hanoi.lua";
-
-			File.WriteAllText(hanoiPath, scriptText);
+			File.WriteAllText(@"c:\temp\hanoi.lua", scriptText);
 
 #if !PROFILER
 
-			var fn = lua.LoadFile(hanoiPath);
+			var fn = lua.LoadFile(@"c:\temp\hanoi.lua");
 
 			sw = Stopwatch.StartNew();
 			for (int i = 0; i < ITERATIONS; i++)

+ 36 - 0
src/DevTools/PerformanceComparison/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("PerformanceComparison")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PerformanceComparison")]
+[assembly: AssemblyCopyright("Copyright ©  2014-2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("40bffac0-24eb-4141-815d-f75076bce829")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

BIN
src/DevTools/PerformanceComparison/keypair.snk


+ 83 - 72
src/DevTools/Playground/Playground.csproj

@@ -1,72 +1,83 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-    <PropertyGroup>
-        <TargetFramework>net35</TargetFramework>
-        <AssemblyOriginatorKeyFile>keypair.snk</AssemblyOriginatorKeyFile>
-        <Authors>MoonSharp</Authors>
-        <Description></Description>
-        <Copyright>Copyright © 2014-2015, Marco Mastropaolo</Copyright>
-        <PackageProjectUrl>https://www.moonsharp.org</PackageProjectUrl>
-        <PackageLicenseUrl>https://raw.githubusercontent.com/xanathar/moonsharp/master/LICENSE</PackageLicenseUrl>
-        <RepositoryUrl>https://github.com/xanathar/moonsharp/</RepositoryUrl>
-        <PackageId>MoonSharp.VmDebugger</PackageId>
-        <Title>MoonSharp.VmDebugger</Title>
-        <SignAssembly>true</SignAssembly>
-        <PackageVersion>2.0.0</PackageVersion>
-        <OutputType>WinExe</OutputType>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-        <DebugSymbols>true</DebugSymbols>
-        <DebugType>full</DebugType>
-        <Optimize>false</Optimize>
-        <OutputPath>bin\Debug\</OutputPath>
-        <DefineConstants>TRACE;DEBUG</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn>3021, 1591</NoWarn>
-        <DocumentationFile />
-    </PropertyGroup>
-
-    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-        <DebugType>pdbonly</DebugType>
-        <Optimize>true</Optimize>
-        <OutputPath>bin\Release\</OutputPath>
-        <DefineConstants>TRACE</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn />
-        <RunCodeAnalysis>false</RunCodeAnalysis>
-        <CodeAnalysisRuleSet>ExtendedDesignGuidelineRules.ruleset</CodeAnalysisRuleSet>
-        <DocumentationFile>bin\Release\MoonSharp.Interpreter.xml</DocumentationFile>
-        <UseVSHostingProcess>false</UseVSHostingProcess>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(DebugType)' == 'portable'">
-        <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
-    </PropertyGroup>
-
-    <ItemGroup>
-        <None Include="App.config" />
-        <None Include="test.lua">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="test2.lua">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="core.lua">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-    </ItemGroup>
-
-    <ItemGroup>
-      <ProjectReference Include="..\..\MoonSharp.Hardwire\MoonSharp.Hardwire.csproj" />
-        <ProjectReference Include="..\..\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj" />
-      <ProjectReference Include="..\..\MoonSharp.RemoteDebugger\MoonSharp.RemoteDebugger.csproj" />
-    </ItemGroup>
-
-    <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
-      <PackageReference Include="System.CodeDom" Version="4.5.0" />
-    </ItemGroup>
-
-</Project>
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{F039D7BE-0761-4618-BFA4-924E96584219}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Playground</RootNamespace>
+    <AssemblyName>Playground</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Test.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <None Include="test.lua">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="test2.lua">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="core.lua">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\MoonSharp.Hardwire\MoonSharp.Hardwire.net35-client.csproj">
+      <Project>{b25a2316-6897-4caa-be0e-e784071d8199}</Project>
+      <Name>MoonSharp.Hardwire.net35-client</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\MoonSharp.Interpreter\MoonSharp.Interpreter.net35-client.csproj">
+      <Project>{91ea9b9d-fe03-4273-bdaf-8ad42ede1e59}</Project>
+      <Name>MoonSharp.Interpreter.net35-client</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\MoonSharp.RemoteDebugger\MoonSharp.RemoteDebugger.net35-client.csproj">
+      <Project>{43d3ad52-fed5-4305-b0f4-6b991220cd0a}</Project>
+      <Name>MoonSharp.RemoteDebugger.net35-client</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 36 - 0
src/DevTools/Playground/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Playground")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Playground")]
+[assembly: AssemblyCopyright("Copyright ©  2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3ca41a0f-4348-475f-87cb-484b3c68c79a")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

BIN
src/DevTools/Playground/keypair.snk


+ 166 - 0
src/DevTools/SynchProjects/Program.cs

@@ -0,0 +1,166 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Xml;
+
+namespace SynchProjects
+{
+	class Program
+	{
+		static string BASEPATH;
+
+		static void CopyCompileFilesAsLinks(string platformName, string srcCsProj, string platformDest, string pathPrefix)
+		{
+			platformName = AdjustBasePath(platformName);
+			srcCsProj = AdjustBasePath(srcCsProj);
+			platformDest = AdjustBasePath(platformDest);
+			pathPrefix = AdjustBasePath(pathPrefix);
+
+			string dstCsProj = string.Format(platformDest, platformName);
+			try
+			{
+				int warningCount = 0;
+				const string XMLNS = "http://schemas.microsoft.com/developer/msbuild/2003";
+				HashSet<string> linksDone = new HashSet<string>();
+
+				Console.ForegroundColor = ConsoleColor.Gray;
+				Console.WriteLine("Synch vsproj compiles {0} ...", Path.GetFileNameWithoutExtension(dstCsProj));
+
+				XmlDocument xsrc = new XmlDocument();
+				XmlDocument xdst = new XmlDocument();
+
+				xsrc.Load(srcCsProj);
+				xdst.Load(dstCsProj);
+
+				XmlNamespaceManager sxns = new XmlNamespaceManager(xsrc.NameTable);
+				XmlNamespaceManager dxns = new XmlNamespaceManager(xdst.NameTable);
+
+				sxns.AddNamespace("ms", XMLNS);
+				dxns.AddNamespace("ms", XMLNS);
+
+				XmlElement srccont = xsrc.SelectSingleNode("/ms:Project/ms:ItemGroup[count(ms:Compile) != 0]", sxns) as XmlElement;
+				XmlElement dstcont = xdst.SelectSingleNode("/ms:Project/ms:ItemGroup[count(ms:Compile) != 0]", dxns) as XmlElement;
+
+				// dirty hack
+				dstcont.InnerXml = srccont.InnerXml;
+
+				List<XmlElement> toRemove = new List<XmlElement>();
+
+				foreach (XmlElement xe in dstcont.ChildNodes.OfType<XmlElement>())
+				{
+					string file = xe.GetAttribute("Include");
+					string link = Path.GetFileName(file);
+
+					if (link.Contains(".g4"))
+					{
+						toRemove.Add(xe);
+						continue;
+					}
+
+					if (!linksDone.Add(link))
+					{
+						++warningCount;
+						Console.ForegroundColor = ConsoleColor.Yellow;
+						Console.WriteLine("\t[WARNING] - Duplicate file: {0}", link);
+					}
+
+					file = pathPrefix + file;
+
+					xe.SetAttribute("Include", file);
+
+					XmlElement xlink = xe.OwnerDocument.CreateElement("Link", XMLNS);
+					xlink.InnerText = link;
+					xe.AppendChild(xlink);
+				}
+
+				foreach (XmlElement xe in toRemove)
+					xe.ParentNode.RemoveChild(xe);
+
+				xdst.Save(dstCsProj);
+				Console.ForegroundColor = ConsoleColor.Green;
+				Console.WriteLine("\t[DONE] ({0} warnings)", warningCount);
+			}
+			catch (Exception ex)
+			{
+				Console.ForegroundColor = ConsoleColor.Red;
+				Console.WriteLine("\t[ERROR] - {0}", ex.Message);
+			}
+
+			Console.WriteLine("\n");
+		}
+
+		private static string AdjustBasePath(string str)
+		{
+			return str.Replace("{BASEPATH}", BASEPATH);
+		}
+
+		static void Main(string[] args)
+		{
+			Console.ForegroundColor = ConsoleColor.Magenta;
+			Console.WriteLine("********************************************************");
+			Console.WriteLine("* !! REMEMBER TO RSYNC UNITY AND .NET CORE PROJECTS !! *");
+			Console.WriteLine("********************************************************");
+
+
+			const string INTERPRETER_PROJECT = @"{BASEPATH}\MoonSharp.Interpreter\MoonSharp.Interpreter.net35-client.csproj";
+			const string INTERPRETER_SUBPROJECTS_PATHS = @"{BASEPATH}\MoonSharp.Interpreter\_Projects\MoonSharp.Interpreter.{0}\MoonSharp.Interpreter.{0}.csproj";
+			const string INTERPRETER_PATH_PREFIX = @"..\..\";
+
+			const string DEBUGGER_PROJECT = @"{BASEPATH}\MoonSharp.RemoteDebugger\MoonSharp.RemoteDebugger.net35-client.csproj";
+			const string DEBUGGER_SUBPROJECTS_PATHS = @"{BASEPATH}\MoonSharp.RemoteDebugger\_Projects\MoonSharp.RemoteDebugger.{0}\MoonSharp.RemoteDebugger.{0}.csproj";
+			const string DEBUGGER_PATH_PREFIX = @"..\..\";
+
+			const string VSCODEDEBUGGER_PROJECT = @"{BASEPATH}\MoonSharp.VsCodeDebugger\MoonSharp.VsCodeDebugger.net35-client.csproj";
+			const string VSCODEDEBUGGER_SUBPROJECTS_PATHS = @"{BASEPATH}\MoonSharp.VsCodeDebugger\_Projects\MoonSharp.VsCodeDebugger.{0}\MoonSharp.VsCodeDebugger.{0}.csproj";
+			const string VSCODEDEBUGGER_PATH_PREFIX = @"..\..\";
+
+			const string TESTS_PROJECT = @"{BASEPATH}\MoonSharp.Interpreter.Tests\MoonSharp.Interpreter.Tests.net35-client.csproj";
+			const string TESTS_SUBPROJECTS_PATHS = @"{BASEPATH}\MoonSharp.Interpreter.Tests\_Projects\MoonSharp.Interpreter.Tests.{0}\MoonSharp.Interpreter.Tests.{0}.csproj";
+			const string TESTS_PATH_PREFIX = @"..\..\";
+
+			string[] INTERPRETER_PLATFORMS = new string[] { "net40-client", "portable40" };
+			string[] DEBUGGER_PLATFORMS = new string[] { "net40-client" };
+			string[] VSCODEDEBUGGER_PLATFORMS = new string[] { "net40-client" };
+			string[] TESTS_PLATFORMS = new string[] { "net40-client", "portable40", "Embeddable.portable40" };
+
+			CalcBasePath();
+
+			foreach (string platform in INTERPRETER_PLATFORMS)
+				CopyCompileFilesAsLinks(platform, INTERPRETER_PROJECT, INTERPRETER_SUBPROJECTS_PATHS, INTERPRETER_PATH_PREFIX);
+
+			foreach (string platform in DEBUGGER_PLATFORMS)
+				CopyCompileFilesAsLinks(platform, DEBUGGER_PROJECT, DEBUGGER_SUBPROJECTS_PATHS, DEBUGGER_PATH_PREFIX);
+
+			foreach (string platform in VSCODEDEBUGGER_PLATFORMS)
+				CopyCompileFilesAsLinks(platform, VSCODEDEBUGGER_PROJECT, VSCODEDEBUGGER_SUBPROJECTS_PATHS, VSCODEDEBUGGER_PATH_PREFIX);
+
+			foreach (string platform in TESTS_PLATFORMS)
+				CopyCompileFilesAsLinks(platform, TESTS_PROJECT, TESTS_SUBPROJECTS_PATHS, TESTS_PATH_PREFIX);
+
+
+			Console.ReadLine();
+		}
+
+		private static void CalcBasePath()
+		{
+			string path = "";
+			string[] dir = AppDomain.CurrentDomain.BaseDirectory.Split('\\');
+
+			for (int i = 0; i < dir.Length; i++)
+			{
+				if (dir[i].ToLower() == "devtools")
+					break;
+
+				if (path.Length > 0)
+					path = path + "\\" + dir[i];
+				else
+					path = dir[i];
+			}
+
+			BASEPATH = path;
+		}
+	}
+}

+ 36 - 0
src/DevTools/SynchProjects/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SynchProjects")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SynchProjects")]
+[assembly: AssemblyCopyright("Copyright ©  2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("a4934800-dd77-4047-b402-4eec63bbcf2f")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 73 - 0
src/DevTools/SynchProjects/SynchProjects.csproj

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{321C9CCF-6F9B-4751-AB34-882DEE982A7E}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>SynchProjects</RootNamespace>
+    <AssemblyName>SynchProjects</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Dev\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Devp4|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Devp4\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 36 - 0
src/DevTools/VsCodeDebugger_Testbed/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("VsCodeDebugger_Testbed")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("VsCodeDebugger_Testbed")]
+[assembly: AssemblyCopyright("Copyright ©  2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("d17dd647-76cf-4d87-bdf7-75e1704e8783")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 64 - 57
src/DevTools/VsCodeDebugger_Testbed/VsCodeDebugger_Testbed.csproj

@@ -1,57 +1,64 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-    <PropertyGroup>
-        <TargetFrameworks>netstandard2.0;net35;net40</TargetFrameworks>
-        <AssemblyOriginatorKeyFile>keypair.snk</AssemblyOriginatorKeyFile>
-        <Authors>MoonSharp</Authors>
-        <Description></Description>
-        <Copyright>Copyright © 2014-2015, Marco Mastropaolo</Copyright>
-        <PackageProjectUrl>https://www.moonsharp.org</PackageProjectUrl>
-        <PackageLicenseUrl>https://raw.githubusercontent.com/xanathar/moonsharp/master/LICENSE</PackageLicenseUrl>
-        <RepositoryUrl>https://github.com/xanathar/moonsharp/</RepositoryUrl>
-        <PackageId>VsCodeDebugger_Testbed</PackageId>
-        <Title>VsCodeDebugger_Testbed</Title>
-        <SignAssembly>true</SignAssembly>
-        <PackageVersion>2.0.0</PackageVersion>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-        <DebugSymbols>true</DebugSymbols>
-        <DebugType>full</DebugType>
-        <Optimize>false</Optimize>
-        <OutputPath>bin\Debug\</OutputPath>
-        <DefineConstants>TRACE;DEBUG</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn>3021, 1591</NoWarn>
-        <DocumentationFile />
-    </PropertyGroup>
-
-    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-        <DebugType>pdbonly</DebugType>
-        <Optimize>true</Optimize>
-        <OutputPath>bin\Release\</OutputPath>
-        <DefineConstants>TRACE</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn />
-        <RunCodeAnalysis>false</RunCodeAnalysis>
-        <CodeAnalysisRuleSet>ExtendedDesignGuidelineRules.ruleset</CodeAnalysisRuleSet>
-        <DocumentationFile>bin\Release\MoonSharp.Interpreter.xml</DocumentationFile>
-        <UseVSHostingProcess>false</UseVSHostingProcess>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(DebugType)' == 'portable'">
-        <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
-    </PropertyGroup>
-
-    <ItemGroup>
-      <ProjectReference Include="..\..\MoonSharp.VsCodeDebugger\MoonSharp.VsCodeDebugger.csproj" />
-      <ProjectReference Include="..\..\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj" />
-    </ItemGroup>
-
-    <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
-      <PackageReference Include="System.CodeDom" Version="4.5.0" />
-    </ItemGroup>
-
-</Project>
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{D17DD647-76CF-4D87-BDF7-75E1704E8783}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>VsCodeDebugger_Testbed</RootNamespace>
+    <AssemblyName>VsCodeDebugger_Testbed</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\MoonSharp.Interpreter\MoonSharp.Interpreter.net35-client.csproj">
+      <Project>{91ea9b9d-fe03-4273-bdaf-8ad42ede1e59}</Project>
+      <Name>MoonSharp.Interpreter.net35-client</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\MoonSharp.VsCodeDebugger\MoonSharp.VsCodeDebugger.net35-client.csproj">
+      <Project>{eb7d4595-299f-489b-90ac-55066a4675f9}</Project>
+      <Name>MoonSharp.VsCodeDebugger.net35-client</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

BIN
src/DevTools/VsCodeDebugger_Testbed/keypair.snk


+ 3 - 3
src/MoonSharp.Documentation/MoonSharp.Documentation.shfbproj

@@ -34,8 +34,8 @@
     <CppCommentsFixup>False</CppCommentsFixup>
     <CleanIntermediates>True</CleanIntermediates>
     <DocumentationSources>
-      <DocumentationSource sourceFile="..\MoonSharp.Interpreter\bin\Release\MoonSharp.Interpreter.dll" />
-      <DocumentationSource sourceFile="..\MoonSharp.Interpreter\bin\Release\MoonSharp.Interpreter.xml" />
+      <DocumentationSource sourceFile="..\MoonSharp.Interpreter\_Projects\MoonSharp.Interpreter.net40-client\bin\Release\MoonSharp.Interpreter.dll" />
+      <DocumentationSource sourceFile="..\MoonSharp.Interpreter\_Projects\MoonSharp.Interpreter.net40-client\bin\Release\MoonSharp.Interpreter.xml" />
     </DocumentationSources>
     <MaximumGroupParts>2</MaximumGroupParts>
     <NamespaceGrouping>False</NamespaceGrouping>
@@ -95,4 +95,4 @@
   </ItemGroup>
   <!-- Import the SHFB build targets -->
   <Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
-</Project>
+</Project>

+ 0 - 53
src/MoonSharp.Hardwire/MoonSharp.Hardwire.csproj

@@ -1,53 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-    <PropertyGroup>
-        <TargetFrameworks>netstandard2.0;net35;net40</TargetFrameworks>
-        <AssemblyOriginatorKeyFile>keypair.snk</AssemblyOriginatorKeyFile>
-        <Authors>MoonSharp</Authors>
-        <Description></Description>
-        <Copyright>Copyright © 2014-2015, Marco Mastropaolo</Copyright>
-        <PackageProjectUrl>https://www.moonsharp.org</PackageProjectUrl>
-        <PackageLicenseUrl>https://raw.githubusercontent.com/xanathar/moonsharp/master/LICENSE</PackageLicenseUrl>
-        <RepositoryUrl>https://github.com/xanathar/moonsharp/</RepositoryUrl>
-        <PackageId>MoonSharp.Hardwire</PackageId>
-        <Title>MoonSharp.Hardwire</Title>
-        <SignAssembly>true</SignAssembly>
-        <PackageVersion>2.0.0</PackageVersion>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-        <DebugSymbols>true</DebugSymbols>
-        <DebugType>full</DebugType>
-        <Optimize>false</Optimize>
-        <OutputPath>bin\Debug\</OutputPath>
-        <DefineConstants>TRACE;DEBUG</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn>3021, 1591</NoWarn>
-        <DocumentationFile />
-    </PropertyGroup>
-
-    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-        <DebugType>pdbonly</DebugType>
-        <Optimize>true</Optimize>
-        <OutputPath>bin\Release\</OutputPath>
-        <DefineConstants>TRACE</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn />
-        <UseVSHostingProcess>false</UseVSHostingProcess>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(DebugType)' == 'portable'">
-        <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
-    </PropertyGroup>
-
-    <ItemGroup>
-      <ProjectReference Include="..\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj" />
-    </ItemGroup>
-
-    <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
-      <PackageReference Include="System.CodeDom" Version="4.5.0" />
-    </ItemGroup>
-
-</Project>

+ 82 - 0
src/MoonSharp.Hardwire/MoonSharp.Hardwire.net35-client.csproj

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{B25A2316-6897-4CAA-BE0E-E784071D8199}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MoonSharp.Hardwire</RootNamespace>
+    <AssemblyName>MoonSharp.Hardwire</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup>
+    <AssemblyOriginatorKeyFile>keypair.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Generators\ArrayMemberDescriptorGenerator.cs" />
+    <Compile Include="Generators\DynValueMemberDescriptorGenerator.cs" />
+    <Compile Include="Generators\ValueTypeDefaultCtorMemberDescriptorGenerator.cs" />
+    <Compile Include="Languages\VbHardwireCodeGenerationLanguage.cs" />
+    <Compile Include="Languages\CSharpHardwireCodeGenerationLanguage.cs" />
+    <Compile Include="Languages\HardwireCodeGenerationLanguage.cs" />
+    <Compile Include="ICodeGenerationLogger.cs" />
+    <Compile Include="Generators\Base\AssignableMemberDescriptorGeneratorBase.cs" />
+    <Compile Include="Generators\FieldMemberDescriptorGenerator.cs" />
+    <Compile Include="Generators\MethodMemberDescriptorGenerator.cs" />
+    <Compile Include="Generators\OverloadedMethodMemberDescriptorGenerator.cs" />
+    <Compile Include="Generators\PropertyMemberDescriptorGenerator.cs" />
+    <Compile Include="Generators\StandardUserDataDescriptorGenerator.cs" />
+    <Compile Include="HardwireGenerator.cs" />
+    <Compile Include="HardwireCodeGenerationContext.cs" />
+    <Compile Include="HardwireGeneratorRegistry.cs" />
+    <Compile Include="IHardwireGenerator.cs" />
+    <Compile Include="Generators\NullGenerator.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Utils\GeneratorUtilities.cs" />
+    <Compile Include="Utils\HardwireParameterDescriptor.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\MoonSharp.Interpreter\MoonSharp.Interpreter.net35-client.csproj">
+      <Project>{91ea9b9d-fe03-4273-bdaf-8ad42ede1e59}</Project>
+      <Name>MoonSharp.Interpreter.net35-client</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="keypair.snk" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 36 - 0
src/MoonSharp.Hardwire/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MoonSharp.Hardwire")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MoonSharp.Hardwire")]
+[assembly: AssemblyCopyright("Copyright ©  2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("67210a72-3276-46db-b263-96e3197b1f78")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 99 - 80
src/MoonSharp.Interpreter.Tests/EndToEnd/SimpleTests.cs

@@ -34,10 +34,10 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 
 			Script S = new Script();
 
-			S.Globals.Set("print", DynValue.NewCallback(new CallbackFunction((x, a) =>
+			S.Globals.Set("print", DynValue.NewCallback(new CallbackFunction((x, a) => 
 			{
 				args = a.GetArray();
-				return DynValue.NewNumber(1234.0);
+				return DynValue.NewNumber(1234.0); 
 			})));
 
 			DynValue res = S.DoString(script);
@@ -147,7 +147,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		//!!! DO NOT REFORMAT THIS METHOD !!!
 		public void LongStrings()
 		{
-			string script = @"
+			string script = @"    
 				x = [[
 					ciao
 				]];
@@ -173,7 +173,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void UnicodeEscapeLua53Style()
 		{
-			string script = @"
+			string script = @"    
 				x = 'ciao\u{41}';
 				return x;";
 
@@ -187,7 +187,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[ExpectedException(typeof(SyntaxErrorException))]
 		public void InvalidEscape()
 		{
-			string script = @"
+			string script = @"    
 				x = 'ciao\k{41}';
 				return x;";
 
@@ -199,7 +199,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		{
 			string keywrd = "and break do else elseif end false end for function end goto if ::in:: in local nil not [or][[][==][[]] repeat return { then 0 end return; }; then true (x != 5 or == * 3 - 5) x";
 
-			string script = string.Format(@"
+			string script = string.Format(@"    
 				x = '{0}';
 				return x;", keywrd);
 
@@ -214,7 +214,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		public void ParserErrorMessage()
 		{
 			bool caught = false;
-			string script = @"
+			string script = @"    
 				return 'It's a wet floor warning saying wheat flour instead. \
 				Probably, the cook thought it was funny. \
 				He was wrong.'";
@@ -235,7 +235,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void StringsWithBackslashLineEndings2()
 		{
-			string script = @"
+			string script = @"    
 				return 'a\
 				b\
 				c'";
@@ -248,7 +248,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void StringsWithBackslashLineEndings()
 		{
-			string script = @"
+			string script = @"    
 				return 'It is a wet floor warning saying wheat flour instead. \
 				Probably, the cook thought it was funny. \
 				He was wrong.'";
@@ -261,8 +261,8 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void FunctionCallWrappers()
 		{
-			string script = @"
-				function boh(x)
+			string script = @"    
+				function boh(x) 
 					return 1912 + x;
 				end
 			";
@@ -315,7 +315,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void SimpleBoolShortCircuit()
 		{
-			string script = @"
+			string script = @"    
 				x = true or crash();
 				y = false and crash();
 			";
@@ -332,7 +332,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void FunctionOrOperator()
 		{
-			string script = @"
+			string script = @"    
 				loadstring = loadstring or load;
 
 				return loadstring;
@@ -349,7 +349,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void SelectNegativeIndex()
 		{
-			string script = @"
+			string script = @"    
 				return select(-1,'a','b','c');
 			";
 
@@ -367,14 +367,14 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void BoolConversionAndShortCircuit()
 		{
-			string script = @"
+			string script = @"    
 				i = 0;
 
 				function f()
 					i = i + 1;
 					return '!';
-				end
-
+				end					
+				
 				x = false;
 				y = true;
 
@@ -404,7 +404,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 					move(n - 1, via, dst, src)
 				end
 			end
-
+ 
 			move(4, 1, 2, 3)
 			";
 
@@ -414,7 +414,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void Factorial()
 		{
-			string script = @"
+			string script = @"    
 				-- defines a factorial function
 				function fact (n)
 					if (n == 0) then
@@ -423,7 +423,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 						return n*fact(n - 1)
 					end
 				end
-
+    
 				return fact(5)";
 
 			DynValue res = Script.RunString(script);
@@ -435,14 +435,14 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void IfStatmWithScopeCheck()
 		{
-			string script = @"
+			string script = @"    
 				x = 0
 
 				if (x == 0) then
 					local i = 3;
 					x = i * 2;
 				end
-
+    
 				return i, x";
 
 			DynValue res = Script.RunString(script);
@@ -457,13 +457,13 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void ScopeBlockCheck()
 		{
-			string script = @"
+			string script = @"    
 				local x = 6;
-
+				
 				do
 					local i = 33;
 				end
-
+		
 				return i, x";
 
 			DynValue res = Script.RunString(script);
@@ -478,14 +478,14 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void ForLoopWithBreak()
 		{
-			string script = @"
+			string script = @"    
 				x = 0
 
 				for i = 1, 10 do
 					x = i
 					break;
 				end
-
+    
 				return x";
 
 			DynValue res = Script.RunString(script);
@@ -498,7 +498,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void ForEachLoopWithBreak()
 		{
-			string script = @"
+			string script = @"    
 				x = 0
 				y = 0
 
@@ -511,7 +511,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 					return ii, v
 				  end
 				end
-
+    
 				function ipairslua (a)
 				  return iter, a, 0
 				end
@@ -524,7 +524,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 						break
 					end
 				end
-
+    
 				return x, y";
 
 			DynValue res = Script.RunString(script);
@@ -541,7 +541,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void ForEachLoop()
 		{
-			string script = @"
+			string script = @"    
 				x = 0
 				y = 0
 
@@ -554,7 +554,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 					return ii, v
 				  end
 				end
-
+    
 				function ipairslua (a)
 				  return iter, a, 0
 				end
@@ -563,7 +563,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 					x = x + i
 					y = y + j
 				end
-
+    
 				return x, y";
 
 			DynValue res = Script.RunString(script);
@@ -579,10 +579,10 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void LengthOperator()
 		{
-			string script = @"
+			string script = @"    
 				x = 'ciao'
 				y = { 1, 2, 3 }
-
+   
 				return #x, #y";
 
 			DynValue res = Script.RunString(script);
@@ -599,7 +599,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void ForLoopWithBreakAndScopeCheck()
 		{
-			string script = @"
+			string script = @"    
 				x = 0
 
 				for i = 1, 10 do
@@ -609,7 +609,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 						break
 					end
 				end
-
+    
 				return i, x";
 
 			DynValue res = Script.RunString(script);
@@ -624,7 +624,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void FactorialWithOneReturn()
 		{
-			string script = @"
+			string script = @"    
 				-- defines a factorial function
 				function fact (n)
 					if (n == 0) then
@@ -632,7 +632,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 					end
 					return n*fact(n - 1)
 				end
-
+    
 				return fact(5)";
 
 			DynValue res = Script.RunString(script);
@@ -770,7 +770,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void GlobalVarAssignment()
 		{
-			string script = @"x = 1; return x;";
+			string script = @"x = 1; return x;";    
 
 			DynValue res = Script.RunString(script);
 
@@ -780,7 +780,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void TupleAssignment1()
 		{
-			string script = @"
+			string script = @"    
 				function y()
 					return 2, 3
 				end
@@ -790,7 +790,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 				end
 
 				w, x, y, z = 0, x()
-
+    
 				return w+x+y+z";
 
 			DynValue res = Script.RunString(script);
@@ -802,7 +802,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void IterativeFactorialWithWhile()
 		{
-			string script = @"
+			string script = @"    
 				function fact (n)
 					local result = 1;
 					while(n > 0) do
@@ -811,7 +811,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 					end
 					return result;
 				end
-
+    
 				return fact(5)";
 
 			DynValue res = Script.RunString(script);
@@ -825,7 +825,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void IterativeFactorialWithRepeatUntilAndScopeCheck()
 		{
-			string script = @"
+			string script = @"    
 				function fact (n)
 					local result = 1;
 					repeat
@@ -835,7 +835,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 					until (n == 0 and checkscope == 1)
 					return result;
 				end
-
+    
 				return fact(5)";
 
 			Script s = new Script(CoreModules.None);
@@ -849,7 +849,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 
 		public void SimpleForLoop()
 		{
-			string script = @"
+			string script = @"    
 					x = 0
 					for i = 1, 3 do
 						x = x + i;
@@ -867,11 +867,11 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void SimpleFunc()
 		{
-			string script = @"
+			string script = @"    
 				function fact (n)
 					return 3;
 				end
-
+    
 				return fact(3)";
 
 			DynValue res = Script.RunString(script);
@@ -883,7 +883,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void IterativeFactorialWithFor()
 		{
-			string script = @"
+			string script = @"    
 				-- defines a factorial function
 				function fact (n)
 					x = 1
@@ -893,7 +893,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 
 					return x;
 				end
-
+    
 				return fact(5)";
 
 			DynValue res = Script.RunString(script);
@@ -906,7 +906,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void LocalFunctionsObscureScopeRule()
 		{
-			string script = @"
+			string script = @"    
 				local function fact()
 					return fact;
 				end
@@ -922,7 +922,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void FunctionWithStringArg2()
 		{
-			string script = @"
+			string script = @"    
 				x = 0;
 
 				fact = function(y)
@@ -944,7 +944,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void FunctionWithStringArg()
 		{
-			string script = @"
+			string script = @"    
 				x = 0;
 
 				function fact(y)
@@ -967,7 +967,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void FunctionWithTableArg()
 		{
-			string script = @"
+			string script = @"    
 				x = 0;
 
 				function fact(y)
@@ -990,7 +990,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void TupleAssignment2()
 		{
-			string script = @"
+			string script = @"    
 				function boh()
 					return 1, 2;
 				end
@@ -1016,7 +1016,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		{
 			string script = @"function Allowed( )
 									for i = 1, 20 do
-										return false
+  										return false 
 									end
 									return true
 								end
@@ -1031,10 +1031,10 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		{
 			string script = @"function Allowed( )
 									for i = 1, 20 do
-									if ( false ) or ( true and true ) or ( 7+i <= 9 and false ) then
-										return false
-									end
+									if ( false ) or ( true and true ) or ( 7+i <= 9 and false ) then 
+  										return false 
 									end
+									end		
 									return true
 								end
 						Allowed();
@@ -1049,13 +1049,13 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		{
 			string script = @"
 						t = { {}, {} }
-
+						
 						function Allowed( )
 									for i = 1, 20 do
-									if ( t[1][3] ) or ( i <= 17 and t[1][1] ) or ( 7+i <= 9 and t[1][1] ) then
-										return false
-									end
+									if ( t[1][3] ) or ( i <= 17 and t[1][1] ) or ( 7+i <= 9 and t[1][1] ) then 
+  										return false 
 									end
+									end		
 									return true
 								end
 						Allowed();
@@ -1162,7 +1162,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 						for i = 1, #t do
 							sum = sum + t[i];
 						end
-
+	
 						return sum;
 					end
 
@@ -1186,7 +1186,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 						for i = 1, #t do
 							sum = sum + t[i];
 						end
-
+	
 						return sum * m;
 					end
 
@@ -1210,7 +1210,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 						for i = 1, #t do
 							sum = sum + t[i];
 						end
-
+	
 						return sum;
 					end
 
@@ -1275,15 +1275,15 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 			string script = @"
 				local RES = { }
 
-				RES.T1 = (_ENV == _G)
+				RES.T1 = (_ENV == _G) 
 
 				a = 1
 
 				local function f(t)
-				  local _ENV = t
-
-				  RES.T2 = (getmetatable == nil)
+				  local _ENV = t 
 
+				  RES.T2 = (getmetatable == nil) 
+  
 				  a = 2 -- create a new entry in t, doesn't touch the original 'a' global
 				  b = 3 -- create a new entry in t
 				end
@@ -1326,12 +1326,12 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void TupleToOperator()
 		{
-			string script = @"
+			string script = @"    
 				function x()
 					return 3, 'xx';
 				end
 
-				return x() == 3;
+				return x() == 3;	
 			";
 
 			Script S = new Script(CoreModules.None);
@@ -1345,9 +1345,9 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void LiteralExpands()
 		{
-			string script = @"
+			string script = @"    
 				x = 'a\65\66\67z';
-				return x;
+				return x;	
 			";
 
 			Script S = new Script(CoreModules.None);
@@ -1360,10 +1360,10 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 		[Test]
 		public void HomonymArguments()
 		{
-			string script = @"
+			string script = @"    
 				function test(_,value,_) return _; end
 
-				return test(1, 2, 3);
+				return test(1, 2, 3);	
 			";
 
 			Script S = new Script(CoreModules.None);
@@ -1383,7 +1383,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 					for i = 1, #t do
 						sum = sum + t[i];
 					end
-
+	
 					return sum;
 								";
 
@@ -1407,7 +1407,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 						for i = 1, #t do
 							sum = sum + t[i];
 						end
-
+	
 						return sum;
 					end
 
@@ -1511,7 +1511,26 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 				v,v = myFunc()
 				print(v)
 				print(v)
-				");
+				");			
 		}
+
+
+//		[Test]
+//		public void TestModulesLoadingWithoutCrash()
+//		{
+//#if !PCL
+//			var basePath = AppDomain.CurrentDomain.BaseDirectory;
+//			var scriptPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "scripts\\test");
+//			Script script = new Script();
+
+//			((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new[]
+//			{
+//				System.IO.Path.Combine(basePath, "scripts\\test\\test.lua"),
+//			};
+//			var obj = script.LoadFile(System.IO.Path.Combine(scriptPath, "test.lua"));
+//			obj.Function.Call();
+//#endif
+//		}
+
 	}
 }

+ 3 - 1
src/MoonSharp.Interpreter.Tests/EndToEnd/UserDataOverloadsTests.cs

@@ -289,6 +289,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 			return 5 + a;
 		}
 
+#if !DOTNET_CORE
 		[Test]
 		public void OverloadTest_WithoutObjects()
 		{
@@ -305,7 +306,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 			}
 
 			// Creates the callback over the 'this' object
-			DynValue callback = DynValue.NewCallback(ov.GetCallbackFunction(s, this));
+			DynValue callback = DynValue.NewCallback(ov.GetCallbackFunction(s, this)); 
 			s.Globals.Set("func", callback);
 
 			// Execute and check the results.
@@ -317,6 +318,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 			Assert.AreEqual(1, result.Tuple[0].Number);
 			Assert.AreEqual(22, result.Tuple[1].Number);
 		}
+#endif
 
 
 

+ 0 - 178
src/MoonSharp.Interpreter.Tests/MoonSharp.Interpreter.Tests.csproj

@@ -1,178 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-    <PropertyGroup>
-        <TargetFrameworks>netstandard2.0;net35;net40</TargetFrameworks>
-        <AssemblyOriginatorKeyFile>..\keypair.snk</AssemblyOriginatorKeyFile>
-        <Authors>MoonSharp</Authors>
-        <Description></Description>
-        <Copyright>Copyright © 2014-2015, Marco Mastropaolo</Copyright>
-        <PackageProjectUrl>https://www.moonsharp.org</PackageProjectUrl>
-        <PackageLicenseUrl>https://raw.githubusercontent.com/xanathar/moonsharp/master/LICENSE</PackageLicenseUrl>
-        <RepositoryUrl>https://github.com/xanathar/moonsharp/</RepositoryUrl>
-        <PackageId>MoonSharp.Interpreter.Tests</PackageId>
-        <Title>MoonSharp.Interpreter.Tests</Title>
-        <PackageVersion>2.0.0</PackageVersion>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(Configuration)'=='Debug'">
-        <DebugSymbols>true</DebugSymbols>
-        <DebugType>full</DebugType>
-        <Optimize>false</Optimize>
-        <OutputPath>bin\Debug\</OutputPath>
-        <DefineConstants>TRACE;DEBUG</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn>3021, 1591</NoWarn>
-        <DocumentationFile />
-    </PropertyGroup>
-
-    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-        <DebugType>pdbonly</DebugType>
-        <Optimize>true</Optimize>
-        <OutputPath>bin\Release\</OutputPath>
-        <DefineConstants>TRACE</DefineConstants>
-        <ErrorReport>prompt</ErrorReport>
-        <WarningLevel>4</WarningLevel>
-        <NoWarn />
-        <UseVSHostingProcess>false</UseVSHostingProcess>
-    </PropertyGroup>
-
-    <PropertyGroup Condition="'$(DebugType)' == 'portable'">
-        <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
-    </PropertyGroup>
-
-    <ItemGroup>
-        <None Include="TestMore\000-sanity.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\001-if.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\002-table.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\011-while.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\012-repeat.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\014-fornum.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\015-forlist.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\101-boolean.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\102-function.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\103-nil.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\104-number.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\105-string.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\106-table.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\107-thread.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\108-userdata.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\200-examples.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\201-assign.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\202-expr.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\203-lexico.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\204-grammar.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\211-scope.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\212-function.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\213-closure.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\214-coroutine.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\221-table.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\222-constructor.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\223-iterator.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\231-metatable.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\232-object.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\301-basic.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\304-string.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\305-table.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\306-math.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\307-bit.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\308-io.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\309-os.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\310-debug.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\314-regex.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\320-stdin.t">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\Modules\Test\Builder.lua">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-        <None Include="TestMore\Modules\Test\More.lua">
-            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-        </None>
-    </ItemGroup>
-
-    <ItemGroup>
-      <ProjectReference Include="..\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj" />
-    </ItemGroup>
-
-    <ItemGroup>
-      <PackageReference Include="NUnit" Version="2.6.4" />
-    </ItemGroup>
-
-</Project>

+ 119 - 0
src/MoonSharp.Interpreter.Tests/MoonSharp.Interpreter.Tests.csproj.bak

@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{4AD350E6-E296-43EF-9FEA-CB70358467E4}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MoonSharp.Interpreter.Tests</RootNamespace>
+    <AssemblyName>MoonSharp.Interpreter.Tests</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
+    <IsCodedUITest>False</IsCodedUITest>
+    <TestProjectType>UnitTest</TestProjectType>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+      <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
+    <Reference Include="nunit.framework">
+      <HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <Choose>
+    <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+      </ItemGroup>
+    </When>
+    <Otherwise />
+  </Choose>
+  <ItemGroup>
+    <Compile Include="ClosureTests.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SimpleTests.cs" />
+    <Compile Include="TableTests.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj">
+      <Project>{91ea9b9d-fe03-4273-bdaf-8ad42ede1e59}</Project>
+      <Name>MoonSharp.Interpreter</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 4.5</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Choose>
+    <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+      </ItemGroup>
+    </When>
+  </Choose>
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 328 - 0
src/MoonSharp.Interpreter.Tests/MoonSharp.Interpreter.Tests.net35-client.csproj

@@ -0,0 +1,328 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{4AD350E6-E296-43EF-9FEA-CB70358467E4}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MoonSharp.Interpreter.Tests</RootNamespace>
+    <AssemblyName>MoonSharp.Interpreter.Tests</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
+    <IsCodedUITest>False</IsCodedUITest>
+    <TestProjectType>UnitTest</TestProjectType>
+    <TargetFrameworkProfile />
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>..\keypair.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Dev\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Dev\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Devp4|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Devp4\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Devp4|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Devp4\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
+    <Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+      <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <Choose>
+    <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+      </ItemGroup>
+    </When>
+    <Otherwise />
+  </Choose>
+  <ItemGroup>
+    <Compile Include="EmbeddableNUnitWrapper.cs" />
+    <Compile Include="EndToEnd\BinaryDumpTests.cs" />
+    <Compile Include="EndToEnd\ClosureTests.cs" />
+    <Compile Include="EndToEnd\CollectionsBaseInterfGenRegisteredTests.cs" />
+    <Compile Include="EndToEnd\CollectionsBaseGenRegisteredTests.cs" />
+    <Compile Include="EndToEnd\CollectionsRegisteredTests.cs" />
+    <Compile Include="EndToEnd\ConfigPropertyAssignerTests.cs" />
+    <Compile Include="EndToEnd\CoroutineTests.cs" />
+    <Compile Include="EndToEnd\DynamicTests.cs" />
+    <Compile Include="EndToEnd\ErrorHandlingTests.cs" />
+    <Compile Include="EndToEnd\GotoTests.cs" />
+    <Compile Include="EndToEnd\JsonSerializationTests.cs" />
+    <Compile Include="EndToEnd\LuaTestSuiteExtract.cs" />
+    <Compile Include="EndToEnd\MetatableTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="EndToEnd\ProxyObjectsTests.cs" />
+    <Compile Include="EndToEnd\StringLibTests.cs" />
+    <Compile Include="EndToEnd\StructAssignmentTechnique.cs" />
+    <Compile Include="EndToEnd\TailCallTests.cs" />
+    <Compile Include="EndToEnd\UserDataEventsTests.cs" />
+    <Compile Include="EndToEnd\UserDataEnumsTest.cs" />
+    <Compile Include="EndToEnd\UserDataNestedTypesTests.cs" />
+    <Compile Include="EndToEnd\VarargsTupleTests.cs" />
+    <Compile Include="EndToEnd\VtUserDataPropertiesTests.cs" />
+    <Compile Include="EndToEnd\VtUserDataOverloadsTests.cs" />
+    <Compile Include="EndToEnd\VtUserDataMethodsTests.cs" />
+    <Compile Include="EndToEnd\VtUserDataMetaTests.cs" />
+    <Compile Include="EndToEnd\VtUserDataIndexerTests.cs" />
+    <Compile Include="EndToEnd\VtUserDataFieldsTests.cs" />
+    <Compile Include="EndToEnd\UserDataMetaTests.cs" />
+    <Compile Include="EndToEnd\UserDataIndexerTests.cs" />
+    <Compile Include="EndToEnd\UserDataMethodsTests.cs" />
+    <Compile Include="EndToEnd\UserDataOverloadsTests.cs" />
+    <Compile Include="EndToEnd\UserDataFieldsTests.cs" />
+    <Compile Include="EndToEnd\UserDataPropertiesTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="EndToEnd\Utils.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="EndToEnd\SimpleTests.cs" />
+    <Compile Include="EndToEnd\TableTests.cs" />
+    <Compile Include="TapRunner.cs" />
+    <Compile Include="TestMoreTests.cs" />
+    <Compile Include="TestRunner.cs" />
+    <Compile Include="Units\BinDumpStreamTests.cs" />
+    <Compile Include="Units\FastStackTests.cs" />
+    <Compile Include="Units\InteropTests.cs" />
+    <Compile Include="_Hardwired.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\MoonSharp.Interpreter\MoonSharp.Interpreter.net35-client.csproj">
+      <Project>{91ea9b9d-fe03-4273-bdaf-8ad42ede1e59}</Project>
+      <Name>MoonSharp.Interpreter.net35-client</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+    <None Include="TestMore\000-sanity.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\001-if.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\002-table.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\011-while.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\012-repeat.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\014-fornum.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\015-forlist.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\101-boolean.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\102-function.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\103-nil.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\104-number.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\105-string.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\106-table.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\107-thread.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\108-userdata.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\200-examples.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\201-assign.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\202-expr.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\203-lexico.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\204-grammar.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\211-scope.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\212-function.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\213-closure.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\214-coroutine.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\221-table.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\222-constructor.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\223-iterator.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\231-metatable.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\232-object.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\301-basic.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\304-string.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\305-table.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\306-math.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\307-bit.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\308-io.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\309-os.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\310-debug.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\314-regex.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\320-stdin.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\Modules\Test\Builder.lua">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\Modules\Test\More.lua">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+  <ItemGroup />
+  <Choose>
+    <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+      </ItemGroup>
+    </When>
+  </Choose>
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 36 - 0
src/MoonSharp.Interpreter.Tests/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MoonSharp.Interpreter.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MoonSharp.Interpreter.Tests")]
+[assembly: AssemblyCopyright("Copyright ©  2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+//[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+//[assembly: Guid("2d45e616-2c1d-4458-b68c-734ef4616028")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 8 - 0
src/MoonSharp.Interpreter.Tests/TapRunner.cs

@@ -56,6 +56,14 @@ namespace MoonSharp.Interpreter.Tests
 
 			S.Options.UseLuaErrorLocations = true;
 
+#if PCL
+	#if EMBEDTEST
+			S.Options.ScriptLoader = new EmbeddedResourcesScriptLoader(Assembly.GetExecutingAssembly());
+	#else
+			S.Options.ScriptLoader = new TestsScriptLoader();
+	#endif
+#endif
+
 			S.Globals.Set("arg", DynValue.NewTable(S));
 
 			((ScriptLoaderBase)S.Options.ScriptLoader).ModulePaths = new string[] { "TestMore/Modules/?", "TestMore/Modules/?.lua" };

+ 1 - 2
src/MoonSharp.Interpreter.Tests/TestRunner.cs

@@ -1,6 +1,5 @@
 using System;
 using System.Collections.Generic;
-using System.IO;
 using System.Linq;
 using System.Reflection;
 using System.Text;
@@ -68,7 +67,7 @@ namespace MoonSharp.Interpreter.Tests
 				t => Framework.Do.GetCustomAttributes(t, typeof(TestFixtureAttribute), true).Any()).ToArray();
 
 #if UNITY_EDITOR_OSX
-            File.WriteAllLines(Path.GetTempPath() + Path.DirectorySeparatorChar + "types.cs", types.Select(t => t.FullName).ToArray());
+            System.IO.File.WriteAllLines("/temp/types.cs", types.Select(t => t.FullName).ToArray());
 #endif
 
 			Console_WriteLine("Found {0} test types.", types.Length);

+ 4 - 4
src/MoonSharp.Interpreter.Tests/_Hardwired.cs

@@ -1,4 +1,4 @@
-#if !UNITY_5 && !DOTNET_CORE
+#if !PCL && !UNITY_5 && !DOTNET_CORE
 
 //------------------------------------------------------------------------------
 // <auto-generated>
@@ -16,9 +16,9 @@
 // ----------------------------------------------------------
 // Code generated on 2016-02-03T23:14:47.5315068+01:00
 // ----------------------------------------------------------
-//
-//
-//
+// 
+// 
+// 
 // WARNING : Member 'MoonSharp.Interpreter.Tests.EndToEnd.StructAssignmentTechnique+Vector3.X::Set' will be a no-op, as it's a member of a value type.
 // WARNING : Member 'MoonSharp.Interpreter.Tests.EndToEnd.StructAssignmentTechnique+Vector3.Y::Set' will be a no-op, as it's a member of a value type.
 // WARNING : Member 'MoonSharp.Interpreter.Tests.EndToEnd.StructAssignmentTechnique+Vector3.Z::Set' will be a no-op, as it's a member of a value type.

+ 257 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/MoonSharp.Interpreter.Tests.Embeddable.portable40.csproj

@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{28B8B747-5683-46C0-B308-62E6D3C2F4CB}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MoonSharp.Interpreter.Tests</RootNamespace>
+    <AssemblyName>MoonSharp.Interpreter.Tests</AssemblyName>
+    <DefaultLanguage>en-US</DefaultLanguage>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <TargetFrameworkProfile>Profile328</TargetFrameworkProfile>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>..\..\..\keypair.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;PCL,EMBEDTEST</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE;PCL,EMBEDTEST</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Dev\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;PCL,EMBEDTEST</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Devp4|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Devp4\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;PCL,EMBEDTEST</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\MoonSharp.Interpreter\_Projects\MoonSharp.Interpreter.portable40\MoonSharp.Interpreter.portable40.csproj">
+      <Project>{49f32476-fca0-45fd-8f89-0c7c0d15e409}</Project>
+      <Name>MoonSharp.Interpreter.portable40</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\..\EmbeddableNUnitWrapper.cs">
+      <Link>EmbeddableNUnitWrapper.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\BinaryDumpTests.cs">
+      <Link>BinaryDumpTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\ClosureTests.cs">
+      <Link>ClosureTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\CollectionsBaseInterfGenRegisteredTests.cs">
+      <Link>CollectionsBaseInterfGenRegisteredTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\CollectionsBaseGenRegisteredTests.cs">
+      <Link>CollectionsBaseGenRegisteredTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\CollectionsRegisteredTests.cs">
+      <Link>CollectionsRegisteredTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\ConfigPropertyAssignerTests.cs">
+      <Link>ConfigPropertyAssignerTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\CoroutineTests.cs">
+      <Link>CoroutineTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\DynamicTests.cs">
+      <Link>DynamicTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\ErrorHandlingTests.cs">
+      <Link>ErrorHandlingTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\GotoTests.cs">
+      <Link>GotoTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\JsonSerializationTests.cs">
+      <Link>JsonSerializationTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\LuaTestSuiteExtract.cs">
+      <Link>LuaTestSuiteExtract.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\MetatableTests.cs">
+      <SubType>Code</SubType>
+      <Link>MetatableTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\ProxyObjectsTests.cs">
+      <Link>ProxyObjectsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\StringLibTests.cs">
+      <Link>StringLibTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\StructAssignmentTechnique.cs">
+      <Link>StructAssignmentTechnique.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\TailCallTests.cs">
+      <Link>TailCallTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataEventsTests.cs">
+      <Link>UserDataEventsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataEnumsTest.cs">
+      <Link>UserDataEnumsTest.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataNestedTypesTests.cs">
+      <Link>UserDataNestedTypesTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VarargsTupleTests.cs">
+      <Link>VarargsTupleTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataPropertiesTests.cs">
+      <Link>VtUserDataPropertiesTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataOverloadsTests.cs">
+      <Link>VtUserDataOverloadsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataMethodsTests.cs">
+      <Link>VtUserDataMethodsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataMetaTests.cs">
+      <Link>VtUserDataMetaTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataIndexerTests.cs">
+      <Link>VtUserDataIndexerTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataFieldsTests.cs">
+      <Link>VtUserDataFieldsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataMetaTests.cs">
+      <Link>UserDataMetaTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataIndexerTests.cs">
+      <Link>UserDataIndexerTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataMethodsTests.cs">
+      <Link>UserDataMethodsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataOverloadsTests.cs">
+      <Link>UserDataOverloadsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataFieldsTests.cs">
+      <Link>UserDataFieldsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataPropertiesTests.cs">
+      <SubType>Code</SubType>
+      <Link>UserDataPropertiesTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\Utils.cs">
+      <Link>Utils.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Properties\AssemblyInfo.cs">
+      <Link>AssemblyInfo.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\SimpleTests.cs">
+      <Link>SimpleTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\TableTests.cs">
+      <Link>TableTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\TapRunner.cs">
+      <Link>TapRunner.cs</Link>
+    </Compile>
+    <Compile Include="..\..\TestMoreTests.cs">
+      <Link>TestMoreTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\TestRunner.cs">
+      <Link>TestRunner.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Units\BinDumpStreamTests.cs">
+      <Link>BinDumpStreamTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Units\FastStackTests.cs">
+      <Link>FastStackTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Units\InteropTests.cs">
+      <Link>InteropTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\_Hardwired.cs">
+      <Link>_Hardwired.cs</Link>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="TestMore\000-sanity.t" />
+    <EmbeddedResource Include="TestMore\001-if.t" />
+    <EmbeddedResource Include="TestMore\002-table.t" />
+    <EmbeddedResource Include="TestMore\011-while.t" />
+    <EmbeddedResource Include="TestMore\012-repeat.t" />
+    <EmbeddedResource Include="TestMore\014-fornum.t" />
+    <EmbeddedResource Include="TestMore\015-forlist.t" />
+    <EmbeddedResource Include="TestMore\101-boolean.t" />
+    <EmbeddedResource Include="TestMore\102-function.t" />
+    <EmbeddedResource Include="TestMore\103-nil.t" />
+    <EmbeddedResource Include="TestMore\104-number.t" />
+    <EmbeddedResource Include="TestMore\105-string.t" />
+    <EmbeddedResource Include="TestMore\106-table.t" />
+    <EmbeddedResource Include="TestMore\107-thread.t" />
+    <EmbeddedResource Include="TestMore\108-userdata.t" />
+    <EmbeddedResource Include="TestMore\200-examples.t" />
+    <EmbeddedResource Include="TestMore\201-assign.t" />
+    <EmbeddedResource Include="TestMore\202-expr.t" />
+    <EmbeddedResource Include="TestMore\203-lexico.t" />
+    <EmbeddedResource Include="TestMore\204-grammar.t" />
+    <EmbeddedResource Include="TestMore\211-scope.t" />
+    <EmbeddedResource Include="TestMore\212-function.t" />
+    <EmbeddedResource Include="TestMore\213-closure.t" />
+    <EmbeddedResource Include="TestMore\214-coroutine.t" />
+    <EmbeddedResource Include="TestMore\221-table.t" />
+    <EmbeddedResource Include="TestMore\222-constructor.t" />
+    <EmbeddedResource Include="TestMore\223-iterator.t" />
+    <EmbeddedResource Include="TestMore\231-metatable.t" />
+    <EmbeddedResource Include="TestMore\232-object.t" />
+    <EmbeddedResource Include="TestMore\301-basic.t" />
+    <EmbeddedResource Include="TestMore\304-string.t" />
+    <EmbeddedResource Include="TestMore\305-table.t" />
+    <EmbeddedResource Include="TestMore\306-math.t" />
+    <EmbeddedResource Include="TestMore\307-bit.t" />
+    <EmbeddedResource Include="TestMore\308-io.t" />
+    <EmbeddedResource Include="TestMore\309-os.t" />
+    <EmbeddedResource Include="TestMore\310-debug.t" />
+    <EmbeddedResource Include="TestMore\314-regex.t" />
+    <EmbeddedResource Include="TestMore\320-stdin.t" />
+    <EmbeddedResource Include="TestMore\Modules\Test\Builder.lua">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </EmbeddedResource>
+    <EmbeddedResource Include="TestMore\Modules\Test\More.lua" />
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 30 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/Properties/AssemblyInfo.cs

@@ -0,0 +1,30 @@
+using System.Resources;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MoonSharp.Interpreter.Tests.Embeddable.portable40")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MoonSharp.Interpreter.Tests.Embeddable.portable40")]
+[assembly: AssemblyCopyright("Copyright ©  2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 54 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/000-sanity.t

@@ -0,0 +1,54 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua test suite
+
+=head2 Synopsis
+
+    % prove 000-sanity.t
+
+=head2 Description
+
+=cut
+
+]]
+
+function f (n)
+    return n + 1
+end
+
+function g (m, p)
+    return m + p
+end
+
+print('1..9')
+print("ok 1 -")
+print('ok', 2, "- list")
+print("ok " .. 3 .. " - concatenation")
+i = 4
+print("ok " .. i .. " - var")
+i = i + 1
+print("ok " .. i .. " - var incr")
+print("ok " .. i+1 .. " - expr")
+j = f(i + 1)
+print("ok " .. j .. " - call f")
+k = g(i, 3)
+print("ok " .. k .. " - call g")
+local print = print
+print("ok 9 - local")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 87 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/001-if.t

@@ -0,0 +1,87 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua if statement
+
+=head2 Synopsis
+
+    % prove 001-if.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.4 "Control Structures",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.4>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+]]
+
+print("1..6")
+
+if true then
+    print("ok 1")
+else
+    print("not ok 1")
+end
+
+if not true then
+    print("not ok 2")
+else
+    print("ok 2")
+end
+
+a = 12
+b = 34
+if a < b then
+    print("ok 3")
+else
+    print("not ok 3")
+end
+
+a = 0
+b = 4
+if a < b then
+    print("ok 4")
+elseif a == b then
+    print("not ok 4")
+else
+    print("not ok 4")
+end
+
+a = 5
+b = 5
+if a < b then
+    print("not ok 5")
+elseif a == b then
+    print("ok 5")
+else
+    print("not ok 5")
+end
+
+a = 10
+b = 6
+if a < b then
+    print("not ok 6")
+elseif a == b then
+    print("not ok 6")
+else
+    print("ok 6")
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 67 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/002-table.t

@@ -0,0 +1,67 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua table
+
+=head2 Synopsis
+
+    % prove 002-table.t
+
+=head2 Description
+
+See "Programming in Lua", section 2.5 "Tables".
+
+=cut
+
+]]
+
+print("1..8")
+
+a = {"ok 1", "ok 2", "ok 3"}
+print(a[1])
+i = 2
+print(a[i])
+print(a[i+1])
+if #a == 3 then
+    print("ok 4 - len")
+else
+    print("not ok 4")
+end
+if a[7] == nil then
+    print("ok 5")
+else
+    print("not ok 5")
+end
+
+t = {a=10, b=100}
+if t['a'] == 10 then
+    print("ok 6")
+else
+    print("not ok 6")
+end
+if t.b == 100 then
+    print("ok 7")
+else
+    print("not ok 7")
+end
+if t.z == nil then
+    print("ok 8")
+else
+    print("not ok 8")
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 80 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/011-while.t

@@ -0,0 +1,80 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua while statement
+
+=head2 Synopsis
+
+    % prove 011-while.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.4 "Control Structures",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.4>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+]]
+
+print("1..11")
+
+a = {}
+local i = 1
+while a[i] do
+    i = i + 1
+end
+if i == 1 then
+    print("ok 1 - while empty")
+else
+    print("not ok 1 - " .. i)
+end
+
+a = {"ok 2 - while ", "ok 3", "ok 4"}
+local i = 1
+while a[i] do
+    print(a[i])
+    i = i + 1
+end
+
+a = {"ok 5 - with break", "ok 6", "stop", "more"}
+local i = 1
+while a[i] do
+    if a[i] == 'stop' then break end
+    print(a[i])
+    i = i + 1
+end
+if i == 3 then
+    print("ok 7 - break")
+else
+    print("not ok 7 - " .. i)
+end
+
+x = 3
+local i = 1
+while i<=x do
+    print("ok " .. 7+i)
+    i = i + 1
+end
+if i == 4 then
+    print("ok 11")
+else
+    print("not ok 11 - " .. i)
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 78 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/012-repeat.t

@@ -0,0 +1,78 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua repeat statement
+
+=head2 Synopsis
+
+    % prove 012-repeat.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.4 "Control Structures",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.4>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+]]
+
+print("1..8")
+
+a = {"ok 1 - repeat", "ok 2", "ok 3"}
+local i = 0
+repeat
+    i = i + 1
+    if a[i] then
+        print(a[i])
+    end
+until not a[i]
+if i == 4 then
+    print("ok 4")
+else
+    print("not ok 4 - " .. i)
+end
+
+a = {"ok 5 - with break", "ok 6", 'stop', 'more'}
+local i = 0
+repeat
+    i = i + 1
+    if a[i] == 'stop' then break end
+    print(a[i])
+until not a[i]
+if a[i] == 'stop' then
+    print("ok 7 - break")
+else
+    print("not ok 7 - " .. a[i])
+end
+
+function f () return true end
+
+local i = 1
+repeat
+    local v = f()
+    if i == 1 then
+        print("ok 8 - scope")
+    else
+        print("not ok")
+        break
+    end
+    i = i + 1
+until v
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 136 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/014-fornum.t

@@ -0,0 +1,136 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua for statement
+
+=head2 Synopsis
+
+    % prove 014-fornum.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.5 "For Statement",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.5>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+--]]
+
+print("1..36")
+
+for i = 1, 10, 2 do
+    print("ok " .. (i+1)/2 .. " - for 1, 10, 2")
+end
+
+for i = 1, 10, 2 do
+    function f ()
+        print("ok " .. (i+11)/2 .. " - for 1, 10, 2 lex")
+    end
+    f()
+end
+
+function f (i)
+    print("ok " .. (i+21)/2 .. " - for 1, 10, 2 !lex")
+end
+for i = 1, 10, 2 do
+    f(i)
+end
+
+for i = 3, 5 do
+    print("ok " .. 13+i .. " - for 3, 5")
+    i = i + 1
+end
+
+for i = 5, 1, -1 do
+    print("ok " .. 24-i .. " - for 5, 1, -1")
+end
+
+for i = 5, 5 do
+    print("ok " .. 19+i .. " - for 5, 5")
+end
+
+for i = 5, 5, -1 do
+    print("ok " .. 20+i .. " - for 5, 5, -1")
+end
+
+v = false
+for i = 5, 3 do
+    v = true
+end
+if v then
+    print("not ok 26 - for 5, 3")
+else
+    print("ok 26 - for 5, 3")
+end
+
+v = false
+for i = 5, 7, -1 do
+    v = true
+end
+if v then
+    print("not ok 27 - for 5, 7, -1")
+else
+    print("ok 27 - for 5, 7, -1")
+end
+
+v = false
+for i = 5, 7, 0 do
+    v = true
+    break -- avoid infinite loop with luajit
+end
+if jit then
+    print("not ok 28 - for 5, 7, 0 # TODO # LuaJIT intentional.")
+elseif v then
+    print("not ok 28 - for 5, 7, 0")
+else
+    print("ok 28 - for 5, 7, 0")
+end
+
+v = nil
+for i = 1, 10, 2 do
+    if i > 4 then break end
+    print("ok " .. (i+57)/2 .. " - for break")
+    v = i
+end
+if v == 3 then
+    print("ok 31 - break")
+else
+    print("not ok 31 - " .. v)
+end
+
+local function first() return 1 end
+local function limit() return 8 end
+local function step()  return 2 end
+for i = first(), limit(), step() do
+    print("ok " .. (i+63)/2 .. " - with functions")
+end
+
+local a = {}
+for i = 1, 10 do
+    a[i] = function () return i end
+end
+local v = a[5]()
+if v == 5 then
+    print("ok 36 - for & upval")
+else
+    print("not ok 36 - for & upval")
+    print("#", v)
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 99 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/015-forlist.t

@@ -0,0 +1,99 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua for statement
+
+=head2 Synopsis
+
+    % prove 015-forlist.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.5 "For Statement",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.5>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+--]]
+
+print("1..18")
+
+a = {"ok 1 - for ipairs", "ok 2 - for ipairs", "ok 3 - for ipairs"}
+for _, v in ipairs(a) do
+    print(v)
+end
+for i, v in ipairs(a) do
+    print("ok " .. 3+i .. " - for ipairs")
+end
+
+r = false
+t = {a=10, b=100}
+for i, v in ipairs(t) do
+    print(i, v)
+    r = true
+end
+if r then
+    print("not ok 7 - for ipairs (hash)")
+else
+    print("ok 7 - for ipairs (hash)")
+end
+
+for k in pairs(a) do
+    print("ok " .. 7+k .. " - for pairs")
+end
+
+local i = 1
+for k in pairs(t) do
+    if k == 'a' or k == 'b' then
+        print("ok " .. 10+i .. " - for pairs (hash)")
+    else
+        print("not ok " .. 10+i .. " - " .. k)
+    end
+    i = i + 1
+end
+
+a = {"ok 13 - for break", "ok 14 - for break", "stop", "more"}
+local i
+for _, v in ipairs(a) do
+    if v == "stop" then break end
+    print(v)
+    i = _
+end
+if i == 2 then
+    print("ok 15 - break")
+else
+    print("not ok 15 - " .. i)
+end
+
+local a = {"ok 16 - for & upval", "ok 17 - for & upval", "ok 18 - for & upval"}
+local b = {}
+for i, v in ipairs(a) do
+    b[i] = function () return v end
+end
+for i, v in ipairs(a) do
+    local r = b[i]()
+    if r == a[i] then
+        print(r)
+    else
+        print("not " .. a[i])
+        print("#", r)
+    end
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 120 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/101-boolean.t

@@ -0,0 +1,120 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1  Lua boolean & coercion
+
+=head2 Synopsis
+
+    % prove 101-boolean.t
+
+=head2 Description
+
+=cut
+
+]]
+
+require 'Test.More'
+
+plan(24)
+
+error_like(function () return -true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a %w+ value",
+           "-true")
+
+error_like(function () return #true end,
+           "^[^:]+:%d+: attempt to get length of a boolean value",
+           "#true")
+
+is(not false, true, "not false")
+
+error_like(function () return true + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true + 10")
+
+error_like(function () return true - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true - 2")
+
+error_like(function () return true * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true * 3.14")
+
+error_like(function () return true / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true / -7")
+
+error_like(function () return true % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true % 4")
+
+error_like(function () return true ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true ^ 3")
+
+error_like(function () return true .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate a boolean value",
+           "true .. 'end'")
+
+is(true == true, true, "true == true")
+
+is(true ~= false, true, "true ~= false")
+
+is(true == 1, false, "true == 1")
+
+is(true ~= 1, true, "true ~= 1")
+
+error_like(function () return true < false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true < false")
+
+error_like(function () return true <= false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true <= false")
+
+error_like(function () return true > false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true > false")
+
+error_like(function () return true >= false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true >= false")
+
+error_like(function () return true < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true < 0")
+
+error_like(function () return true <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true <= 0")
+
+error_like(function () return true > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true > 0")
+
+error_like(function () return true >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true >= 0")
+
+error_like(function () a = true; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = true; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 199 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/102-function.t

@@ -0,0 +1,199 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua function & coercion
+
+=head2 Synopsis
+
+    % prove 102-function.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(51)
+
+f = function () return 1 end
+
+error_like(function () return -f end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-f")
+
+error_like(function () f = print; return -f end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return #f end,
+           "^[^:]+:%d+: attempt to get length of",
+           "#f")
+
+error_like(function () f = print; return #f end,
+           "^[^:]+:%d+: attempt to get length of")
+
+is(not f, false, "not f")
+
+is(not print, false)
+
+error_like(function () return f + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f + 10")
+
+error_like(function () f = print; return f + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f - 2")
+
+error_like(function () f = print; return f - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f * 3.14")
+
+error_like(function () f = print; return f * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f / -7")
+
+error_like(function () f = print; return f / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f % 4")
+
+error_like(function () f = print; return f % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f ^ 3")
+
+error_like(function () f = print; return f ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "f .. 'end'")
+
+error_like(function () f = print; return f .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate")
+
+g = f
+is(f == g, true, "f == f")
+
+g = print
+is(g == print, true)
+
+g = function () return 2 end
+is(f ~= g, true, "f ~= g")
+h = type
+is(f ~= h, true)
+
+is(print ~= g, true)
+is(print ~= h, true)
+
+is(f == 1, false, "f == 1")
+
+is(print == 1, false)
+
+is(f ~= 1, true, "f ~= 1")
+
+is(print ~= 1, true)
+
+error_like(function () return f < g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f < g")
+
+error_like(function () f = print; g = type; return f < g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f <= g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f <= g")
+
+error_like(function () f = print; g = type; return f <= g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f > g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f > g")
+
+error_like(function () f = print; g = type; return f > g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f >= g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f >= g")
+
+error_like(function () f = print; g = type; return f >= g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f < 0")
+
+error_like(function () f = print; return f < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () return f <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f <= 0")
+
+error_like(function () f = print; return f <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () return f > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f > 0")
+
+error_like(function () f = print; return f > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () return f > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f >= 0")
+
+error_like(function () f = print; return f >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () a = f; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = print; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index")
+
+error_like(function () a = f; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = print; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index")
+
+t = {}
+t[print] = true
+ok(t[print])
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 120 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/103-nil.t

@@ -0,0 +1,120 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua nil & coercion
+
+=head2 Synopsis
+
+    % prove 103-nil.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(24)
+
+error_like(function () return -nil end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "-nil")
+
+error_like(function () return #nil end,
+           "^[^:]+:%d+: attempt to get length of a nil value",
+           "#nil")
+
+is(not nil, true, "not nil")
+
+error_like(function () return nil + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil + 10")
+
+error_like(function () return nil - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil - 2")
+
+error_like(function () return nil * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil * 3.14")
+
+error_like(function () return nil / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil / -7")
+
+error_like(function () return nil % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil % 4")
+
+error_like(function () return nil ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil ^ 3")
+
+error_like(function () return nil .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate a nil value",
+           "nil .. 'end'")
+
+is(nil == nil, true, "nil == nil")
+
+is(nil ~= nil, false, "nil ~= nil")
+
+is(nil == 1, false, "nil == 1")
+
+is(nil ~= 1, true, "nil ~= 1")
+
+error_like(function () return nil < nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil < nil")
+
+error_like(function () return nil <= nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil <= nil")
+
+error_like(function () return nil > nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil > nil")
+
+error_like(function () return nil > nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil >= nil")
+
+error_like(function () return nil < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil < 0")
+
+error_like(function () return nil <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil <= 0")
+
+error_like(function () return nil > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil > 0")
+
+error_like(function () return nil >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil >= 0")
+
+error_like(function () a = nil; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = nil; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 190 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/104-number.t

@@ -0,0 +1,190 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua number & coercion
+
+=head2 Synopsis
+
+    % prove 104-number.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(54)
+
+is(-1, -(1), "-1")
+
+error_like(function () return #1 end,
+           "^[^:]+:%d+: attempt to get length of a number value",
+           "#1")
+
+is(not 1, false, "not 1")
+
+is(10 + 2, 12, "10 + 2")
+
+is(2 - 10, -8, "2 - 10")
+
+is(3.14 * 1, 3.14, "3.14 * 1")
+
+is(-7 / 0.5, -14, "-7 / 0.5")
+
+type_ok(1 / 0, 'number', "1 / 0")
+
+is(-25 % 3, 2, "-25 % 3")
+
+type_ok(1 % 0, 'number', "1 % 0")
+
+error_like(function () return 10 + true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "10 + true")
+
+error_like(function () return 2 - nil end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "2 - nil")
+
+error_like(function () return 3.14 * false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "3.14 * false")
+
+error_like(function () return -7 / {} end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a table value",
+           "-7 / {}")
+
+error_like(function () return 3 ^ true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "3 ^ true")
+
+error_like(function () return -25 % false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "-25 % false")
+
+error_like(function () return 10 + 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "10 + 'text'")
+
+error_like(function () return 2 - 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "2 - 'text'")
+
+error_like(function () return 3.14 * 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "3.14 * 'text'")
+
+error_like(function () return -7 / 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "-7 / 'text'")
+
+error_like(function () return 25 % 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "25 % 'text'")
+
+error_like(function () return 3 ^ 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "3 ^ 'text'")
+
+is(10 + '2', 12, "10 + '2'")
+
+is(2 - '10', -8, "2 - '10'")
+
+is(3.14 * '1', 3.14, "3.14 * '1'")
+
+is(-7 / '0.5', -14, "-7 / '0.5'")
+
+is(-25 % '3', 2, "-25 % '3'")
+
+is(3 ^ '3', 27, "3 ^ '3'")
+
+is(1 .. 'end', '1end', "1 .. 'end'")
+
+is(1 .. 2, '12', "1 .. 2")
+
+error_like(function () return 1 .. true end,
+           "^[^:]+:%d+: attempt to concatenate a %w+ value",
+           "1 .. true")
+
+is(1.0 == 1, true, "1.0 == 1")
+
+is(1 ~= 2, true, "1 ~= 2")
+
+is(1 == true, false, "1 == true")
+
+is(1 ~= nil, true, "1 ~= nil")
+
+is(1 == '1', false, "1 == '1'")
+
+is(1 ~= '1', true, "1 ~= '1'")
+
+is(1 < 0, false, "1 < 0")
+
+is(1 <= 0, false, "1 <= 0")
+
+is(1 > 0, true, "1 > 0")
+
+is(1 >= 0, true, "1 >= 0")
+
+error_like(function () return 1 < false end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 < false")
+
+error_like(function () return 1 <= nil end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 <= nil")
+
+error_like(function () return 1 > true end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 > true")
+
+error_like(function () return 1 >= {} end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 >= {}")
+
+error_like(function () return 1 < '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 < '0'")
+
+error_like(function () return 1 <= '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 <= '0'")
+
+error_like(function () return 1 > '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 > '0'")
+
+error_like(function () return 1 >= '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 >= '0'")
+
+is(tostring(1000000000), '1000000000', "number 1000000000")
+
+is(tostring(1e9), '1000000000', "number 1e9")
+
+is(tostring(1.0e+9), '1000000000', "number 1.0e+9")
+
+error_like(function () a= 3.14; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = 3.14; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 183 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/105-string.t

@@ -0,0 +1,183 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua string & coercion
+
+=head2 Synopsis
+
+    % prove 105-string.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(51)
+
+is(- '1', -1, "-'1'")
+
+error_like(function () return - 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on .- string value",
+           "-'text'")
+
+is(# 'text', 4, "#'text'")
+
+is(not 'text', false, "not 'text'")
+
+is('10' + 2, 12, "'10' + 2")
+
+is('2' - 10, -8, "'2' - 10")
+
+is('3.14' * 1, 3.14, "'3.14' * 1")
+
+is('-7' / 0.5, -14, "'-7' / 0.5")
+
+is('-25' % 3, 2, "'-25' % 3")
+
+is('3' ^ 3, 27, "'3' ^ 3")
+
+error_like(function () return '10' + true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'10' + true")
+
+error_like(function () return '2' - nil end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "'2' - nil")
+
+error_like(function () return '3.14' * false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'3.14' * false")
+
+error_like(function () return '-7' / {} end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a table value",
+           "'-7' / {}")
+
+error_like(function () return '-25' % false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'-25' % false")
+
+error_like(function () return '3' ^ true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'3' ^ true")
+
+error_like(function () return '10' + 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'10' + 'text'")
+
+error_like(function () return '2' - 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'2' - 'text'")
+
+error_like(function () return '3.14' * 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'3.14' * 'text'")
+
+error_like(function () return '-7' / 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'-7' / 'text'")
+
+error_like(function () return '-25' % 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'-25' % 'text'")
+
+error_like(function () return '3' ^ 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'3' ^ 'text'")
+
+is('10' + '2', 12, "'10' + '2'")
+
+is('2' - '10', -8, "'2' - '10'")
+
+is('3.14' * '1', 3.14, "'3.14' * '1'")
+
+is('-7' / '0.5', -14, "'-7' / '0.5'")
+
+is('-25' % '3', 2, "'-25' % '3'")
+
+is('3' ^ '3', 27, "'3' ^ '3'")
+
+is('1' .. 'end', '1end', "'1' .. 'end'")
+
+is('1' .. 2, '12', "'1' .. 2")
+
+error_like(function () return '1' .. true end,
+           "^[^:]+:%d+: attempt to concatenate a boolean value",
+           "'1' .. true")
+
+is('1.0' == '1', false, "'1.0' == '1'")
+
+is('1' ~= '2', true, "'1' ~= '2'")
+
+is('1' == true, false, "'1' == true")
+
+is('1' ~= nil, true, "'1' ~= nil")
+
+is('1' == 1, false, "'1' == 1")
+
+is('1' ~= 1, true, "'1' ~= 1")
+
+is('1' < '0', false, "'1' < '0'")
+
+is('1' <= '0', false, "'1' <= '0'")
+
+is('1' > '0', true, "'1' > '0'")
+
+is('1' >= '0', true, "'1' >= '0'")
+
+error_like(function () return '1' < false end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' < false")
+
+error_like(function () return '1' <= nil end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' <= nil")
+
+error_like(function () return '1' > true end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' > true")
+
+error_like(function () return '1' >= {} end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' >= {}")
+
+error_like(function () return '1' < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' < 0")
+
+error_like(function () return '1' <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' <= 0")
+
+error_like(function () return '1' > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' > 0")
+
+error_like(function () return '1' > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' >== 0")
+
+a = 'text'
+is(a[1], nil, "index")
+
+error_like(function () a = 'text'; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 125 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/106-table.t

@@ -0,0 +1,125 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua table & coercion
+
+=head2 Synopsis
+
+    % prove 106-table.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(28)
+
+error_like(function () return -{} end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-{}")
+
+is(# {}, 0, "#{}")
+is(# {4,5,6}, 3)
+
+is(not {}, false, "not {}")
+
+error_like(function () return {} + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} + 10")
+
+error_like(function () return {} - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} - 2")
+
+error_like(function () return {} * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} * 3.14")
+
+error_like(function () return {} / 7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} / 7")
+
+error_like(function () return {} % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} % 4")
+
+error_like(function () return {} ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} ^ 3")
+
+error_like(function () return {} .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "{} .. 'end'")
+
+is({} == {}, false, "{} == {}")
+
+t1 = {}
+t2 = {}
+is(t1 == t1, true, "t1 == t1")
+is(t1 == t2, false, "t1 == t2")
+is(t1 ~= t2, true, "t1 ~= t2")
+
+is({} == 1, false, "{} == 1")
+
+is({} ~= 1, true, "{} ~= 1")
+
+error_like(function () return t1 < t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 < t2")
+
+error_like(function () return t1 <= t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 <= t2")
+
+error_like(function () return t1 > t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 > t2")
+
+error_like(function () return t1 >= t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 >= t2")
+
+error_like(function () return {} < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} < 0")
+
+error_like(function () return {} <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} <= 0")
+
+error_like(function () return {} > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} > 0")
+
+error_like(function () return {} >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} >= 0")
+
+t = {}
+is( t[1], nil, "index" )
+t[1] = 42
+is( t[1], 42, "index" )
+
+error_like(function () t = {}; t[nil] = 42 end,
+           "^[^:]+:%d+: table index is nil",
+           "table index is nil")
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 128 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/107-thread.t

@@ -0,0 +1,128 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua thread & coercion
+
+=head2 Synopsis
+
+    % prove 107-thread.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(25)
+
+co = coroutine.create(function () return 1 end)
+
+error_like(function () return -co end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-co")
+
+error_like(function () return #co end,
+           "^[^:]+:%d+: attempt to get length of",
+           "#co")
+
+is(not co, false, "not co")
+
+error_like(function () return co + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co + 10")
+
+error_like(function () return co - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co - 2")
+
+error_like(function () return co * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co * 3.14")
+
+error_like(function () return co / 7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co / 7")
+
+error_like(function () return co % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co % 4")
+
+error_like(function () return co ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co ^ 3")
+
+error_like(function () return co .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "co .. 'end'")
+
+is(co == co, true, "co == co")
+
+co1 = coroutine.create(function () return 1 end)
+co2 = coroutine.create(function () return 2 end)
+is(co1 ~= co2, true, "co1 ~= co2")
+
+is(co == 1, false, "co == 1")
+
+is(co ~= 1, true, "co ~= 1")
+
+error_like(function () return co1 < co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 < co2")
+
+error_like(function () return co1 <= co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 <= co2")
+
+error_like(function () return co1 > co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 > co2")
+
+error_like(function () return co1 >= co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 >= co2")
+
+error_like(function () return co < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co < 0")
+
+error_like(function () return co <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co <= 0")
+
+error_like(function () return co > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co > 0")
+
+error_like(function () return co > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co >= 0")
+
+error_like(function () a = co[1] end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () co[1] = 1 end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+t = {}
+t[co] = true
+ok(t[co])
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 125 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/108-userdata.t

@@ -0,0 +1,125 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua userdata & coercion
+
+=head2 Synopsis
+
+    % prove 108-userdata.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(25)
+
+u = io.stdin
+
+error_like(function () return -u end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-u")
+
+error_like(function () return #u end,
+           "^[^:]+:%d+: attempt to get length of",
+           "#u")
+
+is(not u, false, "not u")
+
+error_like(function () return u + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u + 10")
+
+error_like(function () return u - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u - 2")
+
+error_like(function () return u * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u * 3.14")
+
+error_like(function () return u / 7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u / 7")
+
+error_like(function () return u % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u % 4")
+
+error_like(function () return u ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u ^ 3")
+
+error_like(function () return u .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "u .. 'end'")
+
+is(u == u, true, "u == u")
+
+v = io.stdout
+is(u ~= v, true, "u ~= v")
+
+is(u == 1, false, "u == 1")
+
+is(u ~= 1, true, "u ~= 1")
+
+error_like(function () return u < v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u < v")
+
+error_like(function () return u <= v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u <= v")
+
+error_like(function () return u > v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u > v")
+
+error_like(function () return u >= v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u >= v")
+
+error_like(function () return u < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u < 0")
+
+error_like(function () return u <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u <= 0")
+
+error_like(function () return u > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u > 0")
+
+error_like(function () return u > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u >= 0")
+
+is(u[1], nil, "index")
+
+error_like(function () u[1] = 1 end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+t = {}
+t[u] = true
+ok(t[u])
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 104 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/200-examples.t

@@ -0,0 +1,104 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 some Lua code examples
+
+=head2 Synopsis
+
+    % prove 200-examples.t
+
+=head2 Description
+
+First tests in order to check infrastructure.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(5)
+
+function factorial (n)
+    if n == 0 then
+        return 1
+    else
+        return n * factorial(n-1)
+    end
+end
+is(factorial(7), 5040, "factorial (recursive)")
+
+local function local_factorial (n)
+    if n == 0 then
+        return 1
+    else
+        return n * local_factorial(n-1)
+    end
+end
+is(local_factorial(7), 5040, "factorial (recursive)")
+
+function loop_factorial (n)
+    local a = 1
+    for i = 1, n, 1 do
+        a = a*i
+    end
+    return a
+end
+is(loop_factorial(7), 5040, "factorial (loop)")
+
+function iter_factorial (n)
+    local function iter (product, counter)
+        if counter > n then
+            return product
+        else
+            return iter(counter*product, counter+1)
+        end
+    end
+    return iter(1, 1)
+end
+is(iter_factorial(7), 5040, "factorial (iter)")
+
+--[[
+
+  Knuth's "man or boy" test.
+  See http://en.wikipedia.org/wiki/Man_or_boy_test
+
+]]
+
+local function A (k, x1, x2, x3, x4, x5)
+    local function B ()
+        k = k - 1
+        return A(k, B, x1, x2, x3, x4)
+    end
+    if k <= 0 then
+        return x4() + x5()
+    else
+        return B()
+    end
+end
+
+is(A(10,
+        function () return 1 end,
+        function () return -1 end,
+        function () return -1 end,
+        function () return 1 end,
+        function () return 0 end),
+   -67,
+   "man or boy"
+)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 125 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/201-assign.t

@@ -0,0 +1,125 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua assignment
+
+=head2 Synopsis
+
+    % prove 201-assign.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.3 "Assignment",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.3>.
+
+See "Programming in Lua", section 4.1 "Assignment".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(38)
+
+is(b, nil, "global variable")
+b = 10
+is(b, 10)
+if jit then
+    skip("LuaJIT intentional. _ENV.", 3)
+else
+    is(_ENV.b, 10, "_ENV")
+    is(_G, _ENV, "_G")
+    error_like([[ _ENV = nil; b = 20 ]],
+               "^[^:]+:%d+: attempt to index a nil value")
+end
+b = nil
+is(b, nil)
+
+a = {}
+i = 3
+i, a[i] = i+1, 20
+-- this behavior is undefined
+-- see http://lua-users.org/lists/lua-l/2006-06/msg00378.html
+-- is(i, 4, "check eval")
+-- is(a[3], 20)
+
+x = 1.
+y = 2.
+x, y = y, x -- swap
+is(x, 2, "check swap")
+is(y, 1)
+
+a, b, c = 0, 1
+is(a, 0, "check padding")
+is(b, 1)
+is(c, nil)
+a, b = a+1, b+1, a+b
+is(a, 1)
+is(b, 2)
+a, b, c = 0
+is(a, 0)
+is(b, nil)
+is(c, nil)
+
+function f() return 1, 2 end
+a, b, c, d = f()
+is(a, 1, "adjust with function")
+is(b, 2)
+is(c, nil)
+is(d, nil)
+
+function f() print('# f') end
+a = 2
+a, b, c = f(), 3
+is(a, nil, "padding with function")
+is(b, 3)
+is(c, nil)
+
+local my_i = 1
+is(my_i, 1, "local variable")
+local my_i = 2
+is(my_i, 2)
+
+local i = 1
+local j = i
+is(i, 1, "local variable")
+is(j, 1)
+j = 2
+is(i, 1)
+is(j, 2)
+
+local function f(x) return 2*x end
+is(f(2), 4, "param & result of function")
+a = 2
+a = f(a)
+is(a, 4)
+local b = 2
+b = f(b)
+is(b, 4)
+
+local n1 = 1
+local n2 = 2
+local n3 = 3
+local n4 = 4
+n1,n2,n3,n4 = n4,n3,n2,n1
+is(n1, 4, "assignment list swap values")
+is(n2, 3)
+is(n3, 2)
+is(n4, 1)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 111 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/202-expr.t

@@ -0,0 +1,111 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua expression
+
+=head2 Synopsis
+
+    % prove 202-expr.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.4 "Expressions",
+L<http://www.lua.org/manual/5.2/manual.html#3.4>.
+
+See "Programming in Lua", section 3 "Expressions".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(39)
+
+x = math.pi
+is(x - x%0.01, 3.14, "modulo")
+
+a = {}; a.x = 1; a.y = 0;
+b = {}; b.x = 1; b.y = 0;
+c = a
+is(a == c, true, "relational op (by reference)")
+is(a ~= b, true)
+
+is('0' == 0, false, "relational op")
+is(2 < 15, true)
+is('2' < '15', false)
+
+error_like(function () return 2 < '15' end,
+           "compare",
+           "relational op")
+
+error_like(function () return '2' < 15 end,
+           "compare",
+           "relational op")
+
+is(4 and 5, 5, "logical op")
+is(nil and 13, nil)
+is(false and 13, false)
+is(4 or 5, 4)
+is(false or 5, 5)
+is(false or 'text', 'text')
+
+is(10 or 20, 10, "logical op")
+is(10 or error(), 10)
+is(nil or 'a', 'a')
+is(nil and 10, nil)
+is(false and error(), false)
+is(false and nil, false)
+is(false or nil, nil)
+is(10 and 20, 20)
+
+is(not nil, true, "logical not")
+is(not false, true)
+is(not 0, false)
+is(not not nil, false)
+is(not 'text', false)
+a = {}
+is(not a, false)
+
+is("Hello " .. "World", "Hello World", "concatenation")
+is(0 .. 1, '01')
+a = "Hello"
+is(a .. " World", "Hello World")
+is(a, "Hello")
+
+is('10' + 1, 11, "coercion")
+is('-5.3' * '2', -10.6)
+is(10 .. 20, '1020')
+is(tostring(10), '10')
+is(10 .. '', '10')
+
+error_like(function () return 'hello' + 1 end,
+           "perform arithmetic",
+           "no coercion")
+
+error_like(function ()
+                local function first() return 1 end
+                local function limit() return end
+                local function step()  return 2 end
+                for i = first(), limit(), step() do
+                    print(i)
+                end
+           end,
+           "^[^:]+:%d+: 'for' limit must be a number",
+           "for tonumber")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 122 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/203-lexico.t

@@ -0,0 +1,122 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Lexicography
+
+=head2 Synopsis
+
+    % prove 203-lexico.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.1 "Lexical Conventions",
+L<http://www.lua.org/manual/5.2/manual.html#3.1>.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(40)
+
+is("\65", "A")
+is("\065", "A")
+is("\x41", "A")
+is("\x3d", "=")
+is("\x3D", "=")
+
+is(string.byte("\a"), 7)
+is(string.byte("\b"), 8)
+is(string.byte("\f"), 12)
+is(string.byte("\n"), 10)
+is(string.byte("\r"), 13)
+is(string.byte("\t"), 9)
+is(string.byte("\v"), 11)
+is(string.byte("\\"), 92)
+
+is(string.len("A\0B"), 3)
+
+f, msg = load [[a = "A\300"]]
+like(msg, "^[^:]+:%d+: .- escape .- near")
+
+f, msg = load [[a = "A\xyz"]]
+like(msg, "^[^:]+:%d+: .- near")
+
+f, msg = load [[a = "A\Z"]]
+like(msg, "^[^:]+:%d+: .- escape .- near")
+
+f, msg = load [[a = " unfinished string ]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load [[a = " unfinished string
+]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load [[a = " unfinished string \
+]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load [[a = " unfinished string \]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load "a = [[ unfinished long string "
+like(msg, "^[^:]+:%d+: unfinished long string near")
+
+f, msg = load "a = [== invalid long string delimiter "
+like(msg, "^[^:]+:%d+: invalid long string delimiter near")
+
+a = 'alo\n123"'
+is('alo\n123"', a)
+is("alo\n123\"", a)
+is('\97lo\10\04923"', a)
+is([[alo
+123"]], a)
+is([==[
+alo
+123"]==], a)
+is("alo\n\z
+123\"", a)
+
+f, msg = load [[a = " escape \z unauthorized
+new line" ]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+is(3.0, 3)
+is(314.16e-2, 3.1416)
+is(0.31416E1, 3.1416)
+is(0xff, 255)
+is(0x56, 86)
+is(0x0.1E, 0x1E / 0x100)        -- 0.1171875
+is(0xA23p-4, 0xA23 / (2^4))     -- 162.1875
+is(0X1.921FB54442D18P+1, (1 + 0x921FB54442D18/0x10000000000000) * 2)
+
+f, msg = load [[a = 12e34e56]]
+like(msg, "^[^:]+:%d+: malformed number near")
+
+--[===[
+--[[
+--[=[
+    nested long comments
+--]=]
+--]]
+--]===]
+
+f, msg = load "  --[[ unfinished long comment "
+like(msg, "^[^:]+:%d+: unfinished long comment near")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 106 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/204-grammar.t

@@ -0,0 +1,106 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2010-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Grammar
+
+=head2 Synopsis
+
+    % prove 204-grammar.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 9 "The Complete Syntax of Lua",
+L<http://www.lua.org/manual/5.2/manual.html#9>.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(6)
+
+--[[ empty statement ]]
+f, msg = load [[; a = 1]]
+type_ok(f, 'function', "empty statement")
+
+--[[ orphan break ]]
+f, msg = load [[
+function f()
+    print "before"
+    do
+        print "inner"
+        break
+    end
+    print "after"
+end
+]]
+if jit then
+    like(msg, "^[^:]+:%d+: no loop to break", "orphan break")
+else
+    like(msg, "^[^:]+:%d+: <break> at line 5 not inside a loop", "orphan break")
+end
+
+--[[ break anywhere ]]
+lives_ok( [[
+function f()
+    print "before"
+    while true do
+        print "inner"
+        break
+        print "break"
+    end
+    print "after"
+end
+]], "break anywhere")
+
+--[[ goto ]]
+f, msg = load [[
+::label::
+goto unknown
+]]
+if jit then
+    like(msg, ":%d+: undefined label 'unknown'", "unknown goto")
+else
+    like(msg, ":%d+: no visible label 'unknown' for <goto> at line %d+", "unknown goto")
+end
+
+f, msg = load [[
+::label::
+goto label
+::label::
+]]
+if jit then
+    like(msg, ":%d+: duplicate label 'label'", "duplicate label")
+else
+    like(msg, ":%d+: label 'label' already defined on line %d+", "duplicate label")
+end
+
+f, msg = load [[
+::e::
+goto f
+local x
+::f::
+goto e
+]]
+if jit then
+    like(msg, ":%d+: <goto f> jumps into the scope of local 'x'", "bad goto")
+else
+    like(msg, ":%d+: <goto f> at line %d+ jumps into the scope of local 'x'", "bad goto")
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 83 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/211-scope.t

@@ -0,0 +1,83 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua scope
+
+=head2 Synopsis
+
+    % prove 211-scope.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.5 "Visibility Rules",
+L<http://www.lua.org/manual/5.2/manual.html#3.5>.
+
+See "Programming in Lua", section 4.2 "Local Variables and Blocks".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(10)
+
+--[[ scope ]]
+x = 10
+do
+    local x = x
+    is(x, 10, "scope")
+    x = x + 1
+    do
+        local x = x + 1
+        is(x, 12)
+    end
+    is(x, 11)
+end
+is(x, 10)
+
+--[[ scope ]]
+x = 10
+local i = 1
+
+while i<=x do
+    local x = i*2
+--    print(x)
+    i = i + 1
+end
+
+if i > 20 then
+    local x
+    x = 20
+    nok("scope")
+else
+    is(x, 10, "scope")
+end
+
+is(x, 10)
+
+--[[ scope ]]
+local a, b = 1, 10
+if a < b then
+    is(a, 1, "scope")
+    local a
+    is(a, nil)
+end
+is(a, 1)
+is(b, 10)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 268 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/212-function.t

@@ -0,0 +1,268 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua functions
+
+=head2 Synopsis
+
+    % prove 212-function.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.4.10 "Function Definitions",
+L<http://www.lua.org/manual/5.2/manual.html#3.4.10>.
+
+See "Programming in Lua", section 5 "Functions".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(63)
+
+--[[ add ]]
+function add (a)
+    local sum = 0
+    for i,v in ipairs(a) do
+        sum = sum + v
+    end
+    return sum
+end
+
+t = { 10, 20, 30, 40 }
+is(add(t), 100, "add")
+
+--[[ f ]]
+function f(a, b) return a or b end
+
+is(f(3), 3, "f")
+is(f(3, 4), 3)
+is(f(3, 4, 5), 3)
+
+--[[ incCount ]]
+count = 0
+
+function incCount (n)
+    n = n or 1
+    count = count + n
+end
+
+is(count, 0, "inCount")
+incCount()
+is(count, 1)
+incCount(2)
+is(count, 3)
+incCount(1)
+is(count, 4)
+
+--[[ maximum ]]
+function maximum (a)
+    local mi = 1                -- maximum index
+    local m = a[mi]             -- maximum value
+    for i,val in ipairs(a) do
+        if val > m then
+            mi = i
+            m = val
+        end
+    end
+    return m, mi
+end
+
+local m, mi = maximum({8,10,23,12,5})
+is(m, 23, "maximum")
+is(mi, 3)
+
+--[[ call by value ]]
+function f (n)
+    n = n - 1
+    return n
+end
+
+a = 12
+is(a, 12, "call by value")
+b = f(a)
+is(b, 11)
+is(a, 12)
+c = f(12)
+is(c, 11)
+is(a, 12)
+
+--[[ call by ref ]]
+function f (t)
+    t[#t+1] = 'end'
+    return t
+end
+
+a = { 'a', 'b', 'c' }
+is(table.concat(a, ','), 'a,b,c', "call by ref")
+b = f(a)
+is(table.concat(b, ','), 'a,b,c,end')
+is(table.concat(a, ','), 'a,b,c,end')
+
+--[[ var args ]]
+local function g(a, b, ...)
+    local arg = {...}
+    is(a, 3, "vararg")
+    is(b, nil)
+    is(#arg, 0)
+    is(arg[1], nil)
+end
+g(3)
+
+local function g(a, b, ...)
+    local arg = {...}
+    is(a, 3)
+    is(b, 4)
+    is(#arg, 0)
+    is(arg[1], nil)
+end
+g(3, 4)
+
+local function g(a, b, ...)
+    local arg = {...}
+    is(a, 3)
+    is(b, 4)
+    is(#arg, 2)
+    is(arg[1], 5)
+    is(arg[2], 8)
+end
+g(3, 4, 5, 8)
+
+--[[ var args ]]
+local function g(a, b, ...)
+    local c, d, e = ...
+    is(a, 3, "var args")
+    is(b, nil)
+    is(c, nil)
+    is(d, nil)
+    is(e, nil)
+end
+g(3)
+
+local function g(a, b, ...)
+    local c, d, e = ...
+    is(a, 3)
+    is(b, 4)
+    is(c, nil)
+    is(d, nil)
+    is(e, nil)
+end
+g(3, 4)
+
+local function g(a, b, ...)
+    local c, d, e = ...
+    is(a, 3)
+    is(b, 4)
+    is(c, 5)
+    is(d, 8)
+    is(e, nil)
+end
+
+--[[ var args ]]
+local function g(a, b, ...)
+    is(#{a, b, ...}, 1, "varargs")
+end
+g(3)
+
+local function g(a, b, ...)
+    is(#{a, b, ...}, 2)
+end
+g(3, 4)
+
+local function g(a, b, ...)
+    is(#{a, b, ...}, 4)
+end
+g(3, 4, 5, 8)
+
+--[[ var args ]]
+function f() return 1, 2 end
+function g() return 'a', f() end
+function h() return f(), 'b' end
+function k() return 'c', (f()) end
+
+x, y = f()
+is(x, 1, "var args")
+is(y, 2)
+x, y, z = g()
+is(x, 'a')
+is(y, 1)
+is(z, 2)
+x, y = h()
+is(x, 1)
+is(y, 'b')
+x, y, z = k()
+is(x, 'c')
+is(y, 1)
+is(z, nil)
+
+
+--[[ invalid var args ]]
+f, msg = load [[
+function f ()
+    print(...)
+end
+]]
+like(msg, "^[^:]+:%d+: cannot use '...' outside a vararg function", "invalid var args")
+
+--[[ tail call ]]
+output = {}
+local function foo (n)
+    output[#output+1] = n
+    if n > 0 then
+        return foo(n -1)
+    end
+    return 'end', 0
+end
+
+eq_array({foo(3)}, {'end', 0}, "tail call")
+eq_array(output, {3, 2, 1, 0})
+
+--[[ no tail call ]]
+output = {}
+local function foo (n)
+    output[#output+1] = n
+    if n > 0 then
+        return (foo(n -1))
+    end
+    return 'end', 0
+end
+
+is(foo(3), 'end', "no tail call")
+eq_array(output, {3, 2, 1, 0})
+
+--[[ no tail call ]]
+output = {}
+local function foo (n)
+    output[#output+1] = n
+    if n > 0 then
+        foo(n -1)
+    end
+end
+
+is(foo(3), nil, "no tail call")
+eq_array(output, {3, 2, 1, 0})
+
+--[[ sub name ]]
+local function f () return 1 end
+is(f(), 1, "sub name")
+
+local function f () return 2 end
+is(f(), 2)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 98 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/213-closure.t

@@ -0,0 +1,98 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua closures
+
+=head2 Synopsis
+
+    % prove 213-closure.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.5 "Visibility Rules",
+L<http://www.lua.org/manual/5.2/manual.html#3.5>.
+
+See "Programming in Lua", section 6.1 "Closures".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(15)
+
+--[[ inc ]]
+local counter = 0
+
+function inc (x)
+    counter = counter + x
+    return counter
+end
+
+is(inc(1), 1, "inc")
+is(inc(2), 3)
+
+--[[ newCounter ]]
+function newCounter ()
+    local i = 0
+    return function ()  -- anonymous function
+               i = i + 1
+               return i
+           end
+end
+
+c1 = newCounter()
+is(c1(), 1, "newCounter")
+is(c1(), 2)
+
+c2 = newCounter()
+is(c2(), 1)
+is(c1(), 3)
+is(c2(), 2)
+
+--[[
+The loop creates ten closures (that is, ten instances of the anonymous
+function). Each of these closures uses a different y variable, while all
+of them share the same x.
+]]
+a = {}
+local x = 20
+for i=1,10 do
+    local y = 0
+    a[i] = function () y=y+1; return x+y end
+end
+
+is(a[1](), 21, "ten closures")
+is(a[1](), 22)
+is(a[2](), 21)
+
+
+--[[ add ]]
+function add(x)
+    return function (y) return (x + y) end
+end
+
+f = add(2)
+type_ok(f, 'function', "add")
+is(f(10), 12)
+g = add(5)
+is(g(1), 6)
+is(g(10), 15)
+is(f(1), 3)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 193 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/214-coroutine.t

@@ -0,0 +1,193 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua coroutines
+
+=head2 Synopsis
+
+    % prove 214-coroutine.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 2.6 "Coroutines",
+L<http://www.lua.org/manual/5.2/manual.html#2.6>.
+
+See "Programming in Lua", section 9 "Coroutines".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(30)
+
+--[[ ]]
+output = {}
+
+function foo1 (a)
+    output[#output+1] = "foo " .. a
+    return coroutine.yield(2*a)
+end
+
+co = coroutine.create(function (a,b)
+        output[#output+1] = "co-body " .. a .." " .. b
+        local r = foo1(a+1)
+        output[#output+1] = "co-body " .. r
+        local r, s = coroutine.yield(a+b, a-b)
+        output[#output+1] = "co-body " .. r .. " " .. s
+        return b, 'end'
+    end)
+
+eq_array({coroutine.resume(co, 1, 10)}, {true, 4}, "foo1")
+eq_array({coroutine.resume(co, 'r')}, {true, 11, -9})
+eq_array({coroutine.resume(co, "x", "y")}, {true, 10, 'end'})
+eq_array({coroutine.resume(co, "x", "y")}, {false, "cannot resume dead coroutine"})
+eq_array(output, {
+    'co-body 1 10',
+    'foo 2',
+    'co-body r',
+    'co-body x y',
+})
+
+--[[ ]]
+co = coroutine.create(function ()
+        output = 'hi'
+    end)
+like(co, '^thread: 0?[Xx]?%x+$', "basics")
+
+is(coroutine.status(co), 'suspended')
+output = ''
+coroutine.resume(co)
+is(output, 'hi')
+is(coroutine.status(co), 'dead')
+
+error_like(function () coroutine.create(true) end,
+           "^[^:]+:%d+: bad argument #1 to 'create' %(function expected, got boolean%)")
+
+error_like(function () coroutine.resume(true) end,
+           "^[^:]+:%d+: bad argument #1 to 'resume' %(coroutine expected, got boolean%)")
+
+error_like(function () coroutine.status(true) end,
+           "^[^:]+:%d+: bad argument #1 to 'status' %(coroutine expected, got boolean%)")
+
+--[[ ]]
+output = {}
+co = coroutine.create(function ()
+        for i=1,10 do
+            output[#output+1] = i
+            coroutine.yield()
+        end
+    end)
+
+coroutine.resume(co)
+thr, ismain = coroutine.running(co)
+type_ok(thr, 'thread', "running")
+is(ismain, true, "running")
+is(coroutine.status(co), 'suspended', "basics")
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+eq_array({coroutine.resume(co)}, {false, 'cannot resume dead coroutine'})
+eq_array(output, {1,2,3,4,5,6,7,8,9,10})
+
+--[[ ]]
+co = coroutine.create(function (a,b)
+        coroutine.yield(a + b, a - b)
+    end)
+
+eq_array({coroutine.resume(co, 20, 10)}, {true, 30, 10}, "basics")
+
+--[[ ]]
+co = coroutine.create(function ()
+        return 6, 7
+    end)
+
+eq_array({coroutine.resume(co)}, {true, 6, 7}, "basics")
+
+--[[ ]]
+co = coroutine.wrap(function(...)
+  return pcall(function(...)
+    return coroutine.yield(...)
+  end, ...)
+end)
+eq_array({co("Hello")}, {"Hello"})
+eq_array({co("World")}, {true, "World"})
+
+--[[ ]]
+co = coroutine.wrap(function(...)
+  function backtrace ()
+    return 'not a back trace'
+  end
+  return xpcall(function(...)
+    return coroutine.yield(...)
+  end, backtrace, ...)
+end)
+eq_array({co("Hello")}, {"Hello"})
+eq_array({co("World")}, {true, "World"})
+
+
+--[[ ]]
+local output = {}
+co = coroutine.wrap(function()
+  while true do
+    local t = setmetatable({}, {
+      __eq = function(...)
+        return coroutine.yield(...)
+      end}
+    )
+    local t2 = setmetatable({}, getmetatable(t))
+    output[#output+1] = t == t2
+  end
+end)
+co()
+co(true)
+co(false)
+eq_array(output, {true, false})
+
+--[[ ]]
+co = coroutine.wrap(print)
+type_ok(co, 'function')
+
+error_like(function () coroutine.wrap(true) end,
+           "^[^:]+:%d+: bad argument #1 to 'wrap' %(function expected, got boolean%)")
+
+co = coroutine.wrap(function () error"in coro" end)
+error_like(function () co() end,
+           "^[^:]+:%d+: in coro$")
+
+--[[ ]]
+co = coroutine.create(function ()
+        error "in coro"
+    end)
+r, msg = coroutine.resume(co)
+is(r, false)
+like(msg, "in coro$")
+
+--[[ ]]
+error_like(function () coroutine.yield() end,
+           "attempt to yield")
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 112 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/221-table.t

@@ -0,0 +1,112 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua tables
+
+=head2 Synopsis
+
+    % prove 221-table.t
+
+=head2 Description
+
+See "Programming in Lua", section 2.5 "Tables".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(25)
+
+--[[ ]]
+a = {}
+k = 'x'
+a[k] = 10
+a[20] = 'great'
+is(a['x'], 10)
+k = 20
+is(a[k], 'great')
+a['x'] = a ['x'] + 1
+is(a['x'], 11)
+
+--[[ ]]
+a = {}
+a['x'] = 10
+b = a
+is(b['x'], 10)
+b['x'] = 20
+is(a['x'], 20)
+a = nil
+b = nil
+
+--[[ ]]
+a = {}
+for i=1,1000 do a[i] = i*2 end
+is(a[9], 18)
+a['x'] = 10
+is(a['x'], 10)
+is(a['y'], nil)
+
+--[[ ]]
+a = {}
+x = 'y'
+a[x] = 10
+is(a[x], 10)
+is(a.x, nil)
+is(a.y, 10)
+
+--[[ ]]
+i = 10; j = '10'; k = '+10'
+a = {}
+a[i] = "one value"
+a[j] = "another value"
+a[k] = "yet another value"
+is(a[j], "another value")
+is(a[k], "yet another value")
+is(a[tonumber(j)], "one value")
+is(a[tonumber(k)], "one value")
+
+t = { {'a','b','c'}, 10 }
+is(t[2], 10)
+is(t[1][3], 'c')
+t[1][1] = 'A'
+is(table.concat(t[1],','), 'A,b,c')
+
+--[[ ]]
+local tt
+tt = { {'a','b','c'}, 10 }
+is(tt[2], 10)
+is(tt[1][3], 'c')
+tt[1][1] = 'A'
+is(table.concat(tt[1],','), 'A,b,c')
+
+--[[ ]]
+a = {}
+error_like(function () a() end,
+           "^[^:]+:%d+: attempt to call")
+
+--[[ ]]
+local tt
+tt = { {'a','b','c'}, 10 }
+is((tt)[2], 10)
+is((tt[1])[3], 'c');
+(tt)[1][2] = 'B'
+(tt[1])[3] = 'C'
+is(table.concat(tt[1],','), 'a,B,C')
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 85 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/222-constructor.t

@@ -0,0 +1,85 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Table Constructors
+
+=head2 Synopsis
+
+    % prove 222-constructor.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.4.8 "Table Constructors",
+L<http://www.lua.org/manual/5.2/manual.html#3.4.8>.
+
+See "Programming in Lua", section 3.6 "Table Constructors".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(14)
+
+--[[ list-style init ]]
+days = {'Sunday', 'Monday', 'Tuesday', 'Wednesday',
+        'Thursday', 'Friday', 'Saturday'}
+is(days[4], 'Wednesday', "list-style init")
+is(#days, 7)
+
+--[[ record-style init ]]
+a = {x=0, y=0}
+is(a.x, 0, "record-style init")
+is(a.y, 0)
+
+--[[ ]]
+w = {x=0, y=0, label='console'}
+x = {0, 1, 2}
+w[1] = "another field"
+x.f = w
+is(w['x'], 0, "ctor")
+is(w[1], "another field")
+is(x.f[1], "another field")
+w.x = nil
+
+--[[ mix record-style and list-style init ]]
+polyline = {color='blue', thickness=2, npoints=4,
+             {x=0,   y=0},
+             {x=-10, y=0},
+             {x=-10, y=1},
+             {x=0,   y=1}
+           }
+is(polyline[2].x, -10, "mix record-style and list-style init")
+
+--[[ ]]
+opnames = {['+'] = 'add', ['-'] = 'sub',
+           ['*'] = 'mul', ['/'] = 'div'}
+i = 20; s = '-'
+a = {[i+0] = s, [i+1] = s..s, [i+2] = s..s..s}
+is(opnames[s], 'sub', "ctor")
+is(a[22], '---')
+
+--[[ ]]
+local function f() return 10, 20 end
+
+eq_array({f()}, {10, 20}, "ctor")
+eq_array({'a', f()}, {'a', 10, 20})
+eq_array({f(), 'b'}, {10, 'b'})
+eq_array({'c', (f())}, {'c', 10})
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 196 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/223-iterator.t

@@ -0,0 +1,196 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua iterators
+
+=head2 Synopsis
+
+    % prove 223-iterator.t
+
+=head2 Description
+
+See "Programming in Lua", section 7 "Iterators and the Generic for" and
+section 9.3 "Coroutines as Iterators".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(8)
+
+--[[ list_iter ]]
+function list_iter (t)
+    local i = 0
+    local n = #t
+    return function ()
+               i = i + 1
+               if i <= n then
+                   return t[i]
+               else
+                   return nil
+               end
+           end
+end
+
+t = {10, 20, 30}
+output = {}
+for element in list_iter(t) do
+    output[#output+1] = element
+end
+eq_array(output, t, "list_iter")
+
+--[[ values ]]
+function values (t)
+    local i = 0
+    return function ()
+               i = i + 1
+               return t[i]
+           end
+end
+
+t = {10, 20, 30}
+output = {}
+for element in values(t) do
+    output[#output+1] = element
+end
+eq_array(output, t, "values")
+
+--[[ emul ipairs ]]
+local function iter (a, i)
+    i = i + 1
+    local v = a[i]
+    if v then
+        return i, v
+    end
+end
+
+local function my_ipairs (a)
+    return iter, a, 0
+end
+
+a = {'one', 'two', 'three'}
+output = {}
+for i, v in my_ipairs(a) do
+    output[#output+1] = i
+    output[#output+1] = v
+end
+eq_array(output, {1, 'one', 2, 'two', 3, 'three'}, "emul ipairs")
+
+--[[ emul pairs ]]
+local function my_pairs (t)
+    return next, t, nil
+end
+
+a = {'one', 'two', 'three'}
+output = {}
+for k, v in my_pairs(a) do
+    output[#output+1] = k
+    output[#output+1] = v
+end
+eq_array(output, {1, 'one', 2, 'two', 3, 'three'}, "emul ipairs")
+
+--[[ with next ]]
+t = {'one', 'two', 'three'}
+output = {}
+for k, v in next, t do
+    output[#output+1] = k
+    output[#output+1] = v
+end
+eq_array(output, {1, 'one', 2, 'two', 3, 'three'}, "with next")
+
+--[[ permutations ]]
+function permgen (a, n)
+    n = n or #a         -- default for 'n' is size of 'a'
+    if n <= 1 then      -- nothing to change?
+        coroutine.yield(a)
+    else
+        for i=1,n do
+            -- put i-th element as the last one
+            a[n], a[i] = a[i], a[n]
+            -- generate all permutations of the other elements
+            permgen(a, n - 1)
+            -- restore i-th element
+            a[n], a[i] = a[i], a[n]
+        end
+    end
+end
+
+function permutations (a)
+    local co = coroutine.create(function () permgen(a) end)
+    return function ()  -- iterator
+               local code, res = coroutine.resume(co)
+               return res
+           end
+end
+
+output = {}
+for p in permutations{'a', 'b', 'c'} do
+    output[#output+1] = table.concat(p, ' ')
+end
+eq_array(output, {'b c a','c b a','c a b','a c b','b a c','a b c'}, "permutations")
+
+
+--[[ permutations with wrap ]]
+function permgen (a, n)
+    n = n or #a         -- default for 'n' is size of 'a'
+    if n <= 1 then      -- nothing to change?
+        coroutine.yield(a)
+    else
+        for i=1,n do
+            -- put i-th element as the last one
+            a[n], a[i] = a[i], a[n]
+            -- generate all permutations of the other elements
+            permgen(a, n - 1)
+            -- restore i-th element
+            a[n], a[i] = a[i], a[n]
+        end
+    end
+end
+
+function permutations (a)
+    return coroutine.wrap(function () permgen(a) end)
+end
+
+output = {}
+for p in permutations{'a', 'b', 'c'} do
+    output[#output+1] = table.concat(p, ' ')
+end
+eq_array(output, {'b c a','c b a','c a b','a c b','b a c','a b c'}, "permutations with wrap")
+
+--[[ fibo ]]
+function fibogen ()
+    local x, y = 0, 1
+    while true do
+        coroutine.yield(x)
+        x, y = y, x + y
+    end
+end
+
+function fibo ()
+    return coroutine.wrap(function () fibogen() end)
+end
+
+output = {}
+for n in fibo() do
+    output[#output+1] = n
+    if n > 30 then break end
+end
+eq_array(output, {0, 1, 1, 2, 3, 5, 8, 13, 21, 34}, "fibo")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 533 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/231-metatable.t

@@ -0,0 +1,533 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua metatables
+
+=head2 Synopsis
+
+    % prove 231-metatable.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 2.4 "Metatables and Metamethods",
+L<http://www.lua.org/manual/5.2/manual.html#2.4>.
+
+See "Programming in Lua", section 13 "Metatables and Metamethods".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(96)
+
+t = {}
+is(getmetatable(t), nil, "metatable")
+t1 = {}
+is(setmetatable(t, t1), t)
+is(getmetatable(t), t1)
+is(setmetatable(t, nil), t)
+error_like(function () setmetatable(t, true) end,
+           "^[^:]+:%d+: bad argument #2 to 'setmetatable' %(nil or table expected.+%)")
+
+mt = {}
+mt.__metatable = "not your business"
+setmetatable(t, mt)
+is(getmetatable(t), "not your business", "protected metatable")
+error_like(function () setmetatable(t, {}) end,
+           "^[^:]+:%d+: cannot change a protected metatable")
+
+is(getmetatable('').__index, string, "metatable for string")
+
+is(getmetatable(nil), nil, "metatable for nil")
+is(getmetatable(false), nil, "metatable for boolean")
+is(getmetatable(2), nil, "metatable for number")
+is(getmetatable(print), nil, "metatable for function")
+
+t = {}
+mt = { __tostring=function () return '__TABLE__' end }
+setmetatable(t, mt)
+is(tostring(t), '__TABLE__', "__tostring")
+
+mt = {}
+a = nil
+function mt.__tostring () a = "return nothing" end
+setmetatable(t, mt)
+is(tostring(t), nil, "__tostring no-output")
+is(a, "return nothing")
+error_like(function () print(t) end,
+           "^[^:]+:%d+: 'tostring' must return a string to 'print'")
+
+mt.__tostring = function () return '__FIRST__', 2 end
+setmetatable(t, mt)
+is(tostring(t), '__FIRST__', "__tostring too-many-output")
+
+t = {}
+t.mt = {}
+setmetatable(t, t.mt)
+t.mt.__tostring = "not a function"
+error_like(function () tostring(t) end,
+           "attempt to call",
+           "__tostring invalid")
+
+t = {}
+mt = { __len=function () return 42 end }
+setmetatable(t, mt)
+is(#t, 42, "__len")
+
+t = {}
+mt = { __len=function () return nil end }
+setmetatable(t, mt)
+if jit then
+    todo("LuaJIT TODO. __len.", 1)
+end
+error_like(function () print(table.concat(t)) end,
+           "object length is not a number",
+           "__len invalid")
+
+t = {}
+mt = {
+  __tostring=function () return 't' end,
+  __concat=function (op1, op2)
+        return tostring(op1) .. '|' .. tostring(op2)
+  end,
+}
+setmetatable(t, mt)
+is(t .. t .. t .. 4 ..'end', "t|t|t|4end", "__concatx")
+
+
+--[[ Cplx ]]
+Cplx = {}
+Cplx.mt = {}
+
+function Cplx.new (re, im)
+    local c = {}
+    setmetatable(c, Cplx.mt)
+    c.re = tonumber(re)
+    if im == nil then
+        c.im = 0.0
+    else
+        c.im = tonumber(im)
+    end
+    return c
+end
+
+function Cplx.mt.__tostring (c)
+    return '(' .. c.re .. ',' .. c.im .. ')'
+end
+
+function Cplx.mt.__add (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local r = Cplx.new(a.re + b.re, a.im + b.im)
+    return r
+end
+
+c1 = Cplx.new(1, 3)
+c2 = Cplx.new(2, -1)
+
+is(tostring(c1 + c2), '(3,2)', "cplx __add")
+is(tostring(c1 + 3), '(4,3)')
+is(tostring(-2 + c1), '(-1,3)')
+is(tostring(c1 + '3'), '(4,3)')
+is(tostring('-2' + c1), '(-1,3)')
+
+function Cplx.mt.__sub (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local r = Cplx.new(a.re - b.re, a.im - b.im)
+    return r
+end
+
+is(tostring(c1 - c2), '(-1,4)', "cplx __sub")
+is(tostring(c1 - 3), '(-2,3)')
+is(tostring(-2 - c1), '(-3,-3)')
+is(tostring(c1 - '3'), '(-2,3)')
+is(tostring('-2' - c1), '(-3,-3)')
+
+function Cplx.mt.__mul (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local r = Cplx.new(a.re*b.re - a.im*b.im,
+        a.re*b.im + a.im*b.re)
+    return r
+end
+
+is(tostring(c1 * c2), '(5,5)', "cplx __mul")
+is(tostring(c1 * 3), '(3,9)')
+is(tostring(-2 * c1), '(-2,-6)')
+is(tostring(c1 * '3'), '(3,9)')
+is(tostring('-2' * c1), '(-2,-6)')
+
+function Cplx.mt.__div (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local n = b.re*b.re + b.im*b.im
+    local inv = Cplx.new(b.re/n, b.im/n)
+    local r = Cplx.new(a.re*inv.re - a.im*inv.im,
+        a.re*inv.im + a.im*inv.re)
+    return r
+end
+
+c1 = Cplx.new(2, 6)
+c2 = Cplx.new(2, 0)
+
+is(tostring(c1 / c2), '(1,3)', "cplx __div")
+is(tostring(c1 / 2), '(1,3)')
+is(tostring(-4 / c2), '(-2,0)')
+is(tostring(c1 / '2'), '(1,3)')
+is(tostring('-4' / c2), '(-2,0)')
+
+function Cplx.mt.__unm (a)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    local r = Cplx.new(-a.re, -a.im)
+    return r
+end
+
+c1 = Cplx.new(1, 3)
+is(tostring(- c1), '(-1,-3)', "cplx __unm")
+
+function Cplx.mt.__len (a)
+    return math.sqrt(a.re*a.re + a.im*a.im)
+end
+
+c1 = Cplx.new(3, 4)
+is( #c1, 5, "cplx __len")
+
+function Cplx.mt.__eq (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    return (a.re == b.re) and (b.im == b.im)
+end
+
+c1 = Cplx.new(2, 0)
+c2 = Cplx.new(1, 3)
+c3 = Cplx.new(2, 0)
+
+is(c1 ~= c2, true, "cplx __eq")
+is(c1 == c3, true)
+is(c1 == 2, false)
+is(Cplx.mt.__eq(c1, 2), true)
+
+function Cplx.mt.__lt (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local ra = a.re*a.re + a.im*a.im
+    local rb = b.re*b.re + b.im*b.im
+    return ra < rb
+end
+
+is(c1 < c2, true, "cplx __lt")
+is(c1 < c3, false)
+is(c1 <= c3, true)
+is(c1 < 1, false)
+is(c1 < 4, true)
+
+function Cplx.mt.__le (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local ra = a.re*a.re + a.im*a.im
+    local rb = b.re*b.re + b.im*b.im
+    return ra <= rb
+end
+
+is(c1 < c2, true, "cplx __lt __le")
+is(c1 < c3, false)
+is(c1 <= c3, true)
+
+function Cplx.mt.__call (obj)
+    a = "Cplx.__call " .. tostring(obj)
+    return true
+end
+
+c1 = Cplx.new(2, 0)
+a = nil
+r = c1()
+is(r, true, "cplx __call (without args)")
+is(a, "Cplx.__call (2,0)")
+
+function Cplx.mt.__call (obj, ...)
+    a = "Cplx.__call " .. tostring(obj) .. ", " .. table.concat({...}, ", ")
+    return true
+end
+
+is(c1(), true, "cplx __call (with args)")
+is(a, "Cplx.__call (2,0), ")
+is(c1('a'), true)
+is(a, "Cplx.__call (2,0), a")
+is(c1('a', 'b', 'c'), true)
+is(a, "Cplx.__call (2,0), a, b, c")
+
+--[[ delegate ]]
+
+local t = {
+    _VALUES = {
+        a = 1,
+        b = 'text',
+        c = true,
+    }
+}
+local mt = {
+    __pairs = function (op)
+        return next, op._VALUES
+    end
+}
+setmetatable(t, mt)
+
+r = {}
+for k in pairs(t) do
+    r[#r+1] = k
+end
+table.sort(r)
+is( table.concat(r, ','), 'a,b,c', "__pairs" )
+
+local t = {
+    _VALUES = { 'a', 'b', 'c' }
+}
+local mt = {
+    __ipairs = function (op)
+        return ipairs(op._VALUES)
+    end
+}
+setmetatable(t, mt)
+
+r = ''
+for i, v in ipairs(t) do
+    r = r .. v
+end
+is( r, 'abc', "__ipairs" )
+
+--[[ Window ]]
+
+-- create a namespace
+Window = {}
+-- create a prototype with default values
+Window.prototype = {x=0, y=0, width=100, heigth=100, }
+-- create a metatable
+Window.mt = {}
+-- declare the constructor function
+function Window.new (o)
+    setmetatable(o, Window.mt)
+    return o
+end
+
+Window.mt.__index = function (table, key)
+    return Window.prototype[key]
+end
+
+w = Window.new{x=10, y=20}
+is(w.x, 10, "table-access")
+is(w.width, 100)
+is(rawget(w, 'x'), 10)
+is(rawget(w, 'width'), nil)
+
+Window.mt.__index = Window.prototype  -- just a table
+w = Window.new{x=10, y=20}
+is(w.x, 10, "table-access")
+is(w.width, 100)
+is(rawget(w, 'x'), 10)
+is(rawget(w, 'width'), nil)
+
+--[[ tables with default values ]]
+function setDefault_1 (t, d)
+    local mt = {__index = function () return d end}
+    setmetatable (t, mt)
+end
+
+tab = {x=10, y=20}
+is(tab.x, 10, "tables with default values")
+is(tab.z, nil)
+setDefault_1(tab, 0)
+is(tab.x, 10)
+is(tab.z, 0)
+
+--[[ tables with default values ]]
+local mt = {__index = function (t) return t.___ end}
+function setDefault_2 (t, d)
+    t.___ = d
+    setmetatable (t, mt)
+end
+
+tab = {x=10, y=20}
+is(tab.x, 10, "tables with default values")
+is(tab.z, nil)
+setDefault_2(tab, 0)
+is(tab.x, 10)
+is(tab.z, 0)
+
+--[[ tables with default values ]]
+local key = {}
+local mt = {__index = function (t) return t[key] end}
+function setDefault_3 (t, d)
+    t[key] = d
+    setmetatable (t, mt)
+end
+
+tab = {x=10, y=20}
+is(tab.x, 10, "tables with default values")
+is(tab.z, nil)
+setDefault_3(tab, 0)
+is(tab.x, 10)
+is(tab.z, 0)
+
+--[[ private access ]]
+t = {}  -- original table
+-- keep a private access to original table
+local _t = t
+-- create proxy
+t = {}
+-- create metatable
+local mt = {
+    __index = function (t,k)
+        r = "*access to element " .. tostring(k)
+        return _t[k]  -- access the original table
+    end,
+
+    __newindex = function (t,k,v)
+        w = "*update of element " .. tostring(k) ..
+                           " to " .. tostring(v)
+        _t[k] = v  -- update original table
+    end
+}
+setmetatable(t, mt)
+
+w = nil
+r = nil
+t[2] = 'hello'
+is(t[2], 'hello', "tracking table accesses")
+is(w, "*update of element 2 to hello")
+is(r, "*access to element 2")
+
+--[[ private access ]]
+-- create private index
+local index = {}
+-- create metatable
+local mt = {
+    __index = function (t,k)
+        r = "*access to element " .. tostring(k)
+        return t[index][k]  -- access the original table
+    end,
+
+    __newindex = function (t,k,v)
+        w = "*update of element " .. tostring(k) ..
+                           " to " .. tostring(v)
+        t[index][k] = v  -- update original table
+    end
+}
+function track (t)
+    local proxy = {}
+    proxy[index] = t
+    setmetatable(proxy, mt)
+    return proxy
+end
+
+t = {}
+t = track(t)
+
+w = nil
+r = nil
+t[2] = 'hello'
+is(t[2], 'hello', "tracking table accesses")
+is(w, "*update of element 2 to hello")
+is(r, "*access to element 2")
+
+--[[ read-only table ]]
+function readOnly (t)
+    local proxy = {}
+    local mt = {
+        __index = t,
+        __newindex = function (t,k,v)
+            error("attempt to update a read-only table", 2)
+        end
+    }
+    setmetatable(proxy, mt)
+    return proxy
+end
+
+days = readOnly{'Sunday', 'Monday', 'Tuesday', 'Wednesday',
+        'Thurday', 'Friday', 'Saturday'}
+
+is(days[1], 'Sunday', "read-only tables")
+
+error_like(function () days[2] = 'Noday' end,
+           "^[^:]+:%d+: attempt to update a read%-only table")
+
+--[[ declare global ]]
+function declare (name, initval)
+    rawset(_G, name, initval or false)
+end
+
+setmetatable(_G, {
+    __newindex = function (_, n)
+        error("attempt to write to undeclared variable " .. n, 2)
+    end,
+    __index = function (_, n)
+        error("attempt to read undeclared variable" .. n, 2)
+    end,
+})
+
+error_like(function () new_a = 1 end,
+           "^[^:]+:%d+: attempt to write to undeclared variable new_a",
+           "declaring global variables")
+
+declare 'new_a'
+new_a = 1
+is(new_a, 1)
+
+--[[ ]]
+local newindex = {}
+-- create metatable
+local mt = {
+    __newindex = newindex
+}
+local t = setmetatable({}, mt)
+t[1] = 42
+is(newindex[1], 42, "__newindex")
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 307 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/232-object.t

@@ -0,0 +1,307 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua object
+
+=head2 Synopsis
+
+    % prove 232-object.t
+
+=head2 Description
+
+See "Programming in Lua", section 16 "Object-Oriented Programming".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(18)
+
+--[[ object ]]
+Account = {balance = 0}
+
+function Account.withdraw (self, v)
+    self.balance = self.balance - v
+end
+
+a1 = Account; Account = nil
+a1.withdraw(a1, 100.00)
+is(a1.balance, -100, "object")
+
+a2 = {balance = 0, withdraw = a1.withdraw}
+a2.withdraw(a2, 260.00)
+is(a2.balance, -260)
+
+--[[ object ]]
+Account = {balance = 0}
+
+function Account:withdraw (v)
+    self.balance = self.balance - v
+end
+
+a = Account
+a:withdraw(100.00)
+is(a.balance, -100, "object")
+
+Account = { balance = 0,
+            withdraw = function (self, v)
+                           self.balance = self.balance -v
+                       end
+          }
+function Account:deposit (v)
+    self.balance = self.balance + v
+end
+
+Account.deposit(Account, 200.00)
+is(Account.balance, 200, "object")
+Account:withdraw(100.00)
+is(Account.balance, 100)
+
+--[[ classe ]]
+Account = {balance = 0}
+
+function Account:new (o)
+    o = o or {}
+    setmetatable(o, self)
+    self.__index = self
+    return o
+end
+
+function Account:deposit (v)
+    self.balance = self.balance + v
+end
+
+function Account:withdraw (v)
+    self.balance = self.balance - v
+end
+
+a = Account:new{balance = 0}
+a:deposit(100.00)
+is(a.balance, 100, "classe")
+
+b = Account:new()
+is(b.balance, 0)
+b:deposit(200.00)
+is(b.balance, 200)
+
+--[[ inheritance ]]
+Account = {balance = 0}
+
+function Account:new (o)
+--    print "Account:new"
+    o = o or {}
+    setmetatable(o, self)
+    self.__index = self
+    return o
+end
+
+function Account:deposit (v)
+--    print "Account:deposit"
+    self.balance = self.balance + v
+end
+
+function Account:withdraw (v)
+--    print "Account:withdraw"
+    if v > self.balance then error"insuficient funds" end
+    self.balance = self.balance - v
+end
+
+a = Account:new()
+is(a.balance, 0, "inheritance")
+-- r, msg = pcall(Account.withdraw, a, 100)
+-- print(msg)
+
+SpecialAccount = Account:new()
+
+function SpecialAccount:withdraw (v)
+--    print "SpecialAccount:withdraw"
+    if self.balance - v <= -self:getLimit() then
+        error"insuficient funds"
+    end
+    self.balance = self.balance - v
+end
+
+function SpecialAccount:getLimit ()
+--    print "SpecialAccount:getLimit"
+    return self.limit or 0
+end
+
+s = SpecialAccount:new{limit=1000.00}
+
+s:deposit(100.00)
+is(s.balance, 100)
+
+s:withdraw(200.00)
+is(s.balance, -100)
+
+--[[ multiple inheritance ]]
+-- look up for 'k' in list of tables 'plist'
+local function search (k, plist)
+    for i=1, #plist do
+        local v = plist[i][k]  -- try 'i'-th superclass
+        if v then return v end
+    end
+end
+
+function createClass (...)
+    local c = {}  -- new class
+    local arg = {...}
+
+    -- class will search for each method in the list of its
+    -- parents ('arg' is the list of parents)
+    setmetatable(c, {__index = function (t, k)
+        return search(k, arg)
+    end})
+
+    -- prepare 'c' to be the metatable of its instance
+    c.__index = c
+
+    -- define a new constructor for this new class
+    function c:new (o)
+        o = o or {}
+        setmetatable(o, c)
+        return o
+    end
+
+    -- return new class
+    return c
+end
+
+Account = {balance = 0}
+function Account:deposit (v)
+    self.balance = self.balance + v
+end
+function Account:withdraw (v)
+    self.balance = self.balance - v
+end
+
+Named = {}
+function Named:getname ()
+    return self.name
+end
+function Named:setname (n)
+    self.name = n
+end
+
+NamedAccount = createClass(Account, Named)
+
+account = NamedAccount:new{name = "Paul"}
+is(account:getname(), 'Paul', "multiple inheritance")
+account:deposit(100.00)
+is(account.balance, 100)
+
+
+--[[ multiple inheritance (patched) ]]
+-- look up for 'k' in list of tables 'plist'
+local function search (k, plist)
+    for i=1, #plist do
+        local v = plist[i][k]  -- try 'i'-th superclass
+        if v then return v end
+    end
+end
+
+function createClass (...)
+    local c = {}  -- new class
+    local arg = {...}
+
+    -- class will search for each method in the list of its
+    -- parents ('arg' is the list of parents)
+    setmetatable(c, {__index = function (t, k)
+        -- return search(k, arg)
+        return (search(k, arg))
+    end})
+
+    -- prepare 'c' to be the metatable of its instance
+    c.__index = c
+
+    -- define a new constructor for this new class
+    function c:new (o)
+        o = o or {}
+        setmetatable(o, c)
+        return o
+    end
+
+    -- return new class
+    return c
+end
+
+Account = {balance = 0}
+function Account:deposit (v)
+    self.balance = self.balance + v
+end
+function Account:withdraw (v)
+    self.balance = self.balance - v
+end
+
+Named = {}
+function Named:getname ()
+    return self.name
+end
+function Named:setname (n)
+    self.name = n
+end
+
+NamedAccount = createClass(Account, Named)
+
+account = NamedAccount:new{name = "Paul"}
+is(account:getname(), 'Paul', "multiple inheritance (patched)")
+account:deposit(100.00)
+is(account.balance, 100)
+
+--[[ privacy ]]
+function newAccount (initialBalance)
+    local self = {balance = initialBalance}
+
+    local withdraw = function (v)
+                         self.balance = self.balance - v
+                     end
+
+    local deposit = function (v)
+                        self.balance = self.balance + v
+                    end
+
+    local getBalance = function () return self.balance end
+
+    return {
+        withdraw = withdraw,
+        deposit = deposit,
+        getBalance = getBalance
+    }
+end
+
+acc1 = newAccount(100.00)
+acc1.withdraw(40.00)
+is(acc1.getBalance(), 60, "privacy")
+
+--[[ single-method approach ]]
+function newObject (value)
+    return function (action, v)
+        if action == 'get' then return value
+        elseif action == 'set' then value = v
+        else error("invalid action")
+        end
+    end
+end
+
+d = newObject(0)
+is(d('get'), 0, "single-method approach")
+d('set', 10)
+is(d('get'), 10)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 391 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/301-basic.t

@@ -0,0 +1,391 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Basic Library
+
+=head2 Synopsis
+
+    % prove 301-basic.t
+
+=head2 Description
+
+Tests Lua Basic Library
+
+See "Lua 5.2 Reference Manual", section 6.1 "Basic Functions",
+L<http://www.lua.org/manual/5.2/manual.html#6.1>.
+
+=cut
+
+--]]
+
+-- MoonSharp note : THIS SUITE WAS HEAVILY CUT FOR NOT APPLIABLE TESTS
+
+
+require 'Test.More'
+
+plan(168)
+
+--[[
+if jit then
+    like(_VERSION, '^Lua 5%.1$', "variable _VERSION")
+else
+    like(_VERSION, '^Lua 5%.2$', "variable _VERSION")
+end
+-- ]]
+
+v, msg = assert('text', "assert string")
+is(v, 'text', "function assert")
+is(msg, "assert string")
+v, msg = assert({}, "assert table")
+is(msg, "assert table")
+
+error_like(function () assert(false, "ASSERTION TEST") end,
+           "^[^:]+:%d+: ASSERTION TEST",
+           "function assert(false, msg)")
+
+error_like(function () assert(false) end,
+           "^[^:]+:%d+: assertion failed!",
+           "function assert(false)")
+
+error_like(function () assert(false, nil) end,
+           "^[^:]+:%d+: assertion failed!",
+           "function assert(false, nil)")
+
+
+a = {'a','b','c'}
+local f, v, s = ipairs(a)
+type_ok(f, 'function', "function ipairs")
+type_ok(v, 'table')
+is(s, 0)
+s, v = f(a, s)
+is(s, 1)
+is(v, 'a')
+s, v = f(a, s)
+is(s, 2)
+is(v, 'b')
+s, v = f(a, s)
+is(s, 3)
+is(v, 'c')
+s, v = f(a, s)
+is(s, nil)
+is(v, nil)
+
+t = { [[
+function bar (x)
+    return x
+end
+]] }
+i = 0
+function reader ()
+    i = i + 1
+    return t[i]
+end
+f, msg = load(reader)
+if msg then
+    diag(msg)
+end
+type_ok(f, 'function', "function load(reader)")
+is(bar, nil)
+f()
+is(bar('ok'), 'ok')
+bar = nil
+
+t = { [[
+function baz (x)
+    return x
+end
+]] }
+i = -1
+function reader ()
+    i = i + 1
+    return t[i]
+end
+f, msg = load(reader)
+if msg then
+    diag(msg)
+end
+type_ok(f, 'function', "function load(pathological reader)")
+f()
+is(baz, nil)
+
+t = { [[?syntax error?]] }
+i = 0
+f, msg = load(reader, "errorchunk")
+is(f, nil, "function load(syntax error)")
+--like(msg, "^%[string \"errorchunk\"%]:%d+:") -- ERRORMSG
+
+f = load(function () return nil end)
+type_ok(f, 'function', "when reader returns nothing")
+
+f, msg = load(function () return {} end)
+is(f, nil, "reader function must return a string")
+like(msg, "reader function must return a string")
+
+f = load([[
+function bar (x)
+    return x
+end
+]])
+is(bar, nil, "function load(str)")
+f()
+is(bar('ok'), 'ok')
+bar = nil
+
+env = {}
+f = load([[
+function bar (x)
+    return x
+end
+]], "from string", 't', env)
+is(env.bar, nil, "function load(str)")
+f()
+is(env.bar('ok'), 'ok')
+
+
+-- ...
+
+
+f = load([[i = i + 1]])
+i = 0
+f()
+is(i, 1, "function loadstring")
+f()
+is(i, 2)
+
+i = 32
+local i = 0
+f = load([[i = i + 1; return i]])
+g = function () i = i + 1; return i end
+is(f(), 33, "function loadstring")
+is(g(), 1)
+
+f, msg = load([[?syntax error?]])
+is(f, nil, "function loadstring (syntax error)")
+-- like(msg, '^%[string "%?syntax error%?"%]:%d+:') -- ERRORMSG
+
+t = {'a','b','c'}
+a = next(t, nil)
+is(a, 1, "function next (array)")
+a = next(t, 1)
+is(a, 2)
+a = next(t, 2)
+is(a, 3)
+a = next(t, 3)
+is(a, nil)
+
+error_like(function () a = next() end,
+           "^[^:]+:%d+: bad argument #1 to 'next' %(table expected, got no value%)",
+           "function next (no arg)")
+
+error_like(function () a = next(t, 6) end,
+           "invalid key to 'next'",
+           "function next (invalid key)")
+
+t = {'a','b','c'}
+a = next(t, 2)
+is(a, 3, "function next (unorderer)")
+a = next(t, 1)
+is(a, 2)
+a = next(t, 3)
+is(a, nil)
+
+t = {}
+a = next(t, nil)
+is(a, nil, "function next (empty table)")
+
+a = {'a','b','c'}
+local f, v, s = pairs(a)
+type_ok(f, 'function', "function pairs")
+type_ok(v, 'table')
+is(s, nil)
+s = f(v, s)
+is(s, 1)
+s = f(v, s)
+is(s, 2)
+s = f(v, s)
+is(s, 3)
+s = f(v, s)
+is(s, nil)
+
+r = pcall(assert, true)
+is(r, true, "function pcall")
+r, msg = pcall(assert, false, 'catched')
+is(r, false)
+is(msg, 'catched')
+r = pcall(assert)
+is(r, false)
+
+t = {}
+a = t
+is(rawequal(nil, nil), true, "function rawequal -> true")
+is(rawequal(false, false), true)
+is(rawequal(3, 3), true)
+is(rawequal('text', 'text'), true)
+is(rawequal(t, a), true)
+is(rawequal(print, print), true)
+
+is(rawequal(nil, 2), false, "function rawequal -> false")
+is(rawequal(false, true), false)
+is(rawequal(false, 2), false)
+is(rawequal(3, 2), false)
+is(rawequal(3, '2'), false)
+is(rawequal('text', '2'), false)
+is(rawequal('text', 2), false)
+is(rawequal(t, {}), false)
+is(rawequal(t, 2), false)
+is(rawequal(print, format), false)
+is(rawequal(print, 2), false)
+
+is(rawlen("text"), 4, "function rawlen (string)")
+is(rawlen({ 'a', 'b', 'c'}), 3, "function rawlen (table)")
+error_like(function () a = rawlen(true) end,
+           "^[^:]+:%d+: bad argument #1 to 'rawlen' %(table ",
+           "function rawlen (bad arg)")
+
+t = {a = 'letter a', b = 'letter b'}
+is(rawget(t, 'a'), 'letter a', "function rawget")
+
+t = {}
+is(rawset(t, 'a', 'letter a'), t, "function rawset")
+is(t.a, 'letter a')
+
+error_like(function () t = {}; rawset(t, nil, 42) end,
+           "^[^:]+:%d+: table index is nil",   -- changed this for MoonSharp, but we stay as it is!
+           "function rawset (table index is nil)")
+
+is(select('#'), 0, "function select")
+is(select('#','a','b','c'), 3)
+eq_array({select(1,'a','b','c')}, {'a','b','c'})
+eq_array({select(3,'a','b','c')}, {'c'})
+eq_array({select(5,'a','b','c')}, {})
+eq_array({select(-1,'a','b','c')}, {'c'})
+eq_array({select(-2,'a','b','c')}, {'b', 'c'})
+eq_array({select(-3,'a','b','c')}, {'a', 'b', 'c'})
+
+error_like(function () select(0,'a','b','c') end,
+           "^[^:]+:%d+: bad argument #1 to 'select' %(index out of range%)",
+           "function select (out of range)")
+
+error_like(function () select(-4,'a','b','c') end,
+           "^[^:]+:%d+: bad argument #1 to 'select' %(index out of range%)",
+           "function select (out of range)")
+
+is(type("Hello world"), 'string', "function type")
+is(type(10.4*3), 'number')
+is(type(print), 'function')
+is(type(type), 'function')
+is(type(true), 'boolean')
+is(type(nil), 'nil')
+-- is(type(io.stdin), 'userdata') -- no stdin in MoonSharp so far 
+is(type(type(X)), 'string')
+
+a = nil
+is(type(a), 'nil', "function type")
+a = 10
+is(type(a), 'number')
+a = "a string!!"
+is(type(a), 'string')
+a = print
+is(type(a), 'function')
+is(type(function () end), 'function')
+
+error_like(function () type() end,
+           "^[^:]+:%d+: bad argument #1 to 'type' %(value expected%)",
+           "function type (no arg)")
+
+is(tonumber('text12'), nil, "function tonumber")
+is(tonumber('12text'), nil)
+is(tonumber(3.14), 3.14)
+is(tonumber('3.14'), 3.14)
+is(tonumber('  3.14  '), 3.14)
+is(tonumber(111, 2), 7)
+is(tonumber('111', 2), 7)
+is(tonumber('  111  ', 2), 7)
+is(tonumber('78', 9), 71)
+is(tonumber('111  ', 3), 13)
+is(tonumber('111', 4), 21)
+is(tonumber('1234', 5), 194)
+is(tonumber('54321', 6), 7465)
+
+a = {}
+is(tonumber(a), nil)
+
+error_like(function () tonumber() end,
+           "^[^:]+:%d+: bad argument #1 to 'tonumber' %(value expected%)",
+           "function tonumber (no arg)")
+
+error_like(function () tonumber('111', 200) end,
+           "^[^:]+:%d+: bad argument #2 to 'tonumber' %(base out of range%)",
+           "function tonumber (bad base)")
+
+error_like(function () tonumber('17', 6) end,
+           "^[^:]+:%d+: bad argument #1 to 'tonumber' %(invalid character%)",
+           "function tonumber (bad base)")
+
+is(tostring('text'), 'text', "function tostring")
+is(tostring(3.14), '3.14')
+is(tostring(nil), 'nil')
+is(tostring(true), 'true')
+is(tostring(false), 'false')
+like(tostring({}), '^table: 0?[Xx]?%x+$')
+like(tostring(print), '^function: 0?[Xx]?[builtin]*#?%x+$')
+
+error_like(function () tostring() end,
+           "^[^:]+:%d+: bad argument #1 to 'tostring' %(value expected%)",
+           "function tostring (no arg)")
+
+--[[ MoonSharp : this is intentional - we support pack and unpack outside the table namespace (or whatever they are) 
+if (platform and platform.compat) or jit then
+    type_ok(unpack, 'function', "function unpack")
+else
+    is(unpack, nil, "function unpack (removed)")
+end
+]]
+
+
+if jit then
+    error_like(function () xpcall(assert, nil) end,
+               "bad argument #2 to 'xpcall' %(function expected, got nil%)",
+               "function xpcall")
+    error_like(function () xpcall(assert) end,
+               "bad argument #2 to 'xpcall' %(function expected, got no value%)",
+               "function xpcall")
+    diag("LuaJIT intentional. xpcall")
+else
+    is(xpcall(assert, nil), false, "function xpcall")
+    error_like(function () xpcall(assert) end,
+               "^[^:]+:%d+: bad argument #2 to 'xpcall' %(function expected, got no value%)",
+               "function xpcall (no arg)")
+end
+
+function backtrace ()
+    return 'not a back trace'
+end
+r, msg = xpcall(assert, backtrace)
+is(r, false, "function xpcall (backtrace)")
+is(msg, 'not a back trace')
+
+r, msg = xpcall(function() assert(); end, backtrace)
+is(r, false, "function xpcall (backtrace)")
+is(msg, 'not a back trace')
+
+r = xpcall(assert, backtrace, true)
+is(r, true, "function xpcall")
+
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 318 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/304-string.t

@@ -0,0 +1,318 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua String Library
+
+=head2 Synopsis
+
+    % prove 304-string.t
+
+=head2 Description
+
+Tests Lua String Library
+
+See "Lua 5.2 Reference Manual", section 6.4 "String Manipulation",
+L<http://www.lua.org/manual/5.2/manual.html#6.4>.
+
+See "Programming in Lua", section 20 "The String Library".
+
+=cut
+
+]]
+
+require 'Test.More'
+
+plan(115)
+
+is(string.byte('ABC'), 65, "function byte")
+is(string.byte('ABC', 2), 66)
+is(string.byte('ABC', -1), 67)
+is(string.byte('ABC', 4), nil)
+is(string.byte('ABC', 0), nil)
+eq_array({string.byte('ABC', 1, 3)}, {65, 66, 67})
+eq_array({string.byte('ABC', 1, 4)}, {65, 66, 67})
+
+type_ok(getmetatable('ABC'), 'table', "literal string has metatable")
+
+s = "ABC"
+is(s:byte(2), 66, "method s:byte")
+
+is(string.char(65, 66, 67), 'ABC', "function char")
+is(string.char(), '')
+
+error_like(function () string.char(0, 'bad') end,
+           "^[^:]+:%d+: bad argument #2 to 'char' %(number expected, got string%)",
+           "function char (bad arg)")
+
+		   
+--[[		   
+MoonSharp intentional : 
+
+1) unicode chars supported!
+2) plan has upvalues, and by Lua spec it shouldn't be supported!
+		   
+error_like(function () string.char(0, 9999) end,
+           "^[^:]+:%d+: bad argument #2 to 'char' %(.-value.-%)",
+           "function char (invalid)")
+
+d = string.dump(plan)
+type_ok(d, 'string', "function dump")
+
+error_like(function () string.dump(print) end,
+           "^[^:]+:%d+: unable to dump given function",
+           "function dump (C function)")
+		   
+]]
+
+s = "hello world"
+eq_array({string.find(s, "hello")}, {1, 5}, "function find (mode plain)")
+eq_array({string.find(s, "hello", 1, true)}, {1, 5})
+eq_array({string.find(s, "hello", 1)}, {1, 5})
+is(string.sub(s, 1, 5), "hello")
+eq_array({string.find(s, "world")}, {7, 11})
+eq_array({string.find(s, "l")}, {3, 3})
+is(string.find(s, "lll"), nil)
+is(string.find(s, "hello", 2, true), nil)
+eq_array({string.find(s, "world", 2, true)}, {7, 11})
+is(string.find(s, "hello", 20), nil)
+
+s = "hello world"
+eq_array({string.find(s, "^h.ll.")}, {1, 5}, "function find (with regex & captures)")
+eq_array({string.find(s, "w.rld", 2)}, {7, 11})
+is(string.find(s, "W.rld"), nil)
+eq_array({string.find(s, "^(h.ll.)")}, {1, 5, 'hello'})
+eq_array({string.find(s, "^(h.)l(l.)")}, {1, 5, 'he', 'lo'})
+s = "Deadline is 30/05/1999, firm"
+date = "%d%d/%d%d/%d%d%d%d"
+is(string.sub(s, string.find(s, date)), "30/05/1999")
+date = "%f[%S]%d%d/%d%d/%d%d%d%d"
+is(string.sub(s, string.find(s, date)), "30/05/1999")
+
+error_like(function () string.find(s, '%f') end,
+           "^[^:]+:%d+: missing '%[' after '%%f' in pattern",
+           "function find (invalid frontier)")
+
+is(string.format("pi = %.4f", math.pi), 'pi = 3.1416', "function format")
+d = 5; m = 11; y = 1990
+is(string.format("%02d/%02d/%04d", d, m, y), "05/11/1990")
+is(string.format("%X %x", 126, 126), "7E 7e")
+tag, title = "h1", "a title"
+is(string.format("<%s>%s</%s>", tag, title, tag), "<h1>a title</h1>")
+
+-- moonsharp : this commented out as it might fail mostly because of CRLF in windows than because of 
+-- a moonsharp bug I think. Will see, surely not a blocking issue now.
+--[==[ 
+is(string.format('%q', 'a string with "quotes" and \n new line'), [["a string with \"quotes\" and \
+ new line"]], "function format %q") 
+--]==]
+
+is(string.format('%q', 'a string with \b and \b2'), [["a string with \8 and \0082"]], "function format %q")
+
+is(string.format("%s %s", 1, 2, 3), '1 2', "function format (too many arg)")
+
+is(string.format("%% %c %%", 65), '% A %', "function format (%%)")
+
+r = string.rep("ab", 100)
+is(string.format("%s %d", r, r:len()), r .. " 200")
+
+error_like(function () string.format("%s %s", 1) end,
+           "^[^:]+:%d+: bad argument #3 to 'format' %(.-no value%)",
+           "function format (too few arg)")
+
+error_like(function () string.format('%d', 'toto') end,
+           "^[^:]+:%d+: bad argument #2 to 'format' %(number expected, got string%)",
+           "function format (bad arg)")
+
+error_like(function () string.format('%k', 'toto') end,
+           "^[^:]+:%d+: invalid option '%%k' to 'format'",
+           "function format (invalid option)")
+
+if jit and jit.version_num >= 20100 then
+    todo("LuaJIT TODO. format.", 1)
+end
+error_like(function () string.format('%------s', 'toto') end,
+           "^[^:]+:%d+: invalid format %(repeated flags%)",
+           "function format (invalid format)")
+
+error_like(function () string.format('pi = %.123f', math.pi) end,
+           "^[^:]+:%d+: invalid ",
+           "function format (invalid format)")
+
+error_like(function () string.format('% 123s', 'toto') end,
+           "^[^:]+:%d+: invalid ",
+           "function format (invalid format)")
+
+s = "hello"
+output = {}
+for c in string.gmatch(s, '..') do
+    table.insert(output, c)
+end
+eq_array(output, {'he', 'll'}, "function gmatch")
+output = {}
+for c1, c2 in string.gmatch(s, '(.)(.)') do
+    table.insert(output, c1)
+    table.insert(output, c2)
+end
+eq_array(output, {'h', 'e', 'l', 'l'})
+s = "hello world from Lua"
+output = {}
+for w in string.gmatch(s, '%a+') do
+    table.insert(output, w)
+end
+eq_array(output, {'hello', 'world', 'from', 'Lua'})
+s = "from=world, to=Lua"
+output = {}
+for k, v in string.gmatch(s, '(%w+)=(%w+)') do
+    table.insert(output, k)
+    table.insert(output, v)
+end
+eq_array(output, {'from', 'world', 'to', 'Lua'})
+
+is(string.gsub("hello world", "(%w+)", "%1 %1"), "hello hello world world", "function gsub")
+is(string.gsub("hello world", "%w+", "%0 %0", 1), "hello hello world")
+
+
+is(string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1"), "world hello Lua from")
+
+
+if jit then
+    todo("LuaJIT TODO. gsub.", 1)
+end
+
+error_like(function () string.gsub("hello world", "%w+", "%e") end,
+           "^[^:]+:%d+: invalid use of '%%' in replacement string",
+           "function gsub (invalid replacement string)")
+		   
+is(string.gsub("home = $HOME, user = $USER", "%$(%w+)", string.reverse), "home = EMOH, user = RESU")
+is(string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s) return load(s)() end), "4+5 = 9")
+local t = {name='lua', version='5.1'}
+is(string.gsub("$name-$version.tar.gz", "%$(%w+)", t), "lua-5.1.tar.gz")
+is(string.gsub("Lua is cute", 'cute', 'great'), "Lua is great")
+is(string.gsub("all lii", 'l', 'x'), "axx xii")
+is(string.gsub("Lua is great", '^Sol', 'Sun'), "Lua is great")
+is(string.gsub("all lii", 'l', 'x', 1), "axl lii")
+is(string.gsub("all lii", 'l', 'x', 2), "axx lii")
+is(select(2, string.gsub("string with 3 spaces", ' ', ' ')), 3)
+
+eq_array({string.gsub("hello, up-down!", '%A', '.')}, {"hello..up.down.", 4})
+text = "hello world"
+nvow = select(2, string.gsub(text, '[AEIOUaeiou]', ''))
+is(nvow, 3)
+eq_array({string.gsub("one, and two; and three", '%a+', 'word')}, {"word, word word; word word", 5})
+test = "int x; /* x */  int y; /* y */"
+eq_array({string.gsub(test, "/%*.*%*/", '<COMMENT>')}, {"int x; <COMMENT>", 1})
+eq_array({string.gsub(test, "/%*.-%*/", '<COMMENT>')}, {"int x; <COMMENT>  int y; <COMMENT>", 2})
+s = "a (enclosed (in) parentheses) line"
+eq_array({string.gsub(s, '%b()', '')}, {"a  line", 1})
+
+error_like(function () string.gsub(s, '%b(', '') end,
+           "^[^:]+:%d+: .- pattern",
+           "function gsub (malformed pattern)")
+
+eq_array({string.gsub("hello Lua!", "%a", "%0-%0")}, {"h-he-el-ll-lo-o L-Lu-ua-a!", 8})
+eq_array({string.gsub("hello Lua", "(.)(.)", "%2%1")}, {"ehll ouLa", 4})
+
+function expand (s)
+    return (string.gsub(s, '$(%w+)', _G))
+end
+name = 'Lua'; status= 'great'
+is(expand("$name is $status, isn't it?"), "Lua is great, isn't it?")
+is(expand("$othername is $status, isn't it?"), "$othername is great, isn't it?")
+
+function expand (s)
+    return (string.gsub(s, '$(%w+)', function (n)
+                                          return tostring(_G[n]), 1
+                                     end))
+end
+like(expand("print = $print; a = $a"), "^print = function: [0]?[Xx]?[builtin]*#?%x+; a = nil")
+
+error_like(function () string.gsub("hello world", '(%w+)', '%2 %2') end,
+           "^[^:]+:%d+: invalid capture index",
+           "function gsub (invalid index)")
+
+error_like(function () string.gsub("hello world", '(%w+)', true) end,
+           "^[^:]+:%d+: bad argument #3 to 'gsub' %(string/function/table expected%)",
+           "function gsub (bad type)")
+
+error_like(function ()
+    function expand (s)
+        return (string.gsub(s, '$(%w+)', _G))
+    end
+
+    name = 'Lua'; status= true
+    expand("$name is $status, isn't it?")
+           end,
+           "^[^:]+:%d+: invalid replacement value %(a boolean%)",
+           "function gsub (invalid value)")
+
+is(string.len(''), 0, "function len")
+is(string.len('test'), 4)
+is(string.len("a\000b\000c"), 5)
+is(string.len('"'), 1)
+
+is(string.lower('Test'), 'test', "function lower")
+is(string.lower('TeSt'), 'test')
+
+s = "hello world"
+is(string.match(s, '^hello'), 'hello', "function match")
+is(string.match(s, 'world', 2), 'world')
+is(string.match(s, 'World'), nil)
+eq_array({string.match(s, '^(h.ll.)')}, {'hello'})
+eq_array({string.match(s, '^(h.)l(l.)')}, {'he', 'lo'})
+date = "Today is 17/7/1990"
+is(string.match(date, '%d+/%d+/%d+'), '17/7/1990')
+eq_array({string.match(date, '(%d+)/(%d+)/(%d+)')}, {'17', '7', '1990'})
+is(string.match("The number 1298 is even", '%d+'), '1298')
+pair = "name = Anna"
+eq_array({string.match(pair, '(%a+)%s*=%s*(%a+)')}, {'name', 'Anna'})
+
+s = [[then he said: "it's all right"!]]
+eq_array({string.match(s, "([\"'])(.-)%1")}, {'"', "it's all right"}, "function match (back ref)")
+p = "%[(=*)%[(.-)%]%1%]"
+s = "a = [=[[[ something ]] ]==]x]=]; print(a)"
+eq_array({string.match(s, p)}, {'=', '[[ something ]] ]==]x'})
+
+is(string.match(s, "%g"), "a", "match graphic char")
+
+error_like(function () string.match("hello world", "%1") end,
+           "^[^:]+:%d+: invalid capture index",
+           "function match invalid capture")
+
+error_like(function () string.match("hello world", "%w)") end,
+           "^[^:]+:%d+: invalid pattern capture",
+           "function match invalid capture")
+
+is(string.rep('ab', 3), 'ababab', "function rep")
+is(string.rep('ab', 0), '')
+is(string.rep('ab', -1), '')
+is(string.rep('', 5), '')
+is(string.rep('ab', 3, ','), 'ab,ab,ab', "with sep")
+
+is(string.reverse('abcde'), 'edcba', "function reverse")
+is(string.reverse('abcd'), 'dcba')
+is(string.reverse(''), '')
+
+is(string.sub('abcde', 1, 2), 'ab', "function sub")
+is(string.sub('abcde', 3, 4), 'cd')
+is(string.sub('abcde', -2), 'de')
+is(string.sub('abcde', 3, 2), '')
+
+is(string.upper('Test'), 'TEST', "function upper")
+is(string.upper('TeSt'), 'TEST')
+is(string.upper(string.rep('Test', 10000)), string.rep('TEST', 10000))
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 253 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/305-table.t

@@ -0,0 +1,253 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Table Library
+
+=head2 Synopsis
+
+    % prove 305-table.t
+
+=head2 Description
+
+Tests Lua Table Library
+
+See "Lua 5.2 Reference Manual", section 6.5 "Table Manipulation",
+L<http://www.lua.org/manual/5.2/manual.html#6.5>.
+
+See "Programming in Lua", section 19 "The Table Library".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(44)
+
+t = {'a','b','c','d','e'}
+is(table.concat(t), 'abcde', "function concat")
+is(table.concat(t, ','), 'a,b,c,d,e')
+is(table.concat(t, ',',2), 'b,c,d,e')
+is(table.concat(t, ',', 2, 4), 'b,c,d')
+is(table.concat(t, ',', 4, 2), '')
+
+t = {'a','b',3,'d','e'}
+is(table.concat(t,','), 'a,b,3,d,e', "function concat (number)")
+
+t = {'a','b','c','d','e'}
+error_like(function () table.concat(t, ',', 2, 7) end,
+           "^[^:]+:%d+: invalid value %(nil%) at index 6 in table for 'concat'",
+           "function concat (out of range)")
+
+t = {'a','b',true,'d','e'}
+error_like(function () table.concat(t, ',') end,
+           "^[^:]+:%d+: invalid value %(boolean%) at index 3 in table for 'concat'",
+           "function concat (non-string)")
+
+a = {10, 20, 30}
+table.insert(a, 1, 15)
+is(table.concat(a,','), '15,10,20,30', "function insert")
+t = {}
+table.insert(t, 'a')
+is(table.concat(t, ','), 'a')
+table.insert(t, 'b')
+is(table.concat(t, ','), 'a,b')
+table.insert(t, 1, 'c')
+is(table.concat(t, ','), 'c,a,b')
+table.insert(t, 2, 'd')
+is(table.concat(t, ','), 'c,d,a,b')
+table.insert(t, 5, 'e')
+is(table.concat(t, ','), 'c,d,a,b,e')
+
+if jit then
+    todo("LuaJIT TODO. table.insert.", 2)
+end
+error_like(function () table.insert(t, 7, 'f') end,
+           "^[^:]+:%d+: bad argument #2 to 'insert' %(position out of bounds%)",
+           "function insert (out of bounds)")
+
+error_like(function () table.insert(t, -9, 'f') end,
+           "^[^:]+:%d+: bad argument #2 to 'insert' %(position out of bounds%)",
+           "function insert (out of bounds)")
+
+error_like(function () table.insert(t, 2, 'g', 'h')  end,
+           "^[^:]+:%d+: wrong number of arguments to 'insert'",
+           "function insert (too many arg)")
+
+if (platform and platform.compat) or jit then
+    t = {}
+    is(table.maxn(t), 0, "function maxn")
+    t[1] = 'a'
+    t[2] = 'b'
+    is(table.maxn(t), 2)
+    t[6] = 'g'
+    is(table.maxn(t), 6)
+    a = {}
+    a[10000] = 1
+    is(table.maxn(a), 10000)
+else
+    is(table.maxn, nil, "maxn (removed)")
+    skip("maxn (removed)", 3)
+end
+
+t = table.pack("abc", "def", "ghi")
+eq_array(t, {
+    "abc",
+    "def",
+    "ghi"
+}, "function pack")
+is(t.n, 3)
+
+t = table.pack()
+eq_array(t, {}, "function pack (no element)")
+is(t.n, 0)
+
+t = {}
+a = table.remove(t)
+is(a, nil, "function remove")
+t = {'a','b','c','d','e'}
+a = table.remove(t)
+is(a, 'e')
+is(table.concat(t, ','), 'a,b,c,d')
+a = table.remove(t,3)
+is(a, 'c')
+is(table.concat(t, ','), 'a,b,d')
+a = table.remove(t,1)
+is(a, 'a')
+is(table.concat(t, ','), 'b,d')
+
+if jit then
+    todo("LuaJIT TODO. table.remove.", 1)
+end
+error_like(function () table.remove(t,7) end,
+           "^[^:]+:%d+: bad argument #1 to 'remove' %(position out of bounds%)",
+           "function remove (out of bounds)")
+
+lines = {
+    luaH_set = 10,
+    luaH_get = 24,
+    luaH_present = 48,
+}
+a = {}
+for n in pairs(lines) do a[#a + 1] = n end
+table.sort(a)
+output = {}
+for _, n in ipairs(a) do
+    table.insert(output, n)
+end
+eq_array(output, {'luaH_get', 'luaH_present', 'luaH_set'}, "function sort")
+
+function pairsByKeys (t, f)
+    local a = {}
+    for n in pairs(t) do a[#a + 1] = n end
+    table.sort(a, f)
+    local i = 0     -- iterator variable
+    return function ()  -- iterator function
+        i = i + 1
+        return a[i], t[a[i]]
+    end
+end
+
+output = {}
+for name, line in pairsByKeys(lines) do
+    table.insert(output, name)
+    table.insert(output, line)
+end
+eq_array(output, {'luaH_get', 24, 'luaH_present', 48, 'luaH_set', 10}, "function sort")
+
+output = {}
+for name, line in pairsByKeys(lines, function (a, b) return a < b end) do
+    table.insert(output, name)
+    table.insert(output, line)
+end
+eq_array(output, {'luaH_get', 24, 'luaH_present', 48, 'luaH_set', 10}, "function sort")
+
+
+
+function permgen (a, n)
+    n = n or #a
+    if n <= 1 then
+        coroutine.yield(a)
+    else
+        for i=1,n do
+            a[n], a[i] = a[i], a[n]
+            permgen(a, n - 1)
+            a[n], a[i] = a[i], a[n]
+        end
+    end
+end
+
+function permutations (a)
+    local co = coroutine.create(function () permgen(a) end)
+    return function ()
+               local code, res = coroutine.resume(co)
+               return res
+           end
+end
+
+local t = {}
+output = {}
+for _, v in ipairs{'a', 'b', 'c', 'd', 'e', 'f', 'g'} do
+    table.insert(t, v)
+    local ref = table.concat(t, ' ')
+    table.insert(output, ref)
+    local n = 0
+    for p in permutations(t) do
+        local c = {}
+        for i, v in ipairs(p) do
+            c[i] = v
+        end
+        table.sort(c)
+        assert(ref == table.concat(c, ' '), table.concat(p, ' '))
+        n = n + 1
+    end
+    table.insert(output, n)
+end
+
+eq_array(output, {
+    'a', 1,
+    'a b', 2,
+    'a b c', 6,
+    'a b c d', 24,
+    'a b c d e', 120,
+    'a b c d e f', 720,
+    'a b c d e f g', 5040,
+}, "function sort (all permutations)")
+
+--[[
+
+MoonSharp: Sort callbacks work --]]
+
+
+error_like(function ()
+    local t = { 1 }
+    table.sort( { t, t, t, t, }, function (a, b) return a[1] == b[1] end )
+           end,
+           "^[^:]+:%d+: invalid order function for sorting",
+           "function sort (bad func)")
+
+
+eq_array({table.unpack({})}, {}, "function unpack")
+eq_array({table.unpack({'a'})}, {'a'})
+eq_array({table.unpack({'a','b','c'})}, {'a','b','c'})
+eq_array({(table.unpack({'a','b','c'}))}, {'a'})
+eq_array({table.unpack({'a','b','c','d','e'},2,4)}, {'b','c','d'})
+eq_array({table.unpack({'a','b','c'},2,4)}, {'b','c'})
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:
+
+

+ 153 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/306-math.t

@@ -0,0 +1,153 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Mathematic Library
+
+=head2 Synopsis
+
+    % prove 306-math.t
+
+=head2 Description
+
+Tests Lua Mathematic Library
+
+See "Lua 5.2 Reference Manual", section 6.6 "Mathematical Functions",
+L<http://www.lua.org/manual/5.2/manual.html#6.6>.
+
+See "Programming in Lua", section 18 "The Mathematical Library".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(47)
+
+like(tostring(math.pi), '^3%.14', "variable pi")
+
+type_ok(math.huge, 'number', "variable huge")
+
+is(math.abs(-12.34), 12.34, "function abs")
+is(math.abs(12.34), 12.34)
+
+like(math.acos(0.5), '^1%.047', "function acos")
+
+like(math.asin(0.5), '^0%.523', "function asin")
+
+like(math.atan(0.5), '^0%.463', "function atan")
+
+like(math.atan2(1, 2), '^0%.463', "function atan2")
+
+is(math.ceil(12.34), 13, "function ceil")
+is(math.ceil(-12.34), -12)
+
+like(math.cos(0), '^1$', "function cos")
+
+like(math.cosh(0), '^1$', "function cosh")
+
+is(math.deg(math.pi), 180, "function deg")
+
+like(math.exp(1.0), '^2%.718', "function exp")
+
+is(math.floor(12.34), 12, "function floor")
+is(math.floor(-12.34), -13)
+
+is(math.fmod(7, 3), 1, "function fmod")
+is(math.fmod(-7, 3), -1)
+
+eq_array({math.frexp(1.5)}, {0.75, 1}, "function frexp")
+
+is(math.ldexp(1.2, 3), 9.6, "function ldexp")
+
+like(math.log(47), '^3%.85', "function log")
+like(math.log(47, 2), '^5%.554', "function log (base 2)")
+like(math.log(47, 10), '^1%.672', "function log (base 10)")
+
+if (platform and platform.compat) or jit then
+    like(math.log10(47), '^1%.672', "function log10")
+else
+    is(math.log10, nil, "function log10 (removed)")
+end
+
+error_like(function () math.max() end,
+           "^[^:]+:%d+: bad argument #1 to 'max' %(number expected, got no value%)",
+           "function max 0")
+
+is(math.max(1), 1, "function max")
+is(math.max(1, 2), 2)
+is(math.max(1, 2, 3, -4), 3)
+
+error_like(function () math.min() end,
+           "^[^:]+:%d+: bad argument #1 to 'min' %(number expected, got no value%)",
+           "function min 0")
+
+is(math.min(1), 1, "function min")
+is(math.min(1, 2), 1)
+is(math.min(1, 2, 3, -4), -4)
+
+eq_array({math.modf(2.25)}, {2, 0.25}, "function modf")
+
+is(math.pow(-2, 3), -8, "function pow")
+
+like(math.rad(180), '^3%.14', "function rad")
+
+like(math.random(), '^%d%.%d+', "function random no arg")
+
+like(math.random(9), '^%d$', "function random 1 arg")
+
+like(math.random(10, 19), '^1%d$', "function random 2 arg")
+
+--[[
+MoonSharp : math.random normalizes inputs, and we are happy with that
+
+if jit then
+    todo("LuaJIT intentional. Don't check empty interval.", 2)
+end
+error_like(function () math.random(0) end,
+           "^[^:]+:%d+: bad argument #1 to 'random' %(interval is empty%)",
+           "function random empty interval")
+
+error_like(function () math.random(19, 10) end,
+           "^[^:]+:%d+: bad argument #2 to 'random' %(interval is empty%)",
+           "function random empty interval")
+
+if jit then
+    todo("LuaJIT intentional. Don't care about extra arguments.")
+end
+error_like(function () math.random(1, 2, 3) end,
+           "^[^:]+:%d+: wrong number of arguments",
+           "function random too many arg")
+		   --]]
+
+math.randomseed(12)
+a = math.random()
+math.randomseed(12)
+b = math.random()
+is(a, b, "function randomseed")
+
+like(math.sin(math.pi/2), '^1$', "function sin")
+
+like(math.sinh(1), '^1%.175', "function sinh")
+
+like(math.sqrt(2), '^1%.414', "function sqrt")
+
+like(math.tan(math.pi/3), '^1%.732', "function tan")
+
+like(math.tanh(1), '^0%.761', "function sinh")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 94 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/307-bit.t

@@ -0,0 +1,94 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2010-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Bitwise Library
+
+=head2 Synopsis
+
+    % prove 307-bit.t
+
+=head2 Description
+
+Tests Lua Bitwise Library
+
+See "Lua 5.2 Reference Manual", section 6.7 "Bitwise operations",
+L<http://www.lua.org/manual/5.2/manual.html#6.7>.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+if jit then
+    skip_all("LuaJIT. bit32")
+end
+
+plan(20)
+
+is(bit32.band(0x01, 0x03, 0x07), 0x01, "function band")
+
+is(bit32.bnot(0x03), (-1 - 0x03) % 2^32, "function bnot")
+
+is(bit32.bor(0x01, 0x03, 0x07), 0x07, "function bor")
+
+is(bit32.btest(0x01), true, "function btest")
+is(bit32.btest(0x00), false, "function btest")
+
+is(bit32.bxor(0x01, 0x03, 0x07), 0x05, "function bxor")
+
+is(bit32.lrotate(0x03, 2), 0x0C, "function lrotate")
+
+is(bit32.rrotate(0x06, 1), 0x03, "function rrotate")
+
+is(bit32.arshift(0x06, 1), 0x03, "function arshift")
+
+is(bit32.arshift(-3, 1), bit32.arshift(-6, 2), "function arshift")
+
+is(bit32.lshift(0x03, 2), 0x0C, "function lshift")
+
+is(bit32.rshift(0x06, 1), 0x03, "function rshift")
+
+is(bit32.extract(0xFFFF, 3, 3), 0x07, "function extract")
+
+error_like(function () bit32.extract(0xFFFF, 99) end,
+           "^[^:]+:%d+: trying to access non%-existent bits",
+           "function extract (non-existent bits)")
+
+error_like(function () bit32.extract(0xFFFF, -3) end,
+           "^[^:]+:%d+: bad argument #2 to 'extract' %(field cannot be negative%)",
+           "function extract (negatif field)")
+
+error_like(function () bit32.extract(0xFFFF, 3, -3) end,
+           "^[^:]+:%d+: bad argument #3 to 'extract' %(width must be positive%)",
+           "function extract (negative width)")
+
+is(bit32.replace(0x0000, 0xFFFF, 3, 3), 0x38, "function replace")
+
+error_like(function () bit32.replace(0x0000, 0xFFFF, 99) end,
+           "^[^:]+:%d+: trying to access non%-existent bits",
+           "function replace (non-existent bits)")
+
+error_like(function () bit32.replace(0x0000, 0xFFFF, -3) end,
+           "^[^:]+:%d+: bad argument #3 to 'replace' %(field cannot be negative%)",
+           "function replace (negatif field)")
+
+error_like(function () bit32.replace(0x0000, 0xFFFF, 3, -3) end,
+           "^[^:]+:%d+: bad argument #4 to 'replace' %(width must be positive%)",
+           "function replace (negative width)")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 258 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/308-io.t

@@ -0,0 +1,258 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Input/Output Library
+
+=head2 Synopsis
+
+    % prove 308-io.t
+
+=head2 Description
+
+Tests Lua Input/Output Library
+
+See "Lua 5.2 Reference Manual", section 6.8 "Input and Output Facilities",
+L<http://www.lua.org/manual/5.2/manual.html#6.8>.
+
+See "Programming in Lua", section 21 "The I/O Library".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+local lua = [[\git\moonsharp\src\Tools\lua52.exe]]
+
+plan(67)
+
+like(io.stdin, '^file %(0?[Xx]?%x+%)$', "variable stdin")
+
+like(io.stdout, '^file %(0?[Xx]?%x+%)$', "variable stdout")
+
+like(io.stderr, '^file %(0?[Xx]?%x+%)$', "variable stderr")
+
+r, msg = io.close(io.stderr)
+is(r, nil, "close (std)")
+is(msg, "cannot close standard file")
+
+is(io.flush(), true, "function flush")
+
+os.remove('file.no')
+f, msg = io.open("file.no")
+is(f, nil, "function open")
+is(msg, "file.no: No such file or directory")
+
+os.remove('file.txt')
+f = io.open('file.txt', 'w')
+f:write("file with text\n")
+f:close()
+f = io.open('file.txt')
+like(f, '^file %(0?[Xx]?%x+%)$', "function open")
+
+
+is(io.close(f), true, "function close")
+
+error_like(function () io.close(f) end,
+           "^[^:]+:%d+: attempt to use a closed file",
+           "function close (closed)")
+
+if jit then
+    todo("LuaJIT TODO. open mode")
+end
+error_like(function () io.open('file.txt', 'baz') end,
+           "^[^:]+:%d+: bad argument #2 to 'open' %(invalid mode%)",
+           "function open (bad mode)")
+
+		   
+is(io.type("not a file"), nil, "function type")
+f = io.open('file.txt')
+is(io.type(f), 'file')
+like(tostring(f), '^file %(0?[Xx]?%x+%)$')
+io.close(f)
+is(io.type(f), 'closed file')
+is(tostring(f), 'file (closed)')
+
+is(io.stdin, io.input(), "function input")
+is(io.stdin, io.input(nil))
+f = io.stdin
+
+like(io.input('file.txt'), '^file %(0?[Xx]?%x+%)$')
+is(f, io.input(f))
+
+is(io.output(), io.stdout, "function output")
+is(io.output(nil), io.stdout)
+f = io.stdout
+like(io.output('output.new'), '^file %(0?[Xx]?%x+%)$')
+is(f, io.output(f))
+os.remove('output.new')
+
+r, f = pcall(io.popen, lua .. [[ -e "print 'standard output'"]])
+if r then
+    is(io.type(f), 'file', "popen (read)")
+    is(f:read(), "standard output")
+    is(io.close(f), true)
+else
+    skip("io.popen not supported", 3)
+end
+
+r, f = pcall(io.popen, lua .. [[ -e "for line in io.lines() do print((line:gsub('e', 'a'))) end"]], 'w')
+if r then
+    is(io.type(f), 'file', "popen (write)")
+    f:write("# hello\n") -- not tested : hallo
+    is(io.close(f), true)
+else
+    skip("io.popen not supported", 2)
+end
+
+for line in io.lines('file.txt') do
+    is(line, "file with text", "function lines(filename)")
+end
+
+error_like(function () io.lines('file.no') end,
+           "No such file or directory",
+           "function lines(no filename)")
+
+f = io.tmpfile()
+is(io.type(f), 'file', "function tmpfile")
+f:write("some text")
+f:close()
+
+io.write() -- not tested
+io.write('# text', 12, "\n") -- not tested :  # text12
+
+r, msg = io.stderr:close()
+is(r, nil, "method close (std)")
+is(msg, "cannot close standard file")
+
+f = io.open('file.txt')
+is(f:close(), true, "method close")
+
+is(io.stderr:flush(), true, "method flush")
+
+error_like(function () f:flush() end,
+           "^[^:]+:%d+: attempt to use a closed file",
+           "method flush (closed)")
+
+error_like(function () f:read() end,
+           "^[^:]+:%d+: attempt to use a closed file",
+           "method read (closed)")
+
+f = io.open('file.txt')
+s = f:read()
+is(s:len(), 14, "method read")
+is(s, "file with text")
+s = f:read()
+is(s, nil)
+f:close()
+
+f = io.open('file.txt')
+error_like(function () f:read('*z') end,
+           "^[^:]+:%d+: bad argument #1 to 'read' %(invalid %w+%)",
+           "method read (invalid)")
+f:close()
+
+f = io.open('file.txt')
+s1, s2 = f:read('*l', '*l')
+is(s1:len(), 14, "method read *l")
+is(s1, "file with text")
+is(s2, nil)
+f:close()
+
+f = io.open('file.txt')
+s1, s2 = f:read('*L', '*L')
+is(s1:len(), 15, "method read *L")
+is(s1, "file with text\n")
+is(s2, nil)
+f:close()
+
+f = io.open('file.txt')
+n1, n2 = f:read('*n', '*n')
+is(n1, nil, "method read *n")
+is(n2, nil)
+f:close()
+
+f = io.open('file.txt')
+s = f:read('*a')
+is(s:len(), 15, "method read *a")
+is(s, "file with text\n")
+f:close()
+
+f = io.open('file.txt')
+is(f:read(0), '', "method read number")
+eq_array({f:read(5, 5, 15)}, {'file ', 'with ', "text\n"})
+-- print(f:read(0))
+f:close()
+
+f = io.open('file.txt')
+for line in f:lines() do
+    is(line, "file with text", "method lines")
+end
+is(io.type(f), 'file')
+f:close()
+is(io.type(f), 'closed file')
+
+f = io.open('file.txt')
+for two_char in f:lines(2) do
+    is(two_char, "fi", "method lines (with read option)")
+    break
+end
+f:close()
+
+error_like(function () f:seek('end', 0) end,
+           "^[^:]+:%d+: attempt to use a closed file",
+           "method seek (closed)")
+
+f = io.open('file.txt')
+error_like(function () f:seek('bad', 0) end,
+           "^[^:]+:%d+: bad argument #1 to 'seek' %(invalid option 'bad'%)",
+           "method seek (invalid)")
+
+f = io.open('file.txt')
+if platform and platform.osname == 'MSWin32' then
+    is(f:seek('end', 0), 16, "method seek")
+else
+    is(f:seek('end', 0), 15, "method seek")
+end
+f:close()
+
+f = io.open('file.txt')
+is(f:setvbuf('no'), true, "method setvbuf 'no'")
+
+is(f:setvbuf('full', 4096), true, "method setvbuf 'full'")
+
+is(f:setvbuf('line', 132), true, "method setvbuf 'line'")
+f:close()
+
+os.remove('file.txt') -- clean up
+
+f = io.open('file.out', 'w')
+f:close()
+error_like(function () f:write('end') end,
+           "^[^:]+:%d+: attempt to use a closed file",
+           "method write (closed)")
+
+f = io.open('file.out', 'w')
+is(f:write('end'), f, "method write")
+f:close()
+
+os.remove('file.out') --clean up
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:
+
+--]==]
+

+ 198 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/309-os.t

@@ -0,0 +1,198 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Operating System Library
+
+=head2 Synopsis
+
+    % prove 309-os.t
+
+=head2 Description
+
+Tests Lua Operating System Library
+
+See "Lua 5.2 Reference Manual", section 6.9 "Operating System Facilities",
+L<http://www.lua.org/manual/5.2/manual.html#6.9>.
+
+See "Programming in Lua", section 22 "The Operating System Library".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(54)
+
+local lua = "lua.exe"
+
+clk = os.clock()
+type_ok(clk, 'number', "function clock")
+ok(clk <= os.clock())
+
+d = os.date('!*t', 0)
+is(d.year, 1970, "function date")
+is(d.month, 1)
+is(d.day, 1)
+is(d.hour, 0)
+is(d.min, 0)
+is(d.sec, 0)
+is(d.wday, 5)
+is(d.yday, 1)
+is(d.isdst, false)
+
+is(os.date('!%d/%m/%y %H:%M:%S', 0), '01/01/70 00:00:00', "function date")
+
+like(os.date('%H:%M:%S'), '^%d%d:%d%d:%d%d', "function date")
+
+if jit and jit.version_num < 20100 then
+    todo("LuaJIT TODO. invalid strftime.", 1)
+end
+is(os.date('%Oy', 0), '70')
+if jit then
+    todo("LuaJIT TODO. invalid strftime.", 1)
+end
+
+
+
+error_like(function () os.date('%Ja', 0) end,
+           "^[^:]+:%d+: bad argument #1 to 'date' %(invalid conversion specifier '%%Ja'%)",
+           "function date (invalid)")
+
+is(os.difftime(1234, 1200), 34, "function difftime")
+is(os.difftime(1234), 1234)
+
+r = os.execute()
+is(r, true, "function execute")
+
+r, s, n = os.execute('__IMPROBABLE__')
+is(r, nil, "function execute")
+is(s, 'exit')
+type_ok(n, 'number')
+
+cmd = lua .. [[ -e "print '# hello from external Lua'; os.exit(2)"]]
+r, s, n = os.execute(cmd)
+is(r, nil)
+is(s, 'exit', "function execute & exit")
+is(n, 2, "exit value")
+
+cmd = lua .. [[ -e "print '# hello from external Lua'; os.exit(false)"]]
+r, s, n = os.execute(cmd)
+is(r, nil)
+is(s, 'exit', "function execute & exit")
+is(n, 1, "exit value")
+
+-- cmd = lua .. [[ -e "print '# hello from external Lua'; os.exit(true, true)"]]
+-- is(os.execute(cmd), true, "function execute & exit")
+
+cmd = lua .. [[ -e "print 'reached'; os.exit(); print 'not reached';"]]
+r, f = pcall(io.popen, cmd)
+if r then
+    is(f:read'*l', 'reached', "function exit")
+    is(f:read'*l', nil)
+    code = f:close()
+    is(code, true, "exit code")
+else
+    skip("io.popen not supported", 3)
+end
+
+cmd = lua .. [[ -e "print 'reached'; os.exit(3); print 'not reached';"]]
+r, f = pcall(io.popen, cmd)
+if r then
+    is(f:read'*l', 'reached', "function exit")
+    is(f:read'*l', nil)
+    r, s, n = f:close()
+    is(r, nil)
+    is(s, 'exit', "exit code")
+    is(n, 3, "exit value")
+else
+    skip("io.popen not supported", 5)
+end
+
+is(os.getenv('__IMPROBABLE__'), nil, "function getenv")
+
+user = os.getenv('LOGNAME') or os.getenv('USERNAME')
+type_ok(user, 'string', "function getenv")
+
+local f = io.open('file.rm', 'w')
+f:write("file to remove")
+f:close()
+r = os.remove("file.rm")
+is(r, true, "function remove")
+
+r, msg = os.remove('file.rm')
+is(r, nil, "function remove")
+like(msg, '^file.rm: No such file or directory')
+
+local f = io.open('file.old', 'w')
+f:write("file to rename")
+f:close()
+os.remove('file.new')
+r = os.rename('file.old', 'file.new')
+is(r, true, "function rename")
+os.remove('file.new') -- clean up
+
+r, msg = os.rename('file.old', 'file.new')
+is(r, nil, "function rename")
+like(msg, 'No such file or directory')
+
+--[[  setlocale NOT supported!
+is(os.setlocale('C', 'all'), 'C', "function setlocale")
+is(os.setlocale(), 'C')
+
+is(os.setlocale('unk_loc', 'all'), nil, "function setlocale (unknown locale)")
+
+]]
+
+like(os.time(), '^%d+%.?%d*$', "function time")
+
+like(os.time(nil), '^%d+%.?%d*$', "function time")
+
+like(os.time({
+    sec = 0,
+    min = 0,
+    hour = 0,
+    day = 1,
+    month = 1,
+    year = 2000,
+    isdst = 0,
+}), '^946%d+$', "function time")
+
+if platform and platform.intsize == 8 then
+    todo("pb on 64bit platforms")
+    -- os.time returns nil when C mktime returns < 0
+    -- this test needs a out of range value on any platform
+end
+is(os.time({
+    sec = 0,
+    min = 0,
+    hour = 0,
+    day = 1,
+    month = 1,
+    year = 1000,
+    isdst = 0,
+}), nil, "function time -> nil")
+
+error_like(function () os.time{} end,
+           "^[^:]+:%d+: field 'day' missing in date table",
+           "function time (missing field)")
+
+fname = os.tmpname()
+type_ok(fname, 'string', "function tmpname")
+ok(fname ~= os.tmpname())
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 183 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/310-debug.t

@@ -0,0 +1,183 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Debug Library
+
+=head2 Synopsis
+
+    % prove 310-debug.t
+
+=head2 Description
+
+Tests Lua Debug Library
+
+See "Lua 5.2 Reference Manual", section 6.10 "The Debug Library",
+L<http://www.lua.org/manual/5.2/manual.html#6.10>.
+
+See "Programming in Lua", section 23 "The Debug Library".
+
+=cut
+
+]]
+
+require 'Test.More'
+
+plan(51)
+
+debug = require 'debug'
+
+info = debug.getinfo(is)
+type_ok(info, 'table', "function getinfo (function)")
+is(info.func, is, " .func")
+
+info = debug.getinfo(is, 'L')
+type_ok(info, 'table', "function getinfo (function, opt)")
+type_ok(info.activelines, 'table')
+
+info = debug.getinfo(1)
+type_ok(info, 'table', "function getinfo (level)")
+like(info.func, "^function: [0]?[Xx]?%x+", " .func")
+
+is(debug.getinfo(12), nil, "function getinfo (too depth)")
+
+error_like(function () debug.getinfo('bad') end,
+           "bad argument #1 to 'getinfo' %(function or level expected%)",
+           "function getinfo (bad arg)")
+
+error_like(function () debug.getinfo(is, 'X') end,
+           "bad argument #2 to 'getinfo' %(invalid option%)",
+           "function getinfo (bad opt)")
+
+local name, value = debug.getlocal(0, 1)
+type_ok(name, 'string', "function getlocal (level)")
+is(value, 0)
+
+error_like(function () debug.getlocal(42, 1) end,
+           "bad argument #1 to 'getlocal' %(level out of range%)",
+           "function getlocal (out of range)")
+
+local name, value = debug.getlocal(like, 1)
+type_ok(name, 'string', "function getlocal (func)")
+is(value, nil)
+
+t = {}
+is(debug.getmetatable(t), nil, "function getmetatable")
+t1 = {}
+debug.setmetatable(t, t1)
+is(debug.getmetatable(t), t1)
+
+a = true
+is(debug.getmetatable(a), nil)
+debug.setmetatable(a, t1)
+is(debug.getmetatable(t), t1)
+
+a = 3.14
+is(debug.getmetatable(a), nil)
+debug.setmetatable(a, t1)
+is(debug.getmetatable(t), t1)
+
+local reg = debug.getregistry()
+type_ok(reg, 'table', "function getregistry")
+type_ok(reg._LOADED, 'table')
+
+local name = debug.getupvalue(plan, 1)
+type_ok(name, 'string', "function getupvalue")
+
+debug.sethook()
+hook, mask, count = debug.gethook()
+is(hook, nil, "function gethook")
+is(mask, '')
+is(count, 0)
+local function f () end
+debug.sethook(f, 'c', 42)
+hook , mask, count = debug.gethook()
+is(hook, f, "function gethook")
+is(mask, 'c')
+is(count, 42)
+
+co = coroutine.create(function () print "thread" end)
+hook = debug.gethook(co)
+if jit then
+    todo("LuaJIT TODO. debug.gethook(thread)", 1)
+end
+is(hook, nil, "function gethook(thread)")
+
+local name = debug.setlocal(0, 1, 0)
+type_ok(name, 'string', "function setlocal (level)")
+
+local name = debug.setlocal(0, 42, 0)
+is(name, nil, "function setlocal (level)")
+
+error_like(function () debug.setlocal(42, 1, true) end,
+           "bad argument #1 to 'setlocal' %(level out of range%)",
+           "function getlocal (out of range)")
+
+t = {}
+t1 = {}
+is(debug.setmetatable(t, t1), t, "function setmetatable")
+is(getmetatable(t), t1)
+
+error_like(function () debug.setmetatable(t, true) end,
+           "^[^:]+:%d+: bad argument #2 to 'setmetatable' %(nil or table expected%)")
+
+local name = debug.setupvalue(plan, 1, require 'Test.Builder':new())
+type_ok(name, 'string', "function setupvalue")
+
+local name = debug.setupvalue(plan, 42, true)
+is(name, nil)
+
+local u = io.tmpfile()
+local old = debug.getuservalue(u)
+if jit then
+    type_ok(old, 'table', "function getuservalue")
+else
+    is(old, nil, "function getuservalue")
+end
+is(debug.getuservalue(true), nil)
+local data = {}
+r = debug.setuservalue(u, data)
+is(r, u, "function setuservalue")
+is(debug.getuservalue(u), data)
+r = debug.setuservalue(u, old)
+is(debug.getuservalue(u), old)
+
+error_like(function () debug.setuservalue({}, data) end,
+           "^[^:]+:%d+: bad argument #1 to 'setuservalue' %(userdata expected, got table%)")
+
+error_like(function () debug.setuservalue(u, true) end,
+           "^[^:]+:%d+: bad argument #2 to 'setuservalue' %(table expected, got boolean%)")
+
+like(debug.traceback(), "^stack traceback:\n", "function traceback")
+
+like(debug.traceback("message\n"), "^message\n\nstack traceback:\n", "function traceback with message")
+
+like(debug.traceback(false), "false", "function traceback")
+
+local id = debug.upvalueid(plan, 1)
+type_ok(id, 'userdata', "function upvalueid")
+
+debug.upvaluejoin (pass, 1, fail, 1)
+
+error_like(function () debug.upvaluejoin(true, 1, nil, 1) end,
+           "bad argument #1 to 'upvaluejoin' %(function expected, got boolean%)",
+           "function upvaluejoin (bad arg)")
+
+error_like(function () debug.upvaluejoin(pass, 1, true, 1) end,
+           "bad argument #3 to 'upvaluejoin' %(function expected, got boolean%)",
+           "function upvaluejoin (bad arg)")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 346 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/314-regex.t

@@ -0,0 +1,346 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Regex Compiler
+
+=head2 Synopsis
+
+    % prove 314-regex.t
+
+=head2 Description
+
+Tests Lua Regex
+
+Individual tests are stored in the C<rx_*> files in the same directory;
+There is one test per line: each test consists of the following
+columns (separated by one *or more* tabs):
+
+=over 4
+
+=item pattern
+
+The Lua regex to test.
+
+=item target
+
+The string that will be matched against the pattern. Use '' to indicate
+an empty string.
+
+=item result
+
+The expected result of the match.
+
+=item description
+
+Description of the test.
+
+=back
+
+=cut
+
+--]]
+
+local test_patterns = {
+	[===[(a.)..(..)		zzzabcdefzzz	ab\tef			basic match]===], 
+	[===[(a(b(c))(d))		abcd		abcd\tbc\tc\td		nested match]===], 
+	[===[((%w+))			abcd		abcd\tabcd		nested match]===], 
+	[===[(a*(.)%w(%s*))		aa!b c		aa!b \t!\t 		nested match]===], 
+	[===[(a?)..			abcd		a			opt]===], 
+	[===[(A?)..			abcd		''			opt]===], 
+	[===[()aa()			flaaap		3\t5			empty capture]===], 
+	[===[(.)%1			bookkeeper	o			backreference]===], 
+	[===[(%w+)%s+%1		hello hello	hello			backreference]===], 
+	[===[(.*)x			123x		123			repeated dot capture]===], 
+	[===[$(%w+)			$abc=		abc			not escaped]===], 
+	[===[[c]			abcdef		c		character class]===], 
+	[===[^[a]			abcdef		a		anchored character class]===], 
+	[===[[^e]			abcdef		a		negated character class]===], 
+	[===[^[a]?			abcdef		a		anchored optional character class]===], 
+	[===[[^e]?			abcdef		a		negated optional character class]===], 
+	[===[^[^e]			abcdef		a		anchored negated character class]===], 
+	[===[^[^a]			abcdef		nil		anchored negated character class]===], 
+	[===[[b-d]			abcdef		b		character range]===], 
+	[===[[b-d]			abxxef		b		character range]===], 
+	[===[[b-d]			axcxef		c		character range]===], 
+	[===[[b-d]			axxdef		d		character range]===], 
+	[===[[b-d]			axxxef		nil		character range]===], 
+	[===[[^b-d]			abcdef		a		negated character range]===], 
+	[===[[^b-d]			bbccdd		nil		negated character range]===], 
+	[===[[-]			ab-def		-		unescaped hyphen]===], 
+	[===[[%-]			ab-def		-		escaped hyphen]===], 
+	[===[[%-]			abcdef		nil		escaped hyphen]===], 
+	[===[[^%-]			---x--		x		negated escaped hyphen]===], 
+	[===[[^%-]			------		nil		negated escaped hyphen]===], 
+	[===[[%-+]			ab-def		-		escaped hyphen in range]===], 
+	[===[[%-+]			ab+def		+		escaped hyphen in range]===], 
+	[===[[%-+]			abcdef		nil		escaped hyphen in range]===], 
+	[===[[+%-]			ab-def		-		escaped hyphen in range]===], 
+	[===[[+%-]			ab+def		+		escaped hyphen in range]===], 
+	[===[[+%-]			abcdef		nil		escaped hyphen in range]===], 
+	[===[[^%-+]			---x--		x		negated escaped hyphen in range]===], 
+	[===[[^%-+]			------		nil		negated escaped hyphen in range]===], 
+	[===[[^+%-]			---x--		x		negated escaped hyphen in range]===], 
+	[===[[^+%-]			------		nil		negated escaped hyphen in range]===], 
+	[===[["\\]			\\		\		escaped backslash]===], 
+	[===[[%]]			]		]		escaped close bracket]===], 
+	[===[[%]			\\]]		/malformed pattern %(missing ']'%)/	unescaped backslash (or no closing brace)]===], 
+	[===[ab\\cd			ab\092cd	ab\cd		literal match with backslash]===], 
+	[===[%?			ab<?		?		literal match with question mark]===], 
+	[===[[A-Z0-9]		abcdef		nil		two enumerated ranges]===], 
+	[===[[A-Z0-9]		abcDef		D		two enumerated ranges]===], 
+	[===[.			a		a		dot (.)]===], 
+	[===[.			\n		\n		dot (.)]===], 
+	[===[.			''		nil		dot (.)]===], 
+	[===[a%s+f			abcdef		nil		whitespace (%s)]===], 
+	[===[ab%s+cdef		ab  cdef	ab  cdef	whitespace (%s)]===], 
+	[===[a%S+f			abcdef		abcdef		not whitespace (%S)]===], 
+	[===[a%S+f			ab cdef		nil		not whitespace (%S)]===], 
+	[===[^abc			abcdef		abc		start and end of string (^)]===], 
+	[===[^abc			abc\ndef	abc		start and end of string (^)]===], 
+	[===[^abc			def\nabc	nil		start and end of string (^)]===], 
+	[===[def\n^abc		def\nabc	nil		start and end of string (^)]===], 
+	[===[def$			abcdef		def		start and end of string ($)]===], 
+	[===[def$			abc\ndef	def		start and end of string ($)]===], 
+	[===[def$			def\nabc	nil		start and end of string ($)]===], 
+	[===[def$\nabc		def\nabc	nil		start and end of string (^)]===], 
+	[===[abc\n$			abc\n		abc\n		end of string ($)]===], 
+	[===[abc$			abc\n		nil		end of string ($)]===], 
+	[===[c\nd			abc\ndef	c\nd		newline (\n)]===], 
+	[===[c\nd			abc\010def	c\nd		newline (\n)]===], 
+	[===[c\n+d			abc\n\ndef	c\n\nd		newline (\n)]===], 
+	[===[a\n+f			abcdef		nil		newline (\n)]===], 
+	[===[b\nc			abc\ndef	nil		newline (\n)]===], 
+	[===[c\td			abc\tdef	c\td		horizontal tab (\t)]===], 
+	[===[c\td			abc\09def	c\td		horizontal tab (\t)]===], 
+	[===[c\t+d			abc\t\tdef	c\t\td		horizontal tab (\t)]===], 
+	[===[a\t+f			abcdef		nil		horizontal tab (\t)]===], 
+	[===[b\tc			abc\tdef	nil		horizontal tab (\t)]===], 
+	[===[c\rd			abc\rdef	c\rd		return (\r)]===], 
+	[===[c\rd			abc\013def	c\rd		return (\r)]===], 
+	[===[c\r+d			abc\r\rdef	c\r\rd		return (\r)]===], 
+	[===[a\r+f			abcdef		nil		return (\r)]===], 
+	[===[b\rc			abc\rdef	nil		return (\r)]===], 
+	[===[c\fd			abc\fdef	c\fd		formfeed (\f)]===], 
+	[===[c\fd			abc\012def	c\fd		formfeed (\f)]===], 
+	[===[c\f+d			abc\f\fdef	c\f\fd		formfeed (\f)]===], 
+	[===[a\f+f			abcdef		nil		formfeed (\f)]===], 
+	[===[b\fc			abc\fdef	nil		formfeed (\f)]===], 
+	[===[c\033d			abc!def		c!d		dec (\0)]===], 
+	[===[c\033d			abc\033def	c!d		dec (\0)]===], 
+	[===[c\033+d			abc!!def	c!!d		dec (\0)]===], 
+	[===[a\033+f			abcdef		nil		dec (\0)]===], 
+	[===[b\033c			abc!def		nil		dec (\0)]===], 
+	[===[a%^d			a^d		a^d		escaped (useless)]===], 
+	[===[a^d			a^d		a^d		not escaped]===], 
+	[===[%^d			^d		^d		escaped]===], 
+	[===[a%$d			a$d		a$d		escaped (useless)]===], 
+	[===[a$d			a$d		a$d		not escaped]===], 
+	[===[a%$			a$		a$		escaped]===], 
+	[===[a%(d			a(d		a(d		escaped]===], 
+	[===[a%)d			a)d		a)d		escaped]===], 
+	[===[a%%d			a%d		a%d		escaped]===], 
+	[===[a%			a%		/malformed pattern %(ends with '%%'%)/	not escaped]===], 
+	[===[a%.d			a.d		a.d		escaped]===], 
+	[===[a%.d			abd		nil		escaped]===], 
+	[===[a%[d			a[d		a[d		escaped]===], 
+	[===[a%]d			a]d		a]d		escaped]===], 
+	[===[a%*d			a*d		a*d		escaped]===], 
+	[===[*ad			*ad		*ad		not escaped]===], 
+	[===[a%+d			a+d		a+d		escaped]===], 
+	[===[a%-d			a-d		a-d		escaped]===], 
+	[===[a%?d			a?d		a?d		escaped]===], 
+	[===[a%yd			ayd		ayd		escaped]===], 
+	[===[a%w+f			a=[ *f		nil		word character]===], 
+	[===[a%w+f			abcdef		abcdef		word character]===], 
+	[===[a%W+f			a&%- f		a&%- f		not word character]===], 
+	[===[a%W+f			abcdef		nil		not word character]===], 
+	[===[a%d+f			abcdef		nil		digit]===], 
+	[===[ab%d+cdef		ab42cdef	ab42cdef	digit]===], 
+	[===[a%D+f			abcdef		abcdef		not digit]===], 
+	[===[a%D+f			ab0cdef		nil		not digit]===], 
+	[===[a%l+f			aBCDEf		nil		lowercase letter]===], 
+	[===[a%l+f			abcdef		abcdef		lowercase letter]===], 
+	[===[a%L+f			a&2D f		a&2D f		not lowercase letter]===], 
+	[===[a%L+f			aBCdEf		nil		not lowercase letter]===], 
+	[===[a%u+f			abcdef		nil		uppercase letter]===], 
+	[===[a%u+f			aBCDEf		aBCDEf		uppercase letter]===], 
+	[===[a%U+f			a&2d f		a&2d f		not uppercase letter]===], 
+	[===[a%U+f			a&2D f		nil		not uppercase letter]===], 
+	[===[a%a+f			aBcDef		aBcDef		all letter]===], 
+	[===[a%a+f			a=[ *f		nil		all letter]===], 
+	[===[a%A+f			a&%- f		a&%- f		not all letter]===], 
+	[===[a%A+f			abcdef		nil		not all letter]===], 
+	[===[a%g+f			aBcDef		aBcDef		printable]===], 
+	[===[a%g+f			a=[ *f		nil		printable]===], 
+	[===[a%G+f			a \nf		a \nf		not printable]===], 
+	[===[a%G+f			abcdef		nil		not printable]===], 
+	[===[a%p+f			abcdef		nil		ponctuation]===], 
+	[===[a%p+f			a,;:!f		a,;:!f		ponctuation]===], 
+	[===[a%P+f			abcdef		abcdef		not ponctuation]===], 
+	[===[a%P+f			adc:ef		nil		not ponctuation]===], 
+	[===[a%c+f			abcdef		nil		control character]===], 
+	[===[a%c+f			a\04\03\02f	a\04\03\02f	control character]===], 
+	[===[a%C+f			abcdef		abcdef		not control character]===], 
+	[===[a%C+f			abc\01ef	nil		not control character]===], 
+	[===[a%x+f			axyzef		nil		hexadecimal]===], 
+	[===[a%x+f			ab3Def		ab3Def		hexadecimal]===], 
+	[===[a%X+f			abcdef		nil		not hexadecimal]===], 
+	[===[a%X+f			axy;Zf		axy;Zf		not hexadecimal]===], 
+	[===[a%z+f			abcdef		nil		zero (deprecated)]===], 
+	[===[a\0+f			abcdef		nil		zero]===], 
+	[===[a%z+f			a\0f		a\0f		zero (deprecated)]===], 
+	[===[a\0+f			a\0f		a\0f		zero]===], 
+	[===[a%Z+f			abcdef		abcdef		not zero (deprecated)]===], 
+	[===[a[^\0]+f		abcdef		abcdef		not zero]===], 
+	[===[a%Z+f			abc\0ef		nil		not zero (deprecated)]===], 
+	[===[a[^\0]+f		abc\0ef		nil		not zero]===], 
+	[===[a%b()f			a(bcde)f	a(bcde)f	balanced]===], 
+	[===[a%b()f			a(b(de)f	nil		balanced]===], 
+	[===[a%b()f			a(b(d)e)f	a(b(d)e)f	balanced]===], 
+	[===[a%b''f			a'bcde'f	a'bcde'f	balanced]===], 
+	[===[a%b""f			a"bcde"f	a"bcde"f	balanced]===], 
+	[===[%f[b]bc			abcdef		bc		frontier]===], 
+	[===[%f[b]c			abcdef		nil		frontier]===], 
+	[===[%f[^ab]c		abacdef		c		frontier]===], 
+	[===[%f[^ab]d		abacdef		nil		frontier]===]
+}	
+
+require 'Test.More'
+
+plan(162)
+
+
+local function split (line)
+    local pattern, target, result, desc = '', '', '', ''
+    local idx = 1
+    local c = line:sub(idx, idx)
+    while (c ~= '' and c ~= "\t") do
+        if (c == '"') then
+            pattern = pattern .. "\\\""
+        else
+            pattern = pattern .. c
+        end
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    if pattern == "''" then
+        pattern = ''
+    end
+    while (c ~= '' and c == "\t") do
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    while (c ~= '' and c ~= "\t") do
+        if (c == '"') then
+            target = target .. "\\\""
+        else
+            target = target .. c
+        end
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    if target == "''" then
+        target = ''
+    end
+    while (c ~= '' and c == "\t") do
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    while (c ~= '' and c ~= "\t") do
+        if c == "\\" then
+            idx = idx + 1
+            c = line:sub(idx, idx)
+            if     c == 'f' then
+                result = result .. "\f"
+            elseif c == 'n' then
+                result = result .. "\n"
+            elseif c == 'r' then
+                result = result .. "\r"
+            elseif c == 't' then
+                result = result .. "\t"
+            elseif c == '0' then
+                idx = idx + 1
+                c = line:sub(idx, idx)
+                if     c == '1' then
+                    result = result .. "\01"
+                elseif c == '2' then
+                    result = result .. "\02"
+                elseif c == '3' then
+                    result = result .. "\03"
+                elseif c == '4' then
+                    result = result .. "\04"
+                else
+                    result = result .. "\0" .. c
+                end
+            elseif c == "\t" then
+                result = result .. "\\"
+            else
+                result = result .. "\\" .. c
+            end
+        else
+            result = result .. c
+        end
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    if result == "''" then
+        result = ''
+    end
+    while (c ~= '' and c == "\t") do
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    while (c ~= '' and c ~= "\t") do
+        desc = desc .. c
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    return pattern, target, result, desc
+end
+
+local test_number = 0
+
+for _, line in ipairs(test_patterns) do
+    if line:len() == 0 then
+        break
+    end
+    local pattern, target, result, desc = split(line)
+    test_number = test_number + 1
+
+    local code = [[
+            local t = {string.match("]] .. target .. [[", "]] .. pattern .. [[")}
+            if #t== 0 then
+                return 'nil'
+            else
+                return table.concat(t, "\t")
+            end
+    ]]
+    local compiled, msg = load(code)
+    if not compiled then
+        error("can't compile : " .. code .. "\n" .. msg)
+    end
+    if result:sub(1, 1) == '/' then
+        local pattern = result:sub(2, result:len() - 1)
+        error_like(compiled, pattern, desc)
+    else
+        local out
+        pcall(function () out = compiled() end)
+        is(out, result, desc)
+    end
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 124 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/320-stdin.t

@@ -0,0 +1,124 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Library
+
+=head2 Synopsis
+
+    % prove 320-stdin.t
+
+=head2 Description
+
+Tests Lua Basic & IO Libraries with stdin
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+local lua = (platform and platform.lua) or arg[-1]
+
+if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
+    skip_all "io.popen not supported"
+end
+
+plan(12)
+
+f = io.open('lib1.lua', 'w')
+f:write[[
+function norm (x, y)
+    return (x^2 + y^2)^0.5
+end
+
+function twice (x)
+    return 2*x
+end
+]]
+f:close()
+
+cmd = lua .. [[ -e "dofile(); n = norm(3.4, 1.0); print(twice(n))" < lib1.lua]]
+f = io.popen(cmd)
+like(f:read'*l', '^7%.088', "function dofile (stdin)")
+f:close()
+
+os.remove('lib1.lua') -- clean up
+
+f = io.open('foo.lua', 'w')
+f:write[[
+function foo (x)
+    return x
+end
+]]
+f:close()
+
+cmd = lua .. [[ -e "f = loadfile(); print(foo); f(); print(foo('ok'))" < foo.lua]]
+f = io.popen(cmd)
+is(f:read'*l', 'nil', "function loadfile (stdin)")
+is(f:read'*l', 'ok')
+f:close()
+
+os.remove('foo.lua') -- clean up
+
+f = io.open('file.txt', 'w')
+f:write("file with text\n")
+f:close()
+
+cmd = lua .. [[ -e "print(io.read'*l'); print(io.read'*l'); print(io.type(io.stdin))" < file.txt]]
+f = io.popen(cmd)
+is(f:read'*l', 'file with text', "function io.read *l")
+is(f:read'*l', 'nil')
+is(f:read'*l', 'file')
+f:close()
+
+f = io.open('number.txt', 'w')
+f:write("6.0     -3.23   15e12\n")
+f:write("4.3     234     1000001\n")
+f:close()
+
+cmd = lua .. [[ -e "while true do local n1, n2, n3 = io.read('*number', '*number', '*number'); if not n1 then break end; print(math.max(n1, n2, n3)) end" < number.txt]]
+f = io.popen(cmd)
+is(f:read'*l', '15000000000000', "function io:read *number")
+is(f:read'*l', '1000001')
+f:close()
+
+os.remove('number.txt') -- clean up
+
+cmd = lua .. [[ -e "for line in io.lines() do print(line) end" < file.txt]]
+f = io.popen(cmd)
+is(f:read'*l', 'file with text', "function io.lines")
+is(f:read'*l', nil)
+f:close()
+
+os.remove('file.txt') -- clean up
+
+f = io.open('dbg.txt', 'w')
+f:write("print 'ok'\n")
+f:write("error 'dbg'\n")
+f:write("cont\n")
+f:close()
+
+cmd = lua .. [[ -e "debug.debug()" < dbg.txt]]
+f = io.popen(cmd)
+is(f:read'*l', 'ok', "function debug.debug")
+is(f:read'*l', nil)
+f:close()
+
+os.remove('dbg.txt') -- clean up
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 67 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/Makefile

@@ -0,0 +1,67 @@
+
+LUA = ../../lua-5.2.3/src/lua
+LUAJIT = luajit
+LUA_COVER = ../../gh-pages/lua-TestMore/lua-5.2.3/src/lua
+
+LUA_VERSION = $(shell $(LUA) -e "print(_VERSION)")
+OSNAME = $(shell perl -MConfig -e "print Config->{osname}")
+ARCHNAME = $(shell perl -MConfig -e "print Config->{archname}")
+INTSIZE = $(shell perl -MConfig -e "print Config->{longsize}")
+
+export LUA_PATH=;;../src/?.lua
+export LUA_INIT=platform = { osname=[[$(OSNAME)]], intsize=$(INTSIZE), compat=true }
+
+version:
+	@echo $(LUA_VERSION)
+
+harness:
+	prove --exec=$(LUA) *.t
+
+sanity:
+	prove --exec=$(LUA) 0*.t
+
+luajit:
+	prove --exec=$(LUAJIT) *.t
+
+coverage:
+	prove --exec=$(LUA_COVER) *.t
+
+upload_pl = \
+use strict; \
+use warnings; \
+use LWP::UserAgent; \
+my $$ua = LWP::UserAgent->new(); \
+$$ua->env_proxy(); \
+my $$server = q{http://smolder.parrot.org}; \
+my $$project_id = 7; \
+my $$url = $$server . q{/app/projects/process_add_report/} . $$project_id; \
+my $$response = $$ua->post( \
+    $$url, \
+    Content_Type => q{form-data}, \
+    Content      => [ \
+        architecture => q{$(ARCHNAME)}, \
+        platform     => q{$(OSNAME)}, \
+        tags         => q{$(OSNAME), $(ARCHNAME), $(LUA), $(LUA_VERSION)}, \
+        comments     => q{$(LUA)}, \
+        username     => q{parrot-autobot}, \
+        password     => q{qa_rocks}, \
+        project_id   => $$project_id, \
+        report_file  => [q{test_lua52.tar.gz}], \
+        ] \
+); \
+if ($$response->code == 302) { \
+    my ($$report_id) = $$response->content =~ /Reported .(\d+) added/i; \
+    my $$report_url = $$server . q{/app/projects/report_details/} . $$report_id; \
+    my $$project_url = $$server . q{/app/projects/smoke_reports/} . $$project_id; \
+    print qq{Test report successfully sent to Smolder at\n$$report_url} \
+      . qq{\nYou can see other recent reports at\n$$project_url .\n\n}; \
+} \
+else { \
+    die qq{Could not upload report to Smolder at $$server} \
+      . qq{\nHTTP CODE: } . $$response->code . q{ (} \
+      . $$response->message . qq{)\n}; \
+}
+
+smolder:
+	-prove --archive test_lua52.tar.gz --exec=$(LUA) *.t
+	perl -e '$(upload_pl)'

+ 392 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/Modules/Test/Builder.lua

@@ -0,0 +1,392 @@
+
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+
+local debug = nil; -- require 'debug'
+local io = nil; -- require 'io'
+local os = nil; -- require 'os'
+local error = error
+local gsub = require 'string'.gsub
+local match = require 'string'.match
+local pairs = pairs
+local pcall = pcall
+local print = print
+local rawget = rawget
+local setmetatable = setmetatable
+local tconcat = require 'table'.concat
+local tonumber = tonumber
+local tostring = tostring
+local type = type
+
+_ENV = nil
+local m = {}
+
+local testout = io and io.stdout
+local testerr = io and (io.stderr or io.stdout)
+
+function m.puts (f, str)
+    f:write(str)
+end
+
+local function _print_to_fh (self, f, ...)
+   -- if f then
+   --     local msg = tconcat({...})
+   --     gsub(msg, "\n", "\n" .. self.indent)
+   --     m.puts(f, self.indent .. msg .. "\n")
+   -- else
+        print(self.indent, ...)
+   -- end
+end
+
+local function _print (self, ...)
+    _print_to_fh(self, self:output(), ...)
+end
+
+local function print_comment (self, f, ...)
+    local arg = {...}
+    for k, v in pairs(arg) do
+        arg[k] = tostring(v)
+    end
+    local msg = tconcat(arg)
+    msg = gsub(msg, "\n", "\n# ")
+    msg = gsub(msg, "\n# \n", "\n#\n")
+    msg = gsub(msg, "\n# $", '')
+    _print_to_fh(self, f, "# ", msg)
+end
+
+function m.create ()
+    local o = {
+        data = setmetatable({}, { __index = m }),
+    }
+    setmetatable(o, {
+        __index = function (t, k)
+                        return rawget(t, 'data')[k]
+                  end,
+        __newindex = function (t, k, v)
+                        rawget(o, 'data')[k] = v
+                  end,
+    })
+    o:reset()
+    return o
+end
+
+local test
+function m.new ()
+    test = test or m.create()
+    return test
+end
+
+local function in_todo (self)
+    return self.todo_upto >= self.curr_test
+end
+
+function m:child (name)
+    if self.child_name then
+        error("You already have a child named (" .. self.child_name .. " running")
+    end
+    local child = m.create()
+    child.indent    = self.indent .. '    '
+    child.out_file  = self.out_file
+    child.fail_file = in_todo(self) and self.todo_file or self.fail_file
+    child.todo_file = self.todo_file
+    child.parent    = self
+    self.child_name = name
+    return child
+end
+
+local function plan_handled (self)
+    return self.have_plan or self.no_plan or self._skip_all
+end
+
+function m:subtest (name, func)
+    if type(func) ~= 'function' then
+        error("subtest()'s second argument must be a function")
+    end
+    self:diag('Subtest: ' .. name)
+    local child = self:child(name)
+    local parent = self.data
+    self.data = child.data
+    local r, msg = pcall(func)
+    child.data = self.data
+    self.data = parent
+    if not r and not child._skip_all then
+        error(msg, 0)
+    end
+    if not plan_handled(child) then
+        child:done_testing()
+    end
+    child:finalize()
+end
+
+function m:finalize ()
+    if not self.parent then
+        return
+    end
+    if self.child_name then
+        error("Can't call finalize() with child (" .. self.child_name .. " active")
+    end
+    local parent = self.parent
+    local name = parent.child_name
+    parent.child_name = nil
+    if self._skip_all then
+        parent:skip(self._skip_all)
+    elseif self.curr_test == 0 then
+        parent:ok(false, "No tests run for subtest \"" .. name .. "\"", 2)
+    else
+        parent:ok(self.is_passing, name, 2)
+    end
+    self.parent = nil
+end
+
+function m:reset ()
+    self.curr_test = 0
+    self._done_testing = false
+    self.expected_tests = 0
+    self.is_passing = true
+    self.todo_upto = -1
+    self.todo_reason = nil
+    self.have_plan = false
+    self.no_plan = false
+    self._skip_all = false
+    self.have_output_plan = false
+    self.indent = ''
+    self.parent = false
+    self.child_name = false
+    self:reset_outputs()
+end
+
+local function _output_plan (self, max, directive, reason)
+    if self.have_output_plan then
+        error("The plan was already output")
+    end
+    local out = "1.." .. max
+    if directive then
+        out = out .. " # " .. directive
+    end
+    if reason then
+        out = out .. " " .. reason
+    end
+    _print(self, out)
+    self.have_output_plan = true
+end
+
+function m:plan (arg)
+    if self.have_plan then
+        error("You tried to plan twice")
+    end
+    if type(arg) == 'string' and arg == 'no_plan' then
+        self.have_plan = true
+        self.no_plan = true
+        return true
+    elseif type(arg) ~= 'number' then
+        error("Need a number of tests")
+    elseif arg < 0 then
+        error("Number of tests must be a positive integer.  You gave it '" .. arg .."'.")
+    else
+        self.expected_tests = arg
+        self.have_plan = true
+        _output_plan(self, arg)
+        return arg
+    end
+end
+
+function m:done_testing (num_tests)
+    if num_tests then
+        self.no_plan = false
+    end
+    num_tests = num_tests or self.curr_test
+    if self._done_testing then
+        tb:ok(false, "done_testing() was already called")
+        return
+    end
+    self._done_testing = true
+    if self.expected_tests > 0 and num_tests ~= self.expected_tests then
+        self:ok(false, "planned to run " .. self.expected_tests
+                    .. " but done_testing() expects " .. num_tests)
+    else
+        self.expected_tests = num_tests
+    end
+    if not self.have_output_plan then
+        _output_plan(self, num_tests)
+    end
+    self.have_plan = true
+    -- The wrong number of tests were run
+    if self.expected_tests ~= self.curr_test then
+        self.is_passing = false
+    end
+    -- No tests were run
+    if self.curr_test == 0 then
+        self.is_passing = false
+    end
+end
+
+function m:has_plan ()
+    if self.expected_tests > 0 then
+        return self.expected_tests
+    end
+    if self.no_plan then
+        return 'no_plan'
+    end
+    return nil
+end
+
+function m:skip_all (reason)
+    if self.have_plan then
+        error("You tried to plan twice")
+    end
+    self._skip_all = reason
+    _output_plan(self, 0, 'SKIP', reason)
+    if self.parent then
+        error("skip_all in child", 0)
+    end
+    -- os.exit(0)
+end
+
+local function _check_is_passing_plan (self)
+    local plan = self:has_plan()
+    if not plan or not tonumber(plan) then
+        return
+    end
+    if plan < self.curr_test then
+        self.is_passing = false
+    end
+end
+
+function m:ok (test, name, level)
+    if self.child_name then
+        name = name or 'unnamed test'
+        self.is_passing = false
+        error("Cannot run test (" .. name .. ") with active children")
+    end
+    name = name or ''
+    level = level or 0
+    self.curr_test = self.curr_test + 1
+    name = tostring(name)
+    if match(name, '^[%d%s]+$') then
+        self:diag("    You named your test '" .. name .."'.  You shouldn't use numbers for your test names."
+        .. "\n    Very confusing.")
+    end
+    local out = ''
+    if not test then
+        out = "not "
+    end
+    out = out .. "ok " .. self.curr_test
+    if name ~= '' then
+        out = out .. " - " .. name
+    end
+    if self.todo_reason and in_todo(self) then
+        out = out .. " # TODO " .. self.todo_reason
+    end
+    _print(self, out)
+    if not test then
+        local msg = in_todo(self) and "Failed (TODO)" or "Failed"
+        local info = debug and debug.getinfo(3 + level)
+        if info then
+            local file = info.short_src
+            local line = info.currentline
+            self:diag("    " .. msg .. " test (" .. file .. " at line " .. line .. ")")
+        else
+            self:diag("    " .. msg .. " test")
+        end
+    end
+    if not test and not in_todo(self) then
+        self.is_passing = false
+    end
+    _check_is_passing_plan(self)
+end
+
+function m:BAIL_OUT (reason)
+    local out = "Bail out!"
+    if reason then
+        out = out .. "  " .. reason
+    end
+    _print(self, out)
+    os.exit(255)
+end
+
+function m:current_test (num)
+    if num then
+        self.curr_test = num
+    end
+    return self.curr_test
+end
+
+function m:todo (reason, count)
+    count = count or 1
+    self.todo_upto = self.curr_test + count
+    self.todo_reason = reason
+end
+
+function m:skip (reason)
+    local name = "# skip"
+    if reason then
+        name = name .. " " .. reason
+    end
+    self:ok(true, name, 1)
+end
+
+function m:todo_skip (reason)
+    local name = "# TODO & SKIP"
+    if reason then
+        name = name .. " " .. reason
+    end
+    self:ok(false, name, 1)
+end
+
+function m:skip_rest (reason)
+    for i = self.curr_test, self.expected_tests do
+        tb:skip(reason)
+    end
+end
+
+local function diag_file (self)
+    if in_todo(self) then
+        return self:todo_output()
+    else
+        return self:failure_output()
+    end
+end
+
+function m:diag (...)
+    print_comment(self, diag_file(self), ...)
+end
+
+function m:note (...)
+    print_comment(self, self:output(), ...)
+end
+
+function m:output (f)
+    if f then
+        self.out_file = f
+    end
+    return self.out_file
+end
+
+function m:failure_output (f)
+    if f then
+        self.fail_file = f
+    end
+    return self.fail_file
+end
+
+function m:todo_output (f)
+    if f then
+        self.todo_file = f
+    end
+    return self.todo_file
+end
+
+function m:reset_outputs ()
+    self:output(testout)
+    self:failure_output(testerr)
+    self:todo_output(testout)
+end
+
+return m
+--
+-- Copyright (c) 2009-2012 Francois Perrad
+--
+-- This library is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--

+ 383 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/Modules/Test/More.lua

@@ -0,0 +1,383 @@
+
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+
+local loadstring = loadstring or load
+local pairs = pairs
+local pcall = pcall
+local require = require
+local tostring = tostring
+local type = type
+local match = require 'string'.match
+local unpack = require 'table'.unpack or unpack
+local _G = _G
+
+local tb = require 'Test.Builder'.new()
+
+_ENV = nil
+local m = {}
+
+function m.plan (arg)
+    tb:plan(arg)
+end
+
+function m.done_testing (num_tests)
+    tb:done_testing(num_tests)
+end
+
+function m.skip_all (reason)
+    tb:skip_all(reason)
+end
+
+function m.BAIL_OUT (reason)
+    tb:BAIL_OUT(reason)
+end
+
+function m.ok (test, name)
+    tb:ok(test, name)
+end
+
+function m.nok (test, name)
+    tb:ok(not test, name)
+end
+
+function m.is (got, expected, name)
+    local pass = got == expected
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("         got: " .. tostring(got)
+           .. "\n    expected: " .. tostring(expected))
+    end
+end
+
+function m.isnt (got, expected, name)
+    local pass = got ~= expected
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("         got: " .. tostring(got)
+           .. "\n    expected: anything else")
+    end
+end
+
+function m.like (got, pattern, name)
+    if type(pattern) ~= 'string' then
+        tb:ok(false, name)
+        tb:diag("pattern isn't a string : " .. tostring(pattern))
+        return
+    end
+    got = tostring(got)
+    local pass = match(got, pattern)
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("                  '" .. got .. "'"
+           .. "\n    doesn't match '" .. pattern .. "'")
+    end
+end
+
+function m.unlike (got, pattern, name)
+    if type(pattern) ~= 'string' then
+        tb:ok(false, name)
+        tb:diag("pattern isn't a string : " .. tostring(pattern))
+        return
+    end
+    got = tostring(got)
+    local pass = not match(got, pattern)
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("                  '" .. got .. "'"
+           .. "\n          matches '" .. pattern .. "'")
+    end
+end
+
+local cmp = {
+    ['<']  = function (a, b) return a <  b end,
+    ['<='] = function (a, b) return a <= b end,
+    ['>']  = function (a, b) return a >  b end,
+    ['>='] = function (a, b) return a >= b end,
+    ['=='] = function (a, b) return a == b end,
+    ['~='] = function (a, b) return a ~= b end,
+}
+
+function m.cmp_ok (this, op, that, name)
+    local f = cmp[op]
+    if not f then
+        tb:ok(false, name)
+        tb:diag("unknown operator : " .. tostring(op))
+        return
+    end
+    local pass = f(this, that)
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("    " .. tostring(this)
+           .. "\n        " .. op
+           .. "\n    " .. tostring(that))
+    end
+end
+
+function m.type_ok (val, t, name)
+    if type(t) ~= 'string' then
+        tb:ok(false, name)
+        tb:diag("type isn't a string : " .. tostring(t))
+        return
+    end
+    if type(val) == t then
+        tb:ok(true, name)
+    else
+        tb:ok(false, name)
+        tb:diag("    " .. tostring(val) .. " isn't a '" .. t .."' it's a '" .. type(val) .. "'")
+    end
+end
+
+function m.subtest (name, func)
+    tb:subtest(name, func)
+end
+
+function m.pass (name)
+    tb:ok(true, name)
+end
+
+function m.fail (name)
+    tb:ok(false, name)
+end
+
+function m.require_ok (mod)
+    local r, msg = pcall(require, mod)
+    tb:ok(r, "require '" .. tostring(mod) .. "'")
+    if not r then
+        tb:diag("    " .. msg)
+    end
+    return r
+end
+
+function m.eq_array (got, expected, name)
+    if type(got) ~= 'table' then
+        tb:ok(false, name)
+        tb:diag("got value isn't a table : " .. tostring(got))
+        return
+    elseif type(expected) ~= 'table' then
+        tb:ok(false, name)
+        tb:diag("expected value isn't a table : " .. tostring(expected))
+        return
+    end
+    for i = 1, #expected do
+        local v = expected[i]
+        local val = got[i]
+        if val ~= v then
+            tb:ok(false, name)
+            tb:diag("    at index: " .. tostring(i)
+               .. "\n         got: " .. tostring(val)
+               .. "\n    expected: " .. tostring(v))
+            return
+        end
+    end
+    local extra = #got - #expected
+    if extra ~= 0 then
+        tb:ok(false, name)
+        tb:diag("    " .. tostring(extra) .. " unexpected item(s)")
+    else
+        tb:ok(true, name)
+    end
+end
+
+function m.is_deeply (got, expected, name)
+    if type(got) ~= 'table' then
+        tb:ok(false, name)
+        tb:diag("got value isn't a table : " .. tostring(got))
+        return
+    elseif type(expected) ~= 'table' then
+        tb:ok(false, name)
+        tb:diag("expected value isn't a table : " .. tostring(expected))
+        return
+    end
+    local msg1
+    local msg2
+    local seen = {}
+
+    local function deep_eq (t1, t2, key_path)
+        if t1 == t2 or seen[t1] then
+            return true
+        end
+        seen[t1] = true
+        for k, v2 in pairs(t2) do
+            local v1 = t1[k]
+            if type(v1) == 'table' and type(v2) == 'table' then
+                local r = deep_eq(v1, v2, key_path .. "." .. tostring(k))
+                if not r then
+                    return false
+                end
+            else
+                if v1 ~= v2 then
+                    key_path = key_path .. "." .. tostring(k)
+                    msg1 = "     got" .. key_path .. ": " .. tostring(v1)
+                    msg2 = "expected" .. key_path .. ": " .. tostring(v2)
+                    return false
+                end
+            end
+        end
+        for k in pairs(t1) do
+            local v2 = t2[k]
+            if v2 == nil then
+                key_path = key_path .. "." .. tostring(k)
+                msg1 = "     got" .. key_path .. ": " .. tostring(t1[k])
+                msg2 = "expected" .. key_path .. ": " .. tostring(v2)
+                return false
+            end
+        end
+        return true
+    end -- deep_eq
+
+    local pass = deep_eq(got, expected, '')
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("    Tables begin differing at:")
+        tb:diag("    " .. msg1)
+        tb:diag("    " .. msg2)
+    end
+end
+
+function m.error_is (code, arg2, arg3, arg4)
+    local params, expected, name
+    if type(arg2) == 'table' then
+        params = arg2
+        expected = arg3
+        name = arg4
+    else
+        params = {}
+        expected = arg2
+        name = arg3
+    end
+    if type(code) == 'string' then
+        local msg
+        code, msg = loadstring(code)
+        if not code then
+            tb:ok(false, name)
+            tb:diag("    can't compile code :"
+               .. "\n    " .. msg)
+            return
+        end
+    end
+    local r, msg = pcall(code, unpack(params))
+    if r then
+        tb:ok(false, name)
+        tb:diag("    unexpected success"
+           .. "\n    expected: " .. tostring(expected))
+    else
+        local pass = msg == expected
+        tb:ok(pass, name)
+        if not pass then
+            tb:diag("         got: " .. msg
+               .. "\n    expected: " .. tostring(expected))
+        end
+    end
+end
+
+function m.error_like (code, arg2, arg3, arg4)
+    local params, pattern, name
+    if type(arg2) == 'table' then
+        params = arg2
+        pattern = arg3
+        name = arg4
+    else
+        params = {}
+        pattern = arg2
+        name = arg3
+    end
+    if type(code) == 'string' then
+        local msg
+        code, msg = loadstring(code)
+        if not code then
+            tb:ok(false, name)
+            tb:diag("    can't compile code :"
+               .. "\n    " .. msg)
+            return
+        end
+    end
+    local r, msg = pcall(code, unpack(params))
+    if r then
+        tb:ok(false, name)
+        tb:diag("    unexpected success"
+           .. "\n    expected: " .. tostring(pattern))
+    else
+        if type(pattern) ~= 'string' then
+            tb:ok(false, name)
+            tb:diag("pattern isn't a string : " .. tostring(pattern))
+            return
+        end
+        local pass = match(msg, pattern)
+        tb:ok(pass, name)
+        if not pass then
+            tb:diag("                  '" .. msg .. "'"
+               .. "\n    doesn't match '" .. pattern .. "'")
+        end
+    end
+end
+
+function m.lives_ok (code, arg2, arg3)
+    local params, name
+    if type(arg2) == 'table' then
+        params = arg2
+        name = arg3
+    else
+        params = {}
+        name = arg2
+    end
+    if type(code) == 'string' then
+        local msg
+        code, msg = loadstring(code)
+        if not code then
+            tb:ok(false, name)
+            tb:diag("    can't compile code :"
+               .. "\n    " .. msg)
+            return
+        end
+    end
+    local r, msg = pcall(code, unpack(params))
+    tb:ok(r, name)
+    if not r then
+        tb:diag("    " .. msg)
+    end
+end
+
+function m.diag (msg)
+    tb:diag(msg)
+end
+
+function m.note (msg)
+    tb:note(msg)
+end
+
+function m.skip (reason, count)
+    count = count or 1
+    for i = 1, count do
+        tb:skip(reason)
+    end
+end
+
+function m.todo_skip (reason, count)
+    count = count or 1
+    for i = 1, count do
+        tb:todo_skip(reason)
+    end
+end
+
+function m.skip_rest (reason)
+    tb:skip_rest(reason)
+end
+
+function m.todo (reason, count)
+    tb:todo(reason, count)
+end
+
+for k, v in pairs(m) do  -- injection
+    _G[k] = v
+end
+
+m._VERSION = "0.3.1"
+m._DESCRIPTION = "lua-TestMore : an Unit Testing Framework"
+m._COPYRIGHT = "Copyright (c) 2009-2012 Francois Perrad"
+return m
+--
+-- This library is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--

+ 68 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/TestMore/makefile.mak

@@ -0,0 +1,68 @@
+# nmake /F makefile.mak
+
+LUAJIT = luajit.exe
+LUA = lua.exe
+LUAC = luac.exe
+
+RUN_LUA = $(LUA)
+RUN_LUAC = $(LUAC)
+OSNAME = MSWin32
+ARCHNAME = MSWin32-x86-multi-thread
+INTSIZE = 4
+
+harness: env
+	@prove --exec=$(LUA) *.t
+
+sanity: env
+	@prove --exec=$(LUA) 0*.t
+
+luajit: env
+	@prove --exec=$(LUAJIT) *.t
+
+llvm-lua: env
+	@prove --exec=$(LLVM_LUA) *.t
+
+env:
+	@set LUA_PATH=;;../src/?.lua
+	@set LUA_INIT=platform = { lua=[[$(RUN_LUA)]], luac=[[$(RUN_LUAC)]], osname=[[$(OSNAME)]], intsize=$(INTSIZE), compat=true }
+
+upload_pl = \
+use strict; \
+use warnings; \
+use LWP::UserAgent; \
+my $$ua = LWP::UserAgent->new(); \
+$$ua->env_proxy(); \
+my $$server = q{http://smolder.parrot.org}; \
+my $$project_id = 7; \
+my $$url = $$server . q{/app/projects/process_add_report/} . $$project_id; \
+my $$response = $$ua->post( \
+    $$url, \
+    Content_Type => q{form-data}, \
+    Content      => [ \
+        architecture => q{$(ARCHNAME)}, \
+        platform     => q{$(OSNAME)}, \
+        tags         => q{$(OSNAME), $(ARCHNAME), $(LUA)}, \
+        comments     => q{$(LUA)}, \
+        username     => q{parrot-autobot}, \
+        password     => q{qa_rocks}, \
+        project_id   => $$project_id, \
+        report_file  => [q{test_lua52.tar.gz}], \
+        ] \
+); \
+if ($$response->code == 302) { \
+    my ($$report_id) = $$response->content =~ /Reported .(\d+) added/i; \
+    my $$report_url = $$server . q{/app/public_projects/report_details/} . $$report_id; \
+    my $$project_url = $$server . q{/app/public_projects/smoke_reports/} . $$project_id; \
+    print qq{Test report successfully sent to Smolder at\n$$report_url} \
+      . qq{\nYou can see other recent reports at\n$$project_url .\n\n}; \
+} \
+else { \
+    die qq{Could not upload report to Smolder at $$server} \
+      . qq{\nHTTP CODE: } . $$response->code . q{ (} \
+      . $$response->message . qq{)\n}; \
+}
+
+smolder: env
+	-@prove --archive test_lua52.tar.gz --exec=$(LUA) *.t
+	perl -e "$(upload_pl)"
+

+ 11 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/_NUnitWrapper.cs

@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace NUnit.Framework
+{
+	class _NUnitWrapper
+	{
+	}
+}

+ 376 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/MoonSharp.Interpreter.Tests.net40-client.csproj

@@ -0,0 +1,376 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{4E54A863-7B53-4914-B9E0-C2172DE9DF72}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MoonSharp.Interpreter.Tests.net40_client</RootNamespace>
+    <AssemblyName>MoonSharp.Interpreter.Tests.net40-client</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
+    <IsCodedUITest>False</IsCodedUITest>
+    <TestProjectType>UnitTest</TestProjectType>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>..\..\..\keypair.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;HASDYNAMIC</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE;HASDYNAMIC</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Dev\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;HASDYNAMIC</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Devp4|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Devp4\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;HASDYNAMIC</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="nunit.framework">
+      <HintPath>..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <Choose>
+    <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+      </ItemGroup>
+    </When>
+    <Otherwise>
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
+      </ItemGroup>
+    </Otherwise>
+  </Choose>
+  <ItemGroup>
+    <Compile Include="..\..\EmbeddableNUnitWrapper.cs">
+      <Link>EmbeddableNUnitWrapper.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\BinaryDumpTests.cs">
+      <Link>BinaryDumpTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\ClosureTests.cs">
+      <Link>ClosureTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\CollectionsBaseInterfGenRegisteredTests.cs">
+      <Link>CollectionsBaseInterfGenRegisteredTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\CollectionsBaseGenRegisteredTests.cs">
+      <Link>CollectionsBaseGenRegisteredTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\CollectionsRegisteredTests.cs">
+      <Link>CollectionsRegisteredTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\ConfigPropertyAssignerTests.cs">
+      <Link>ConfigPropertyAssignerTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\CoroutineTests.cs">
+      <Link>CoroutineTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\DynamicTests.cs">
+      <Link>DynamicTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\ErrorHandlingTests.cs">
+      <Link>ErrorHandlingTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\GotoTests.cs">
+      <Link>GotoTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\JsonSerializationTests.cs">
+      <Link>JsonSerializationTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\LuaTestSuiteExtract.cs">
+      <Link>LuaTestSuiteExtract.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\MetatableTests.cs">
+      <SubType>Code</SubType>
+      <Link>MetatableTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\ProxyObjectsTests.cs">
+      <Link>ProxyObjectsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\StringLibTests.cs">
+      <Link>StringLibTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\StructAssignmentTechnique.cs">
+      <Link>StructAssignmentTechnique.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\TailCallTests.cs">
+      <Link>TailCallTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataEventsTests.cs">
+      <Link>UserDataEventsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataEnumsTest.cs">
+      <Link>UserDataEnumsTest.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataNestedTypesTests.cs">
+      <Link>UserDataNestedTypesTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VarargsTupleTests.cs">
+      <Link>VarargsTupleTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataPropertiesTests.cs">
+      <Link>VtUserDataPropertiesTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataOverloadsTests.cs">
+      <Link>VtUserDataOverloadsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataMethodsTests.cs">
+      <Link>VtUserDataMethodsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataMetaTests.cs">
+      <Link>VtUserDataMetaTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataIndexerTests.cs">
+      <Link>VtUserDataIndexerTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\VtUserDataFieldsTests.cs">
+      <Link>VtUserDataFieldsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataMetaTests.cs">
+      <Link>UserDataMetaTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataIndexerTests.cs">
+      <Link>UserDataIndexerTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataMethodsTests.cs">
+      <Link>UserDataMethodsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataOverloadsTests.cs">
+      <Link>UserDataOverloadsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataFieldsTests.cs">
+      <Link>UserDataFieldsTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\UserDataPropertiesTests.cs">
+      <SubType>Code</SubType>
+      <Link>UserDataPropertiesTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\Utils.cs">
+      <Link>Utils.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Properties\AssemblyInfo.cs">
+      <Link>AssemblyInfo.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\SimpleTests.cs">
+      <Link>SimpleTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\EndToEnd\TableTests.cs">
+      <Link>TableTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\TapRunner.cs">
+      <Link>TapRunner.cs</Link>
+    </Compile>
+    <Compile Include="..\..\TestMoreTests.cs">
+      <Link>TestMoreTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\TestRunner.cs">
+      <Link>TestRunner.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Units\BinDumpStreamTests.cs">
+      <Link>BinDumpStreamTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Units\FastStackTests.cs">
+      <Link>FastStackTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\Units\InteropTests.cs">
+      <Link>InteropTests.cs</Link>
+    </Compile>
+    <Compile Include="..\..\_Hardwired.cs">
+      <Link>_Hardwired.cs</Link>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\MoonSharp.Interpreter\_Projects\MoonSharp.Interpreter.net40-client\MoonSharp.Interpreter.net40-client.csproj">
+      <Project>{88d2880c-a863-4b16-abef-f67bd1e98bd1}</Project>
+      <Name>MoonSharp.Interpreter.net40-client</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+    <None Include="TestMore\000-sanity.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\001-if.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\002-table.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\011-while.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\012-repeat.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\014-fornum.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\015-forlist.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\101-boolean.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\102-function.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\103-nil.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\104-number.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\105-string.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\106-table.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\107-thread.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\108-userdata.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\200-examples.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\201-assign.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\202-expr.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\203-lexico.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\204-grammar.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\211-scope.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\212-function.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\213-closure.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\214-coroutine.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\221-table.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\222-constructor.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\223-iterator.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\231-metatable.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\232-object.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\301-basic.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\304-string.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\305-table.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\306-math.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\307-bit.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\308-io.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\309-os.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\310-debug.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\314-regex.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\320-stdin.t">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\Modules\Test\Builder.lua">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="TestMore\Modules\Test\More.lua">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+  <Choose>
+    <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
+      <ItemGroup>
+        <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+          <Private>False</Private>
+        </Reference>
+      </ItemGroup>
+    </When>
+  </Choose>
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 36 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MoonSharp.Interpreter.Tests.net40-client")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MoonSharp.Interpreter.Tests.net40-client")]
+[assembly: AssemblyCopyright("Copyright ©  2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("e38b2794-2a3e-42a2-bc24-ce2f1b119dc3")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 54 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/000-sanity.t

@@ -0,0 +1,54 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua test suite
+
+=head2 Synopsis
+
+    % prove 000-sanity.t
+
+=head2 Description
+
+=cut
+
+]]
+
+function f (n)
+    return n + 1
+end
+
+function g (m, p)
+    return m + p
+end
+
+print('1..9')
+print("ok 1 -")
+print('ok', 2, "- list")
+print("ok " .. 3 .. " - concatenation")
+i = 4
+print("ok " .. i .. " - var")
+i = i + 1
+print("ok " .. i .. " - var incr")
+print("ok " .. i+1 .. " - expr")
+j = f(i + 1)
+print("ok " .. j .. " - call f")
+k = g(i, 3)
+print("ok " .. k .. " - call g")
+local print = print
+print("ok 9 - local")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 87 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/001-if.t

@@ -0,0 +1,87 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua if statement
+
+=head2 Synopsis
+
+    % prove 001-if.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.4 "Control Structures",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.4>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+]]
+
+print("1..6")
+
+if true then
+    print("ok 1")
+else
+    print("not ok 1")
+end
+
+if not true then
+    print("not ok 2")
+else
+    print("ok 2")
+end
+
+a = 12
+b = 34
+if a < b then
+    print("ok 3")
+else
+    print("not ok 3")
+end
+
+a = 0
+b = 4
+if a < b then
+    print("ok 4")
+elseif a == b then
+    print("not ok 4")
+else
+    print("not ok 4")
+end
+
+a = 5
+b = 5
+if a < b then
+    print("not ok 5")
+elseif a == b then
+    print("ok 5")
+else
+    print("not ok 5")
+end
+
+a = 10
+b = 6
+if a < b then
+    print("not ok 6")
+elseif a == b then
+    print("not ok 6")
+else
+    print("ok 6")
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 67 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/002-table.t

@@ -0,0 +1,67 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua table
+
+=head2 Synopsis
+
+    % prove 002-table.t
+
+=head2 Description
+
+See "Programming in Lua", section 2.5 "Tables".
+
+=cut
+
+]]
+
+print("1..8")
+
+a = {"ok 1", "ok 2", "ok 3"}
+print(a[1])
+i = 2
+print(a[i])
+print(a[i+1])
+if #a == 3 then
+    print("ok 4 - len")
+else
+    print("not ok 4")
+end
+if a[7] == nil then
+    print("ok 5")
+else
+    print("not ok 5")
+end
+
+t = {a=10, b=100}
+if t['a'] == 10 then
+    print("ok 6")
+else
+    print("not ok 6")
+end
+if t.b == 100 then
+    print("ok 7")
+else
+    print("not ok 7")
+end
+if t.z == nil then
+    print("ok 8")
+else
+    print("not ok 8")
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 80 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/011-while.t

@@ -0,0 +1,80 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua while statement
+
+=head2 Synopsis
+
+    % prove 011-while.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.4 "Control Structures",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.4>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+]]
+
+print("1..11")
+
+a = {}
+local i = 1
+while a[i] do
+    i = i + 1
+end
+if i == 1 then
+    print("ok 1 - while empty")
+else
+    print("not ok 1 - " .. i)
+end
+
+a = {"ok 2 - while ", "ok 3", "ok 4"}
+local i = 1
+while a[i] do
+    print(a[i])
+    i = i + 1
+end
+
+a = {"ok 5 - with break", "ok 6", "stop", "more"}
+local i = 1
+while a[i] do
+    if a[i] == 'stop' then break end
+    print(a[i])
+    i = i + 1
+end
+if i == 3 then
+    print("ok 7 - break")
+else
+    print("not ok 7 - " .. i)
+end
+
+x = 3
+local i = 1
+while i<=x do
+    print("ok " .. 7+i)
+    i = i + 1
+end
+if i == 4 then
+    print("ok 11")
+else
+    print("not ok 11 - " .. i)
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 78 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/012-repeat.t

@@ -0,0 +1,78 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua repeat statement
+
+=head2 Synopsis
+
+    % prove 012-repeat.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.4 "Control Structures",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.4>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+]]
+
+print("1..8")
+
+a = {"ok 1 - repeat", "ok 2", "ok 3"}
+local i = 0
+repeat
+    i = i + 1
+    if a[i] then
+        print(a[i])
+    end
+until not a[i]
+if i == 4 then
+    print("ok 4")
+else
+    print("not ok 4 - " .. i)
+end
+
+a = {"ok 5 - with break", "ok 6", 'stop', 'more'}
+local i = 0
+repeat
+    i = i + 1
+    if a[i] == 'stop' then break end
+    print(a[i])
+until not a[i]
+if a[i] == 'stop' then
+    print("ok 7 - break")
+else
+    print("not ok 7 - " .. a[i])
+end
+
+function f () return true end
+
+local i = 1
+repeat
+    local v = f()
+    if i == 1 then
+        print("ok 8 - scope")
+    else
+        print("not ok")
+        break
+    end
+    i = i + 1
+until v
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 136 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/014-fornum.t

@@ -0,0 +1,136 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua for statement
+
+=head2 Synopsis
+
+    % prove 014-fornum.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.5 "For Statement",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.5>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+--]]
+
+print("1..36")
+
+for i = 1, 10, 2 do
+    print("ok " .. (i+1)/2 .. " - for 1, 10, 2")
+end
+
+for i = 1, 10, 2 do
+    function f ()
+        print("ok " .. (i+11)/2 .. " - for 1, 10, 2 lex")
+    end
+    f()
+end
+
+function f (i)
+    print("ok " .. (i+21)/2 .. " - for 1, 10, 2 !lex")
+end
+for i = 1, 10, 2 do
+    f(i)
+end
+
+for i = 3, 5 do
+    print("ok " .. 13+i .. " - for 3, 5")
+    i = i + 1
+end
+
+for i = 5, 1, -1 do
+    print("ok " .. 24-i .. " - for 5, 1, -1")
+end
+
+for i = 5, 5 do
+    print("ok " .. 19+i .. " - for 5, 5")
+end
+
+for i = 5, 5, -1 do
+    print("ok " .. 20+i .. " - for 5, 5, -1")
+end
+
+v = false
+for i = 5, 3 do
+    v = true
+end
+if v then
+    print("not ok 26 - for 5, 3")
+else
+    print("ok 26 - for 5, 3")
+end
+
+v = false
+for i = 5, 7, -1 do
+    v = true
+end
+if v then
+    print("not ok 27 - for 5, 7, -1")
+else
+    print("ok 27 - for 5, 7, -1")
+end
+
+v = false
+for i = 5, 7, 0 do
+    v = true
+    break -- avoid infinite loop with luajit
+end
+if jit then
+    print("not ok 28 - for 5, 7, 0 # TODO # LuaJIT intentional.")
+elseif v then
+    print("not ok 28 - for 5, 7, 0")
+else
+    print("ok 28 - for 5, 7, 0")
+end
+
+v = nil
+for i = 1, 10, 2 do
+    if i > 4 then break end
+    print("ok " .. (i+57)/2 .. " - for break")
+    v = i
+end
+if v == 3 then
+    print("ok 31 - break")
+else
+    print("not ok 31 - " .. v)
+end
+
+local function first() return 1 end
+local function limit() return 8 end
+local function step()  return 2 end
+for i = first(), limit(), step() do
+    print("ok " .. (i+63)/2 .. " - with functions")
+end
+
+local a = {}
+for i = 1, 10 do
+    a[i] = function () return i end
+end
+local v = a[5]()
+if v == 5 then
+    print("ok 36 - for & upval")
+else
+    print("not ok 36 - for & upval")
+    print("#", v)
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 99 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/015-forlist.t

@@ -0,0 +1,99 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua for statement
+
+=head2 Synopsis
+
+    % prove 015-forlist.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.5 "For Statement",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.5>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+--]]
+
+print("1..18")
+
+a = {"ok 1 - for ipairs", "ok 2 - for ipairs", "ok 3 - for ipairs"}
+for _, v in ipairs(a) do
+    print(v)
+end
+for i, v in ipairs(a) do
+    print("ok " .. 3+i .. " - for ipairs")
+end
+
+r = false
+t = {a=10, b=100}
+for i, v in ipairs(t) do
+    print(i, v)
+    r = true
+end
+if r then
+    print("not ok 7 - for ipairs (hash)")
+else
+    print("ok 7 - for ipairs (hash)")
+end
+
+for k in pairs(a) do
+    print("ok " .. 7+k .. " - for pairs")
+end
+
+local i = 1
+for k in pairs(t) do
+    if k == 'a' or k == 'b' then
+        print("ok " .. 10+i .. " - for pairs (hash)")
+    else
+        print("not ok " .. 10+i .. " - " .. k)
+    end
+    i = i + 1
+end
+
+a = {"ok 13 - for break", "ok 14 - for break", "stop", "more"}
+local i
+for _, v in ipairs(a) do
+    if v == "stop" then break end
+    print(v)
+    i = _
+end
+if i == 2 then
+    print("ok 15 - break")
+else
+    print("not ok 15 - " .. i)
+end
+
+local a = {"ok 16 - for & upval", "ok 17 - for & upval", "ok 18 - for & upval"}
+local b = {}
+for i, v in ipairs(a) do
+    b[i] = function () return v end
+end
+for i, v in ipairs(a) do
+    local r = b[i]()
+    if r == a[i] then
+        print(r)
+    else
+        print("not " .. a[i])
+        print("#", r)
+    end
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 120 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/101-boolean.t

@@ -0,0 +1,120 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1  Lua boolean & coercion
+
+=head2 Synopsis
+
+    % prove 101-boolean.t
+
+=head2 Description
+
+=cut
+
+]]
+
+require 'Test.More'
+
+plan(24)
+
+error_like(function () return -true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a %w+ value",
+           "-true")
+
+error_like(function () return #true end,
+           "^[^:]+:%d+: attempt to get length of a boolean value",
+           "#true")
+
+is(not false, true, "not false")
+
+error_like(function () return true + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true + 10")
+
+error_like(function () return true - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true - 2")
+
+error_like(function () return true * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true * 3.14")
+
+error_like(function () return true / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true / -7")
+
+error_like(function () return true % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true % 4")
+
+error_like(function () return true ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true ^ 3")
+
+error_like(function () return true .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate a boolean value",
+           "true .. 'end'")
+
+is(true == true, true, "true == true")
+
+is(true ~= false, true, "true ~= false")
+
+is(true == 1, false, "true == 1")
+
+is(true ~= 1, true, "true ~= 1")
+
+error_like(function () return true < false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true < false")
+
+error_like(function () return true <= false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true <= false")
+
+error_like(function () return true > false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true > false")
+
+error_like(function () return true >= false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true >= false")
+
+error_like(function () return true < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true < 0")
+
+error_like(function () return true <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true <= 0")
+
+error_like(function () return true > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true > 0")
+
+error_like(function () return true >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true >= 0")
+
+error_like(function () a = true; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = true; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 199 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/102-function.t

@@ -0,0 +1,199 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua function & coercion
+
+=head2 Synopsis
+
+    % prove 102-function.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(51)
+
+f = function () return 1 end
+
+error_like(function () return -f end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-f")
+
+error_like(function () f = print; return -f end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return #f end,
+           "^[^:]+:%d+: attempt to get length of",
+           "#f")
+
+error_like(function () f = print; return #f end,
+           "^[^:]+:%d+: attempt to get length of")
+
+is(not f, false, "not f")
+
+is(not print, false)
+
+error_like(function () return f + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f + 10")
+
+error_like(function () f = print; return f + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f - 2")
+
+error_like(function () f = print; return f - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f * 3.14")
+
+error_like(function () f = print; return f * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f / -7")
+
+error_like(function () f = print; return f / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f % 4")
+
+error_like(function () f = print; return f % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f ^ 3")
+
+error_like(function () f = print; return f ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "f .. 'end'")
+
+error_like(function () f = print; return f .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate")
+
+g = f
+is(f == g, true, "f == f")
+
+g = print
+is(g == print, true)
+
+g = function () return 2 end
+is(f ~= g, true, "f ~= g")
+h = type
+is(f ~= h, true)
+
+is(print ~= g, true)
+is(print ~= h, true)
+
+is(f == 1, false, "f == 1")
+
+is(print == 1, false)
+
+is(f ~= 1, true, "f ~= 1")
+
+is(print ~= 1, true)
+
+error_like(function () return f < g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f < g")
+
+error_like(function () f = print; g = type; return f < g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f <= g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f <= g")
+
+error_like(function () f = print; g = type; return f <= g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f > g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f > g")
+
+error_like(function () f = print; g = type; return f > g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f >= g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f >= g")
+
+error_like(function () f = print; g = type; return f >= g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f < 0")
+
+error_like(function () f = print; return f < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () return f <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f <= 0")
+
+error_like(function () f = print; return f <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () return f > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f > 0")
+
+error_like(function () f = print; return f > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () return f > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f >= 0")
+
+error_like(function () f = print; return f >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () a = f; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = print; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index")
+
+error_like(function () a = f; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = print; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index")
+
+t = {}
+t[print] = true
+ok(t[print])
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 120 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/103-nil.t

@@ -0,0 +1,120 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua nil & coercion
+
+=head2 Synopsis
+
+    % prove 103-nil.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(24)
+
+error_like(function () return -nil end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "-nil")
+
+error_like(function () return #nil end,
+           "^[^:]+:%d+: attempt to get length of a nil value",
+           "#nil")
+
+is(not nil, true, "not nil")
+
+error_like(function () return nil + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil + 10")
+
+error_like(function () return nil - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil - 2")
+
+error_like(function () return nil * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil * 3.14")
+
+error_like(function () return nil / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil / -7")
+
+error_like(function () return nil % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil % 4")
+
+error_like(function () return nil ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil ^ 3")
+
+error_like(function () return nil .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate a nil value",
+           "nil .. 'end'")
+
+is(nil == nil, true, "nil == nil")
+
+is(nil ~= nil, false, "nil ~= nil")
+
+is(nil == 1, false, "nil == 1")
+
+is(nil ~= 1, true, "nil ~= 1")
+
+error_like(function () return nil < nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil < nil")
+
+error_like(function () return nil <= nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil <= nil")
+
+error_like(function () return nil > nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil > nil")
+
+error_like(function () return nil > nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil >= nil")
+
+error_like(function () return nil < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil < 0")
+
+error_like(function () return nil <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil <= 0")
+
+error_like(function () return nil > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil > 0")
+
+error_like(function () return nil >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil >= 0")
+
+error_like(function () a = nil; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = nil; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 190 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/104-number.t

@@ -0,0 +1,190 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua number & coercion
+
+=head2 Synopsis
+
+    % prove 104-number.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(54)
+
+is(-1, -(1), "-1")
+
+error_like(function () return #1 end,
+           "^[^:]+:%d+: attempt to get length of a number value",
+           "#1")
+
+is(not 1, false, "not 1")
+
+is(10 + 2, 12, "10 + 2")
+
+is(2 - 10, -8, "2 - 10")
+
+is(3.14 * 1, 3.14, "3.14 * 1")
+
+is(-7 / 0.5, -14, "-7 / 0.5")
+
+type_ok(1 / 0, 'number', "1 / 0")
+
+is(-25 % 3, 2, "-25 % 3")
+
+type_ok(1 % 0, 'number', "1 % 0")
+
+error_like(function () return 10 + true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "10 + true")
+
+error_like(function () return 2 - nil end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "2 - nil")
+
+error_like(function () return 3.14 * false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "3.14 * false")
+
+error_like(function () return -7 / {} end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a table value",
+           "-7 / {}")
+
+error_like(function () return 3 ^ true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "3 ^ true")
+
+error_like(function () return -25 % false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "-25 % false")
+
+error_like(function () return 10 + 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "10 + 'text'")
+
+error_like(function () return 2 - 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "2 - 'text'")
+
+error_like(function () return 3.14 * 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "3.14 * 'text'")
+
+error_like(function () return -7 / 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "-7 / 'text'")
+
+error_like(function () return 25 % 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "25 % 'text'")
+
+error_like(function () return 3 ^ 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "3 ^ 'text'")
+
+is(10 + '2', 12, "10 + '2'")
+
+is(2 - '10', -8, "2 - '10'")
+
+is(3.14 * '1', 3.14, "3.14 * '1'")
+
+is(-7 / '0.5', -14, "-7 / '0.5'")
+
+is(-25 % '3', 2, "-25 % '3'")
+
+is(3 ^ '3', 27, "3 ^ '3'")
+
+is(1 .. 'end', '1end', "1 .. 'end'")
+
+is(1 .. 2, '12', "1 .. 2")
+
+error_like(function () return 1 .. true end,
+           "^[^:]+:%d+: attempt to concatenate a %w+ value",
+           "1 .. true")
+
+is(1.0 == 1, true, "1.0 == 1")
+
+is(1 ~= 2, true, "1 ~= 2")
+
+is(1 == true, false, "1 == true")
+
+is(1 ~= nil, true, "1 ~= nil")
+
+is(1 == '1', false, "1 == '1'")
+
+is(1 ~= '1', true, "1 ~= '1'")
+
+is(1 < 0, false, "1 < 0")
+
+is(1 <= 0, false, "1 <= 0")
+
+is(1 > 0, true, "1 > 0")
+
+is(1 >= 0, true, "1 >= 0")
+
+error_like(function () return 1 < false end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 < false")
+
+error_like(function () return 1 <= nil end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 <= nil")
+
+error_like(function () return 1 > true end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 > true")
+
+error_like(function () return 1 >= {} end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 >= {}")
+
+error_like(function () return 1 < '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 < '0'")
+
+error_like(function () return 1 <= '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 <= '0'")
+
+error_like(function () return 1 > '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 > '0'")
+
+error_like(function () return 1 >= '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 >= '0'")
+
+is(tostring(1000000000), '1000000000', "number 1000000000")
+
+is(tostring(1e9), '1000000000', "number 1e9")
+
+is(tostring(1.0e+9), '1000000000', "number 1.0e+9")
+
+error_like(function () a= 3.14; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = 3.14; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 183 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/105-string.t

@@ -0,0 +1,183 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua string & coercion
+
+=head2 Synopsis
+
+    % prove 105-string.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(51)
+
+is(- '1', -1, "-'1'")
+
+error_like(function () return - 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on .- string value",
+           "-'text'")
+
+is(# 'text', 4, "#'text'")
+
+is(not 'text', false, "not 'text'")
+
+is('10' + 2, 12, "'10' + 2")
+
+is('2' - 10, -8, "'2' - 10")
+
+is('3.14' * 1, 3.14, "'3.14' * 1")
+
+is('-7' / 0.5, -14, "'-7' / 0.5")
+
+is('-25' % 3, 2, "'-25' % 3")
+
+is('3' ^ 3, 27, "'3' ^ 3")
+
+error_like(function () return '10' + true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'10' + true")
+
+error_like(function () return '2' - nil end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "'2' - nil")
+
+error_like(function () return '3.14' * false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'3.14' * false")
+
+error_like(function () return '-7' / {} end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a table value",
+           "'-7' / {}")
+
+error_like(function () return '-25' % false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'-25' % false")
+
+error_like(function () return '3' ^ true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'3' ^ true")
+
+error_like(function () return '10' + 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'10' + 'text'")
+
+error_like(function () return '2' - 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'2' - 'text'")
+
+error_like(function () return '3.14' * 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'3.14' * 'text'")
+
+error_like(function () return '-7' / 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'-7' / 'text'")
+
+error_like(function () return '-25' % 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'-25' % 'text'")
+
+error_like(function () return '3' ^ 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'3' ^ 'text'")
+
+is('10' + '2', 12, "'10' + '2'")
+
+is('2' - '10', -8, "'2' - '10'")
+
+is('3.14' * '1', 3.14, "'3.14' * '1'")
+
+is('-7' / '0.5', -14, "'-7' / '0.5'")
+
+is('-25' % '3', 2, "'-25' % '3'")
+
+is('3' ^ '3', 27, "'3' ^ '3'")
+
+is('1' .. 'end', '1end', "'1' .. 'end'")
+
+is('1' .. 2, '12', "'1' .. 2")
+
+error_like(function () return '1' .. true end,
+           "^[^:]+:%d+: attempt to concatenate a boolean value",
+           "'1' .. true")
+
+is('1.0' == '1', false, "'1.0' == '1'")
+
+is('1' ~= '2', true, "'1' ~= '2'")
+
+is('1' == true, false, "'1' == true")
+
+is('1' ~= nil, true, "'1' ~= nil")
+
+is('1' == 1, false, "'1' == 1")
+
+is('1' ~= 1, true, "'1' ~= 1")
+
+is('1' < '0', false, "'1' < '0'")
+
+is('1' <= '0', false, "'1' <= '0'")
+
+is('1' > '0', true, "'1' > '0'")
+
+is('1' >= '0', true, "'1' >= '0'")
+
+error_like(function () return '1' < false end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' < false")
+
+error_like(function () return '1' <= nil end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' <= nil")
+
+error_like(function () return '1' > true end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' > true")
+
+error_like(function () return '1' >= {} end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' >= {}")
+
+error_like(function () return '1' < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' < 0")
+
+error_like(function () return '1' <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' <= 0")
+
+error_like(function () return '1' > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' > 0")
+
+error_like(function () return '1' > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' >== 0")
+
+a = 'text'
+is(a[1], nil, "index")
+
+error_like(function () a = 'text'; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 125 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/106-table.t

@@ -0,0 +1,125 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua table & coercion
+
+=head2 Synopsis
+
+    % prove 106-table.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(28)
+
+error_like(function () return -{} end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-{}")
+
+is(# {}, 0, "#{}")
+is(# {4,5,6}, 3)
+
+is(not {}, false, "not {}")
+
+error_like(function () return {} + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} + 10")
+
+error_like(function () return {} - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} - 2")
+
+error_like(function () return {} * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} * 3.14")
+
+error_like(function () return {} / 7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} / 7")
+
+error_like(function () return {} % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} % 4")
+
+error_like(function () return {} ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} ^ 3")
+
+error_like(function () return {} .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "{} .. 'end'")
+
+is({} == {}, false, "{} == {}")
+
+t1 = {}
+t2 = {}
+is(t1 == t1, true, "t1 == t1")
+is(t1 == t2, false, "t1 == t2")
+is(t1 ~= t2, true, "t1 ~= t2")
+
+is({} == 1, false, "{} == 1")
+
+is({} ~= 1, true, "{} ~= 1")
+
+error_like(function () return t1 < t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 < t2")
+
+error_like(function () return t1 <= t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 <= t2")
+
+error_like(function () return t1 > t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 > t2")
+
+error_like(function () return t1 >= t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 >= t2")
+
+error_like(function () return {} < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} < 0")
+
+error_like(function () return {} <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} <= 0")
+
+error_like(function () return {} > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} > 0")
+
+error_like(function () return {} >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} >= 0")
+
+t = {}
+is( t[1], nil, "index" )
+t[1] = 42
+is( t[1], 42, "index" )
+
+error_like(function () t = {}; t[nil] = 42 end,
+           "^[^:]+:%d+: table index is nil",
+           "table index is nil")
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 128 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/107-thread.t

@@ -0,0 +1,128 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua thread & coercion
+
+=head2 Synopsis
+
+    % prove 107-thread.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(25)
+
+co = coroutine.create(function () return 1 end)
+
+error_like(function () return -co end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-co")
+
+error_like(function () return #co end,
+           "^[^:]+:%d+: attempt to get length of",
+           "#co")
+
+is(not co, false, "not co")
+
+error_like(function () return co + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co + 10")
+
+error_like(function () return co - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co - 2")
+
+error_like(function () return co * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co * 3.14")
+
+error_like(function () return co / 7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co / 7")
+
+error_like(function () return co % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co % 4")
+
+error_like(function () return co ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co ^ 3")
+
+error_like(function () return co .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "co .. 'end'")
+
+is(co == co, true, "co == co")
+
+co1 = coroutine.create(function () return 1 end)
+co2 = coroutine.create(function () return 2 end)
+is(co1 ~= co2, true, "co1 ~= co2")
+
+is(co == 1, false, "co == 1")
+
+is(co ~= 1, true, "co ~= 1")
+
+error_like(function () return co1 < co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 < co2")
+
+error_like(function () return co1 <= co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 <= co2")
+
+error_like(function () return co1 > co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 > co2")
+
+error_like(function () return co1 >= co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 >= co2")
+
+error_like(function () return co < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co < 0")
+
+error_like(function () return co <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co <= 0")
+
+error_like(function () return co > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co > 0")
+
+error_like(function () return co > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co >= 0")
+
+error_like(function () a = co[1] end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () co[1] = 1 end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+t = {}
+t[co] = true
+ok(t[co])
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 125 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/108-userdata.t

@@ -0,0 +1,125 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua userdata & coercion
+
+=head2 Synopsis
+
+    % prove 108-userdata.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(25)
+
+u = io.stdin
+
+error_like(function () return -u end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-u")
+
+error_like(function () return #u end,
+           "^[^:]+:%d+: attempt to get length of",
+           "#u")
+
+is(not u, false, "not u")
+
+error_like(function () return u + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u + 10")
+
+error_like(function () return u - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u - 2")
+
+error_like(function () return u * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u * 3.14")
+
+error_like(function () return u / 7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u / 7")
+
+error_like(function () return u % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u % 4")
+
+error_like(function () return u ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u ^ 3")
+
+error_like(function () return u .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "u .. 'end'")
+
+is(u == u, true, "u == u")
+
+v = io.stdout
+is(u ~= v, true, "u ~= v")
+
+is(u == 1, false, "u == 1")
+
+is(u ~= 1, true, "u ~= 1")
+
+error_like(function () return u < v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u < v")
+
+error_like(function () return u <= v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u <= v")
+
+error_like(function () return u > v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u > v")
+
+error_like(function () return u >= v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u >= v")
+
+error_like(function () return u < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u < 0")
+
+error_like(function () return u <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u <= 0")
+
+error_like(function () return u > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u > 0")
+
+error_like(function () return u > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u >= 0")
+
+is(u[1], nil, "index")
+
+error_like(function () u[1] = 1 end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+t = {}
+t[u] = true
+ok(t[u])
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 104 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/200-examples.t

@@ -0,0 +1,104 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 some Lua code examples
+
+=head2 Synopsis
+
+    % prove 200-examples.t
+
+=head2 Description
+
+First tests in order to check infrastructure.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(5)
+
+function factorial (n)
+    if n == 0 then
+        return 1
+    else
+        return n * factorial(n-1)
+    end
+end
+is(factorial(7), 5040, "factorial (recursive)")
+
+local function local_factorial (n)
+    if n == 0 then
+        return 1
+    else
+        return n * local_factorial(n-1)
+    end
+end
+is(local_factorial(7), 5040, "factorial (recursive)")
+
+function loop_factorial (n)
+    local a = 1
+    for i = 1, n, 1 do
+        a = a*i
+    end
+    return a
+end
+is(loop_factorial(7), 5040, "factorial (loop)")
+
+function iter_factorial (n)
+    local function iter (product, counter)
+        if counter > n then
+            return product
+        else
+            return iter(counter*product, counter+1)
+        end
+    end
+    return iter(1, 1)
+end
+is(iter_factorial(7), 5040, "factorial (iter)")
+
+--[[
+
+  Knuth's "man or boy" test.
+  See http://en.wikipedia.org/wiki/Man_or_boy_test
+
+]]
+
+local function A (k, x1, x2, x3, x4, x5)
+    local function B ()
+        k = k - 1
+        return A(k, B, x1, x2, x3, x4)
+    end
+    if k <= 0 then
+        return x4() + x5()
+    else
+        return B()
+    end
+end
+
+is(A(10,
+        function () return 1 end,
+        function () return -1 end,
+        function () return -1 end,
+        function () return 1 end,
+        function () return 0 end),
+   -67,
+   "man or boy"
+)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 125 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/201-assign.t

@@ -0,0 +1,125 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua assignment
+
+=head2 Synopsis
+
+    % prove 201-assign.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.3 "Assignment",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.3>.
+
+See "Programming in Lua", section 4.1 "Assignment".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(38)
+
+is(b, nil, "global variable")
+b = 10
+is(b, 10)
+if jit then
+    skip("LuaJIT intentional. _ENV.", 3)
+else
+    is(_ENV.b, 10, "_ENV")
+    is(_G, _ENV, "_G")
+    error_like([[ _ENV = nil; b = 20 ]],
+               "^[^:]+:%d+: attempt to index a nil value")
+end
+b = nil
+is(b, nil)
+
+a = {}
+i = 3
+i, a[i] = i+1, 20
+-- this behavior is undefined
+-- see http://lua-users.org/lists/lua-l/2006-06/msg00378.html
+-- is(i, 4, "check eval")
+-- is(a[3], 20)
+
+x = 1.
+y = 2.
+x, y = y, x -- swap
+is(x, 2, "check swap")
+is(y, 1)
+
+a, b, c = 0, 1
+is(a, 0, "check padding")
+is(b, 1)
+is(c, nil)
+a, b = a+1, b+1, a+b
+is(a, 1)
+is(b, 2)
+a, b, c = 0
+is(a, 0)
+is(b, nil)
+is(c, nil)
+
+function f() return 1, 2 end
+a, b, c, d = f()
+is(a, 1, "adjust with function")
+is(b, 2)
+is(c, nil)
+is(d, nil)
+
+function f() print('# f') end
+a = 2
+a, b, c = f(), 3
+is(a, nil, "padding with function")
+is(b, 3)
+is(c, nil)
+
+local my_i = 1
+is(my_i, 1, "local variable")
+local my_i = 2
+is(my_i, 2)
+
+local i = 1
+local j = i
+is(i, 1, "local variable")
+is(j, 1)
+j = 2
+is(i, 1)
+is(j, 2)
+
+local function f(x) return 2*x end
+is(f(2), 4, "param & result of function")
+a = 2
+a = f(a)
+is(a, 4)
+local b = 2
+b = f(b)
+is(b, 4)
+
+local n1 = 1
+local n2 = 2
+local n3 = 3
+local n4 = 4
+n1,n2,n3,n4 = n4,n3,n2,n1
+is(n1, 4, "assignment list swap values")
+is(n2, 3)
+is(n3, 2)
+is(n4, 1)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 111 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/202-expr.t

@@ -0,0 +1,111 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua expression
+
+=head2 Synopsis
+
+    % prove 202-expr.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.4 "Expressions",
+L<http://www.lua.org/manual/5.2/manual.html#3.4>.
+
+See "Programming in Lua", section 3 "Expressions".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(39)
+
+x = math.pi
+is(x - x%0.01, 3.14, "modulo")
+
+a = {}; a.x = 1; a.y = 0;
+b = {}; b.x = 1; b.y = 0;
+c = a
+is(a == c, true, "relational op (by reference)")
+is(a ~= b, true)
+
+is('0' == 0, false, "relational op")
+is(2 < 15, true)
+is('2' < '15', false)
+
+error_like(function () return 2 < '15' end,
+           "compare",
+           "relational op")
+
+error_like(function () return '2' < 15 end,
+           "compare",
+           "relational op")
+
+is(4 and 5, 5, "logical op")
+is(nil and 13, nil)
+is(false and 13, false)
+is(4 or 5, 4)
+is(false or 5, 5)
+is(false or 'text', 'text')
+
+is(10 or 20, 10, "logical op")
+is(10 or error(), 10)
+is(nil or 'a', 'a')
+is(nil and 10, nil)
+is(false and error(), false)
+is(false and nil, false)
+is(false or nil, nil)
+is(10 and 20, 20)
+
+is(not nil, true, "logical not")
+is(not false, true)
+is(not 0, false)
+is(not not nil, false)
+is(not 'text', false)
+a = {}
+is(not a, false)
+
+is("Hello " .. "World", "Hello World", "concatenation")
+is(0 .. 1, '01')
+a = "Hello"
+is(a .. " World", "Hello World")
+is(a, "Hello")
+
+is('10' + 1, 11, "coercion")
+is('-5.3' * '2', -10.6)
+is(10 .. 20, '1020')
+is(tostring(10), '10')
+is(10 .. '', '10')
+
+error_like(function () return 'hello' + 1 end,
+           "perform arithmetic",
+           "no coercion")
+
+error_like(function ()
+                local function first() return 1 end
+                local function limit() return end
+                local function step()  return 2 end
+                for i = first(), limit(), step() do
+                    print(i)
+                end
+           end,
+           "^[^:]+:%d+: 'for' limit must be a number",
+           "for tonumber")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 122 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/203-lexico.t

@@ -0,0 +1,122 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Lexicography
+
+=head2 Synopsis
+
+    % prove 203-lexico.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.1 "Lexical Conventions",
+L<http://www.lua.org/manual/5.2/manual.html#3.1>.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(40)
+
+is("\65", "A")
+is("\065", "A")
+is("\x41", "A")
+is("\x3d", "=")
+is("\x3D", "=")
+
+is(string.byte("\a"), 7)
+is(string.byte("\b"), 8)
+is(string.byte("\f"), 12)
+is(string.byte("\n"), 10)
+is(string.byte("\r"), 13)
+is(string.byte("\t"), 9)
+is(string.byte("\v"), 11)
+is(string.byte("\\"), 92)
+
+is(string.len("A\0B"), 3)
+
+f, msg = load [[a = "A\300"]]
+like(msg, "^[^:]+:%d+: .- escape .- near")
+
+f, msg = load [[a = "A\xyz"]]
+like(msg, "^[^:]+:%d+: .- near")
+
+f, msg = load [[a = "A\Z"]]
+like(msg, "^[^:]+:%d+: .- escape .- near")
+
+f, msg = load [[a = " unfinished string ]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load [[a = " unfinished string
+]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load [[a = " unfinished string \
+]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load [[a = " unfinished string \]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load "a = [[ unfinished long string "
+like(msg, "^[^:]+:%d+: unfinished long string near")
+
+f, msg = load "a = [== invalid long string delimiter "
+like(msg, "^[^:]+:%d+: invalid long string delimiter near")
+
+a = 'alo\n123"'
+is('alo\n123"', a)
+is("alo\n123\"", a)
+is('\97lo\10\04923"', a)
+is([[alo
+123"]], a)
+is([==[
+alo
+123"]==], a)
+is("alo\n\z
+123\"", a)
+
+f, msg = load [[a = " escape \z unauthorized
+new line" ]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+is(3.0, 3)
+is(314.16e-2, 3.1416)
+is(0.31416E1, 3.1416)
+is(0xff, 255)
+is(0x56, 86)
+is(0x0.1E, 0x1E / 0x100)        -- 0.1171875
+is(0xA23p-4, 0xA23 / (2^4))     -- 162.1875
+is(0X1.921FB54442D18P+1, (1 + 0x921FB54442D18/0x10000000000000) * 2)
+
+f, msg = load [[a = 12e34e56]]
+like(msg, "^[^:]+:%d+: malformed number near")
+
+--[===[
+--[[
+--[=[
+    nested long comments
+--]=]
+--]]
+--]===]
+
+f, msg = load "  --[[ unfinished long comment "
+like(msg, "^[^:]+:%d+: unfinished long comment near")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 106 - 0
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.net40-client/TestMore/204-grammar.t

@@ -0,0 +1,106 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2010-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Grammar
+
+=head2 Synopsis
+
+    % prove 204-grammar.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 9 "The Complete Syntax of Lua",
+L<http://www.lua.org/manual/5.2/manual.html#9>.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(6)
+
+--[[ empty statement ]]
+f, msg = load [[; a = 1]]
+type_ok(f, 'function', "empty statement")
+
+--[[ orphan break ]]
+f, msg = load [[
+function f()
+    print "before"
+    do
+        print "inner"
+        break
+    end
+    print "after"
+end
+]]
+if jit then
+    like(msg, "^[^:]+:%d+: no loop to break", "orphan break")
+else
+    like(msg, "^[^:]+:%d+: <break> at line 5 not inside a loop", "orphan break")
+end
+
+--[[ break anywhere ]]
+lives_ok( [[
+function f()
+    print "before"
+    while true do
+        print "inner"
+        break
+        print "break"
+    end
+    print "after"
+end
+]], "break anywhere")
+
+--[[ goto ]]
+f, msg = load [[
+::label::
+goto unknown
+]]
+if jit then
+    like(msg, ":%d+: undefined label 'unknown'", "unknown goto")
+else
+    like(msg, ":%d+: no visible label 'unknown' for <goto> at line %d+", "unknown goto")
+end
+
+f, msg = load [[
+::label::
+goto label
+::label::
+]]
+if jit then
+    like(msg, ":%d+: duplicate label 'label'", "duplicate label")
+else
+    like(msg, ":%d+: label 'label' already defined on line %d+", "duplicate label")
+end
+
+f, msg = load [[
+::e::
+goto f
+local x
+::f::
+goto e
+]]
+if jit then
+    like(msg, ":%d+: <goto f> jumps into the scope of local 'x'", "bad goto")
+else
+    like(msg, ":%d+: <goto f> at line %d+ jumps into the scope of local 'x'", "bad goto")
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

Vissa filer visades inte eftersom för många filer har ändrats