Skip to content

Commit

Permalink
Merge branch 'xoofx:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith authored Jan 29, 2024
2 parents ce792b5 + ffcc734 commit c32a3dd
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- name: Install .NET 6.0
uses: actions/setup-dotnet@v1
- name: Install .NET 7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
dotnet-version: '7.0.x'

- name: Build, Test, Pack, Publish
shell: bash
Expand Down
13 changes: 13 additions & 0 deletions src/Tomlyn.Tests/BasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ namespace Tomlyn.Tests
{
public class BasicTests
{
[Test]
public void TestTableArraysContainingPrimitiveArraysSerialize()
{
var test = @"[[table_array]]
primitive_list = [4, 5, 6]
";

var model = Toml.ToModel(test);
var tomlOut = Toml.FromModel(model);

Assert.AreEqual(test, tomlOut);
}

[Test]
public void TestHelloWorld()
{
Expand Down
10 changes: 5 additions & 5 deletions src/Tomlyn.Tests/Tomlyn.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="nunit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions src/Tomlyn/Model/Accessors/DictionaryDynamicAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ public SlowDictionaryAccessor(DynamicModelReadContext context, Type dictionaryTy

public override IEnumerable<KeyValuePair<string, object?>> GetElements(object dictionary)
{
var it = (IEnumerable)dictionary;
var enumerator = (IDictionaryEnumerator)it.GetEnumerator();
var enumerator = ((IDictionary)dictionary).GetEnumerator();
while (enumerator.MoveNext())
{

Expand Down
4 changes: 4 additions & 0 deletions src/Tomlyn/Model/ModelToTomlTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ private bool IsRequiringInline(object? value)

private bool IsRequiringInline(ListDynamicAccessor accessor, object value, int parentConsecutiveList)
{
// Always disable inline for TomlTableArray
// This is only working for default TomlTableArray model
if (value is TomlTableArray) return false;

foreach (var element in accessor.GetElements(value))
{
if (element is null) continue; // TODO: should this log an error?
Expand Down
2 changes: 1 addition & 1 deletion src/Tomlyn/Tomlyn.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net7.0</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<Description>Tomlyn is a TOML parser, validator and authoring library for .NET.</Description>
<Copyright>Alexandre Mutel</Copyright>
Expand Down
2 changes: 1 addition & 1 deletion src/global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.100",
"version": "7.0.100",
"rollForward": "latestMinor",
"allowPrerelease": false
}
Expand Down

0 comments on commit c32a3dd

Please sign in to comment.