Skip to content

Commit 02f8409

Browse files
committed
Tests & fixes
1 parent 5bf94d1 commit 02f8409

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/Serilog.Expressions/Serilog.Expressions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Description>An embeddable mini-language for filtering, enriching, and formatting Serilog
55
events, ideal for use with JSON or XML configuration.</Description>
6-
<VersionPrefix>1.1.2</VersionPrefix>
6+
<VersionPrefix>2.0.0</VersionPrefix>
77
<Authors>Serilog Contributors</Authors>
88
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
99
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

src/Serilog.Expressions/Templates/Compilation/TemplateCompiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static CompiledTemplate Compile(Template template, NameResolver nameResol
2020
Conditional conditional => new CompiledConditional(
2121
ExpressionCompiler.Compile(conditional.Condition, nameResolver),
2222
Compile(conditional.Consequent, nameResolver),
23-
conditional.Alternative == null ? null : Compile(conditional.Consequent, nameResolver)),
23+
conditional.Alternative == null ? null : Compile(conditional.Alternative, nameResolver)),
2424
_ => throw new NotSupportedException()
2525
};
2626
}

test/Serilog.Expressions.Tests/Cases/template-evaluation-cases.asv

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@ Aligned {42,4}! ⇶ Aligned 42!
1313
Left {42,-4}! ⇶ Left 42 !
1414
Under width {42,0}! ⇶ Under width 42!
1515
{@m} ⇶ Hello, nblumhardt!
16-
Hello, {#if 1 = 1}world{#end}! ⇶ Hello, world!
17-
Hello, {#if true}world{#else}there{#end}! ⇶ Hello, world!
16+
Hello, {#if true}world{#end}! ⇶ Hello, world!
17+
Hello, {#if true}w{42}d{#end}! ⇶ Hello, w42d!
18+
Hello, {#if 1 = 1}world{#else}there{#end}! ⇶ Hello, world!
19+
Hello, {#if 1 = 2}world{#else}there{#end}! ⇶ Hello, there!
20+
Hello, {#if undefined()}world{#else}there{#end}! ⇶ Hello, there!
21+
A{#if false}B{#else if false}C{#else if true}D{#else}E{#end} ⇶ AD
22+
A{#if false}B{#else if true}C{#end} ⇶ AC
23+
{#if true}A{#if false}B{#else}C{#end}D{#end} ⇶ ACD

0 commit comments

Comments
 (0)