diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0250739..db184de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,18 +25,13 @@ jobs: - name: Checkout source code uses: actions/checkout@v2 - - name: Setup dotnet 2.1 + - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 2.1.* - - name: Setup dotnet 3.1 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.* - - name: Setup dotnet 5.0 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.* + dotnet-version: | + 3.1.x + 5.0.x + 6.0.x - name: Test run: dotnet test --configuration Release diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 13b9c31..8eeae16 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,20 +17,13 @@ jobs: - name: Checkout source code uses: actions/checkout@v2 - - name: Setup dotnet 2.1 + - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 2.1.* - - - name: Setup dotnet 3.1 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.* - - - name: Setup dotnet 5.0 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.* + dotnet-version: | + 3.1.x + 5.0.x + 6.0.x - name: Test run: dotnet test --configuration Release diff --git a/src/Parlot/Fluent/OneOrMany.cs b/src/Parlot/Fluent/OneOrMany.cs index bbb334a..676c3aa 100644 --- a/src/Parlot/Fluent/OneOrMany.cs +++ b/src/Parlot/Fluent/OneOrMany.cs @@ -46,7 +46,7 @@ public CompilationResult Compile(CompilationContext context) var result = new CompilationResult(); var success = context.DeclareSuccessVariable(result, false); - var value = context.DeclareValueVariable(result, Expression.Default(typeof(List))); + var value = context.DeclareValueVariable(result, Expression.New(typeof(List))); // value = new List(); // diff --git a/src/Parlot/Parlot.csproj b/src/Parlot/Parlot.csproj index bb92efc..1fcb480 100644 --- a/src/Parlot/Parlot.csproj +++ b/src/Parlot/Parlot.csproj @@ -13,7 +13,7 @@ - + diff --git a/test/Parlot.Tests/CompileTests.cs b/test/Parlot.Tests/CompileTests.cs index 76ea9f1..8f4c496 100644 --- a/test/Parlot.Tests/CompileTests.cs +++ b/test/Parlot.Tests/CompileTests.cs @@ -180,6 +180,16 @@ public void ShouldCompileZeroOrManys() Assert.Equal(new[] { "hello", "world", "hello" }, result); } + [Fact] + public void ShouldCompileOneOrManys() + { + var parser = OneOrMany(Terms.Text("hello").Or(Terms.Text("world"))).Compile(); + + var result = parser.Parse(" hello world hello"); + + Assert.Equal(new[] { "hello", "world", "hello" }, result); + } + [Fact] public void ShouldCompileZeroOrOne() { diff --git a/test/Parlot.Tests/Parlot.Tests.csproj b/test/Parlot.Tests/Parlot.Tests.csproj index bdf63bd..c4250d0 100644 --- a/test/Parlot.Tests/Parlot.Tests.csproj +++ b/test/Parlot.Tests/Parlot.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1;net5.0;netcoreapp3.1 + net5.0;netcoreapp3.1;net6.0 false 9.0