Skip to content

Commit 4c9ad30

Browse files
committed
Merge branch 'release/0.16.0'
2 parents 46897c8 + 3398591 commit 4c9ad30

7 files changed

Lines changed: 61 additions & 19 deletions

File tree

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ os:
33
- osx
44
- linux
55

6-
# Ubuntu 14.04
6+
# Ubuntu 18.04 LTS
77
sudo: required
8-
dist: trusty
8+
dist: bionic
99

10-
# OS X 10.12
11-
osx_image: xcode9.2
10+
# OS X 10.14
11+
osx_image: xcode11.3
1212

1313
mono:
1414
- 4.4.2
1515

16-
dotnet: 3.0.100
16+
dotnet: 3.0.101
1717

1818
before_install:
1919
- git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Notation) strings.
1616
| Build server | Platform | Build status |
1717
|-----------------------------|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
1818
| AppVeyor | Windows | [![AppVeyor branch](https://img.shields.io/appveyor/ci/litjson/litjson/develop.svg)](https://ci.appveyor.com/project/litjson/litjson/branch/develop) |
19-
| Bitrise | MacOS | [![Build Status](https://www.bitrise.io/app/5975a00ca2666fb1/status.svg?token=OZnv4YWRw71IVax38Wi50Q&branch=develop)](https://www.bitrise.io/app/5975a00ca2666fb1) |
20-
| Bitrise | Linux | [![Build Status](https://www.bitrise.io/app/4c9ee62c6ba13630/status.svg?token=RBH8UKw-68lQYjageT8VoQ&branch=develop)](https://www.bitrise.io/app/4c9ee62c6ba13630) |
19+
| Bitrise | MacOS | [![Build Status](https://app.bitrise.io/app/5975a00ca2666fb1/status.svg?token=OZnv4YWRw71IVax38Wi50Q&branch=develop)](https://app.bitrise.io/app/5975a00ca2666fb1) |
20+
| Bitrise | Linux | [![Build Status](https://app.bitrise.io/app/4c9ee62c6ba13630/status.svg?token=RBH8UKw-68lQYjageT8VoQ&branch=develop)](https://app.bitrise.io/app/4c9ee62c6ba13630)|
2121
| Travis | Linux / MacOS | [![Travis build status](https://travis-ci.org/LitJSON/litjson.svg?branch=develop)](https://travis-ci.org/LitJSON/litjson) |
2222

2323

@@ -40,7 +40,7 @@ Code can be compiled using .NET CLI or by launching the bootstrappers in the roo
4040
#### Prerequisites
4141

4242
The bootstrappers will (locally in repo)
43-
43+
4444
* Fetch and install .NET Core CLI / SDK version needed to compile LitJSON.
4545
* Fetch and install Cake runner
4646
* Execute build script with supplied target (`--target=[Target]`) or by default
@@ -49,7 +49,7 @@ The bootstrappers will (locally in repo)
4949
1. Build
5050
1. Run unit tests
5151
1. Create NuGet package
52-
52+
5353
#### Testing
5454

5555
This library comes with a set of unit tests using the [NUnit][nunit]

build.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
2-
CAKE_VERSION=0.35.0
3-
DOTNET_VERSION=3.0.100
2+
CAKE_VERSION=0.36.0
3+
DOTNET_VERSION=3.0.101

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"src"
44
],
55
"sdk": {
6-
"version": "3.0.100"
6+
"version": "3.0.101"
77
}
88
}

src/LitJson/JsonMapper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ private static object ReadValue (Type inst_type, JsonReader reader)
405405
list = new ArrayList ();
406406
elem_type = inst_type.GetElementType ();
407407
}
408+
409+
list.Clear();
408410

409411
while (true) {
410412
object item = ReadValue (elem_type, reader);

src/LitJson/LitJSON.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
14-
<PackageReference Include="SourceLink.Create.GitHub" Version="2.8.1" PrivateAssets="All" />
15-
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.8.1" />
16-
<DotNetCliToolReference Include="dotnet-sourcelink" Version="2.8.1" />
14+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
15+
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.8.3" />
16+
<DotNetCliToolReference Include="dotnet-sourcelink" Version="2.8.3" />
1717
</ItemGroup>
1818

1919
<PropertyGroup>

test/JsonMapperTest.cs

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,17 @@ public class NullableEnumTest
202202
public NullableEnum? TestEnum;
203203
}
204204

205+
class EmptyArrayInJsonDataTest
206+
{
207+
public int[] array;
208+
public string name;
209+
}
210+
211+
class EmptyArrayInJsonDataTestWrapper
212+
{
213+
public JsonData data = null;
214+
}
215+
205216
[TestFixture]
206217
public class JsonMapperTest
207218
{
@@ -310,13 +321,13 @@ public void ExportEnumsTest ()
310321
public void ExportEnumDictionaryTest()
311322
{
312323
Dictionary<Planets, int> planets = new Dictionary<Planets, int>();
313-
324+
314325
planets.Add(Planets.Jupiter, 5);
315326
planets.Add(Planets.Saturn, 6);
316327
planets.Add(Planets.Uranus, 7);
317328
planets.Add(Planets.Neptune, 8);
318329
planets.Add(Planets.Pluto, 9);
319-
330+
320331
string json = JsonMapper.ToJson(planets);
321332

322333
Assert.AreEqual("{\"Jupiter\":5,\"Saturn\":6,\"Uranus\":7,\"Neptune\":8,\"Pluto\":9}", json);
@@ -417,7 +428,7 @@ public void ExportValueTypesTest ()
417428
test.TestUInt = 90000000;
418429
test.TestULong = 0xFFFFFFFFFFFFFFFF; // = =18446744073709551615
419430
test.TestDateTimeOffset =
420-
new DateTimeOffset(2019, 9, 18, 16, 47,
431+
new DateTimeOffset(2019, 9, 18, 16, 47,
421432
50, 123, TimeSpan.FromHours(8)).AddTicks(4567);
422433

423434
string json = JsonMapper.ToJson (test);
@@ -871,7 +882,7 @@ public void ImportValueTypesTest ()
871882
Assert.AreEqual (90000000, test.TestUInt, "A8");
872883
Assert.AreEqual (18446744073709551615L, test.TestULong, "A9");
873884
Assert.AreEqual(
874-
new DateTimeOffset(2019, 9, 18, 16, 47,
885+
new DateTimeOffset(2019, 9, 18, 16, 47,
875886
50, 123, TimeSpan.FromHours(8)).AddTicks(4567),
876887
test.TestDateTimeOffset, "A10");
877888
}
@@ -1059,5 +1070,34 @@ public void NullableEnumExportTest()
10591070
expectedJson = "{\"TestEnum\":null}";
10601071
Assert.AreEqual(expectedJson, JsonMapper.ToJson(value));
10611072
}
1073+
1074+
[Test]
1075+
public void EmptyArrayInJsonDataExportTest()
1076+
{
1077+
string testJson = @"
1078+
{
1079+
""data"":
1080+
{
1081+
""array"": [],
1082+
""name"": ""testName""
1083+
}
1084+
}";
1085+
1086+
var response = JsonMapper.ToObject<EmptyArrayInJsonDataTestWrapper>(testJson);
1087+
var toJsonResult = response.data.ToJson();
1088+
string expectedJson = "{\"array\":[],\"name\":\"testName\"}";
1089+
Assert.AreEqual(toJsonResult, expectedJson);
1090+
}
1091+
1092+
[Test]
1093+
public void EmptyArrayInJsonDataTest()
1094+
{
1095+
var toJsonResult = JsonMapper.ToJson(new EmptyArrayInJsonDataTest {
1096+
name = "testName",
1097+
array = new int[0]
1098+
});
1099+
string expectedJson = "{\"array\":[],\"name\":\"testName\"}";
1100+
Assert.AreEqual(toJsonResult, expectedJson);
1101+
}
10621102
}
10631103
}

0 commit comments

Comments
 (0)