Skip to content

Commit bdd5cae

Browse files
authored
Merge branch 'sebastienros:main' into SourceText
2 parents 69b73c9 + ac2b527 commit bdd5cae

File tree

9 files changed

+42
-8
lines changed

9 files changed

+42
-8
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: dotnet test --configuration Release --logger GitHubActions
3535

3636
macos:
37-
runs-on: macos-latest
37+
runs-on: macos-14
3838
env:
3939
DOTNET_NOLOGO: true
4040
DOTNET_CLI_TELEMETRY_OPTOUT: 1

Jint.Tests/Runtime/InteropTests.Dynamic.cs renamed to Jint.Tests.PublicInterface/InteropTests.Dynamic.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using System.Dynamic;
22
using Jint.Native;
33
using Jint.Native.Symbol;
4-
using Jint.Tests.Runtime.Domain;
54

6-
namespace Jint.Tests.Runtime
5+
namespace Jint.Tests.PublicInterface
76
{
87
public partial class InteropTests
98
{
@@ -143,5 +142,11 @@ public bool ContainsKey(string key)
143142
return _properties.ContainsKey(key);
144143
}
145144
}
145+
146+
private class Person
147+
{
148+
public string Name { get; set; }
149+
public int Age { get; set; }
150+
}
146151
}
147152
}

Jint.Tests/Runtime/InteropTests.Json.cs renamed to Jint.Tests.PublicInterface/InteropTests.Json.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Dynamic;
22
using Jint.Runtime.Interop;
33

4-
namespace Jint.Tests.Runtime;
4+
namespace Jint.Tests.PublicInterface;
55

66
public partial class InteropTests
77
{

Jint.Tests/Runtime/InteropTests.NewtonsoftJson.cs renamed to Jint.Tests.PublicInterface/InteropTests.NewtonsoftJson.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using Jint.Runtime;
33
using Newtonsoft.Json.Linq;
44

5-
namespace Jint.Tests.Runtime
5+
namespace Jint.Tests.PublicInterface
66
{
77
public partial class InteropTests
88
{

Jint.Tests/Runtime/InteropTests.SystemTextJson.cs renamed to Jint.Tests.PublicInterface/InteropTests.SystemTextJson.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Text.Json.Nodes;
33
using Jint.Runtime.Interop;
44

5-
namespace Jint.Tests.Runtime;
5+
namespace Jint.Tests.PublicInterface;
66

77
public partial class InteropTests
88
{
@@ -37,7 +37,7 @@ public void AccessingJsonNodeShouldWork()
3737
var wrapped = new ObjectWrapper(e, target);
3838
if (target is JsonArray)
3939
{
40-
wrapped.SetPrototypeOf(e.Realm.Intrinsics.Array.PrototypeObject);
40+
wrapped.Prototype = e.Intrinsics.Array.PrototypeObject;
4141
}
4242
return wrapped;
4343
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Reflection;
2+
3+
namespace Jint.Tests.PublicInterface
4+
{
5+
public partial class InteropTests : IDisposable
6+
{
7+
private readonly Engine _engine;
8+
9+
public InteropTests()
10+
{
11+
_engine = new Engine(cfg => cfg.AllowClr(
12+
typeof(Console).GetTypeInfo().Assembly,
13+
typeof(File).GetTypeInfo().Assembly))
14+
.SetValue("log", new Action<object>(Console.WriteLine))
15+
.SetValue("assert", new Action<bool>(Assert.True))
16+
.SetValue("equal", new Action<object, object>(Assert.Equal))
17+
;
18+
}
19+
20+
void IDisposable.Dispose()
21+
{
22+
}
23+
}
24+
}

Jint.Tests.PublicInterface/Jint.Tests.PublicInterface.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<PackageReference Include="Newtonsoft.Json" />
2929
<PackageReference Include="NodaTime" />
3030
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" />
31+
<PackageReference Include="System.Text.Json" />
3132
<PackageReference Include="xunit" />
3233
<PackageReference Include="xunit.runner.visualstudio" />
3334
</ItemGroup>

Jint.Tests/Runtime/JsonTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public void CanParseTabsInProperties()
2828
[InlineData("{\"a\":\"\\u0000\"}", "\0")]
2929
[InlineData("{\"a\":\"\\u0001\"}", "\x01")]
3030
[InlineData("{\"a\":\"\\u0061\"}", "a")]
31+
[InlineData("{\"a\":\"\\u003C\"}", "<")]
32+
[InlineData("{\"a\":\"\\u003E\"}", ">")]
33+
[InlineData("{\"a\":\"\\u003c\"}", "<")]
34+
[InlineData("{\"a\":\"\\u003e\"}", ">")]
3135
public void ShouldParseEscapedCharactersCorrectly(string json, string expectedCharacter)
3236
{
3337
var engine = new Engine();

Jint/Native/Json/JsonParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private char ScanHexEscape()
103103
{
104104
if (_index < _length + 1 && IsHexDigit(_source[_index]))
105105
{
106-
char ch = _source[_index++];
106+
char ch = char.ToLower(_source[_index++], CultureInfo.InvariantCulture);
107107
code = code * 16 + "0123456789abcdef".IndexOf(ch);
108108
}
109109
else

0 commit comments

Comments
 (0)