Fix null argument binding, add tests, minor code fixes, bump version to 5.1.1.

This commit is contained in:
ClearScript 2013-02-27 22:05:42 -05:00
Родитель bb0c181428
Коммит b99c9399a4
12 изменённых файлов: 152 добавлений и 23 удалений

Просмотреть файл

@ -219,14 +219,18 @@ namespace Microsoft.ClearScript
private static CSharpArgumentInfo CreateArgInfo(object arg)
{
var flags = CSharpArgumentInfoFlags.UseCompileTimeType;
if (arg is IOutArg)
var flags = CSharpArgumentInfoFlags.None;
if (arg != null)
{
flags |= CSharpArgumentInfoFlags.IsOut;
}
else if (arg is IRefArg)
{
flags |= CSharpArgumentInfoFlags.IsRef;
flags |= CSharpArgumentInfoFlags.UseCompileTimeType;
if (arg is IOutArg)
{
flags |= CSharpArgumentInfoFlags.IsOut;
}
else if (arg is IRefArg)
{
flags |= CSharpArgumentInfoFlags.IsRef;
}
}
return CSharpArgumentInfo.Create(flags, null);

Просмотреть файл

@ -73,5 +73,5 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("ClearScriptTest")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("5.1.0.0")]
[assembly: AssemblyFileVersion("5.1.0.0")]
[assembly: AssemblyVersion("5.1.1.0")]
[assembly: AssemblyFileVersion("5.1.1.0")]

Просмотреть файл

@ -59,6 +59,8 @@
// fitness for a particular purpose and non-infringement.
//
#include "..\..\..\VersionSymbols.h"
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
@ -69,5 +71,5 @@ using namespace System::Runtime::InteropServices;
[assembly:InternalsVisibleTo("ClearScript")];
[assembly:ComVisible(false)];
[assembly:AssemblyVersion("5.0.0.0")];
[assembly:AssemblyFileVersion("5.0.0.0")];
[assembly:AssemblyVersion(CLEARSCRIPT_VERSION_STRING)];
[assembly:AssemblyFileVersion(CLEARSCRIPT_VERSION_STRING)];

Просмотреть файл

@ -59,6 +59,8 @@
// fitness for a particular purpose and non-infringement.
//
#include "..\..\..\VersionSymbols.h"
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
@ -69,5 +71,5 @@ using namespace System::Runtime::InteropServices;
[assembly:InternalsVisibleTo("ClearScript")];
[assembly:ComVisible(false)];
[assembly:AssemblyVersion("5.0.0.0")];
[assembly:AssemblyFileVersion("5.0.0.0")];
[assembly:AssemblyVersion(CLEARSCRIPT_VERSION_STRING)];
[assembly:AssemblyFileVersion(CLEARSCRIPT_VERSION_STRING)];

Просмотреть файл

@ -61,5 +61,5 @@
#define CLEARSCRIPT_VERSION_STRING "5.1.0.0"
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,1,0,0
#define CLEARSCRIPT_VERSION_STRING "5.1.1.0"
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 5,1,1,0

Просмотреть файл

@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("© Microsoft Corporation")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("5.1.0.0")]
[assembly: AssemblyFileVersion("5.1.0.0")]
[assembly: AssemblyVersion("5.1.1.0")]
[assembly: AssemblyFileVersion("5.1.1.0")]

Просмотреть файл

@ -68,7 +68,7 @@ using System.Text;
namespace Microsoft.ClearScript.Test
{
internal class SunSpider
internal static class SunSpider
{
private const string version = "sunspider-0.9.1";
private const string baseUrl = "http://www.webkit.org/perf/" + version + "/" + version + "/";

Просмотреть файл

@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("© Microsoft Corporation")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("5.1.0.0")]
[assembly: AssemblyFileVersion("5.1.0.0")]
[assembly: AssemblyVersion("5.1.1.0")]
[assembly: AssemblyFileVersion("5.1.1.0")]

Просмотреть файл

@ -0,0 +1,120 @@
//
// Copyright © Microsoft Corporation. All rights reserved.
//
// Microsoft Public License (MS-PL)
//
// This license governs use of the accompanying software. If you use the
// software, you accept this license. If you do not accept the license, do not
// use the software.
//
// 1. Definitions
//
// The terms "reproduce," "reproduction," "derivative works," and
// "distribution" have the same meaning here as under U.S. copyright law. A
// "contribution" is the original software, or any additions or changes to
// the software. A "contributor" is any person that distributes its
// contribution under this license. "Licensed patents" are a contributor's
// patent claims that read directly on its contribution.
//
// 2. Grant of Rights
//
// (A) Copyright Grant- Subject to the terms of this license, including the
// license conditions and limitations in section 3, each contributor
// grants you a non-exclusive, worldwide, royalty-free copyright license
// to reproduce its contribution, prepare derivative works of its
// contribution, and distribute its contribution or any derivative works
// that you create.
//
// (B) Patent Grant- Subject to the terms of this license, including the
// license conditions and limitations in section 3, each contributor
// grants you a non-exclusive, worldwide, royalty-free license under its
// licensed patents to make, have made, use, sell, offer for sale,
// import, and/or otherwise dispose of its contribution in the software
// or derivative works of the contribution in the software.
//
// 3. Conditions and Limitations
//
// (A) No Trademark License- This license does not grant you rights to use
// any contributors' name, logo, or trademarks.
//
// (B) If you bring a patent claim against any contributor over patents that
// you claim are infringed by the software, your patent license from such
// contributor to the software ends automatically.
//
// (C) If you distribute any portion of the software, you must retain all
// copyright, patent, trademark, and attribution notices that are present
// in the software.
//
// (D) If you distribute any portion of the software in source code form, you
// may do so only under this license by including a complete copy of this
// license with your distribution. If you distribute any portion of the
// software in compiled or object code form, you may only do so under a
// license that complies with this license.
//
// (E) The software is licensed "as-is." You bear the risk of using it. The
// contributors give no express warranties, guarantees or conditions. You
// may have additional consumer rights under your local laws which this
// license cannot change. To the extent permitted under your local laws,
// the contributors exclude the implied warranties of merchantability,
// fitness for a particular purpose and non-infringement.
//
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CSharp.RuntimeBinder;
using Microsoft.ClearScript.V8;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.ClearScript.Test
{
[TestClass]
[DeploymentItem("ClearScriptV8-64.dll")]
[DeploymentItem("ClearScriptV8-32.dll")]
[DeploymentItem("v8-x64.dll")]
[DeploymentItem("v8-ia32.dll")]
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Test classes use TestCleanupAttribute for deterministic teardown.")]
public class BugFixTest : ClearScriptTest
{
#region setup / teardown
private ScriptEngine engine;
[TestInitialize]
public void TestInitialize()
{
engine = new V8ScriptEngine(V8ScriptEngineFlags.EnableDebugging);
}
[TestCleanup]
public void TestCleanup()
{
engine.Dispose();
}
#endregion
#region test methods
// ReSharper disable InconsistentNaming
[TestMethod, TestCategory("BugFix")]
public void BugFix_NullArgumentBinding()
{
var value = 123.456 as IConvertible;
engine.AddRestrictedHostObject("value", value);
Assert.AreEqual(value.ToString(null), engine.Evaluate("value.ToString(null)"));
}
[TestMethod, TestCategory("BugFix")]
[ExpectedException(typeof(RuntimeBinderException))]
public void BugFix_NullArgumentBinding_Ambiguous()
{
engine.AddHostObject("lib", new HostTypeCollection("mscorlib"));
engine.Execute("lib.System.Console.WriteLine(null)");
}
// ReSharper restore InconsistentNaming
#endregion
}
}

Просмотреть файл

@ -53,6 +53,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BindSignatureTest.cs" />
<Compile Include="BugFixTest.cs" />
<Compile Include="CrossEngineTest.cs" />
<Compile Include="DynamicHostItemTest.cs" />
<Compile Include="ExplicitBaseInterfaceMemberAccessTest.cs" />

Просмотреть файл

@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("© Microsoft Corporation")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("5.1.0.0")]
[assembly: AssemblyFileVersion("5.1.0.0")]
[assembly: AssemblyVersion("5.1.1.0")]
[assembly: AssemblyFileVersion("5.1.1.0")]

Просмотреть файл

@ -1 +1 @@
<# var version = new Version(5, 1, 0, 0); #>
<# var version = new Version(5, 1, 1, 0); #>