serilog / serilog-expressions

An embeddable mini-language for filtering, enriching, and formatting Serilog events, ideal for use with JSON or XML configuration.
Apache License 2.0
193 stars 17 forks source link

Add a recipie for checking if an object is empty #80

Closed adamchester closed 2 years ago

adamchester commented 2 years ago

It took me quite a while to figure out how to conditionally check if the rest(true) object was empty, so here it is:

image

SimonCropp commented 2 years ago

@adamchester is there an existing test for that scenario?

nblumhardt commented 2 years ago

@SimonCropp I think for these the tests usually cover the individual functions and operators; the recipes are just examples. Or did I misunderstand what you mean? Cheers!

adamchester commented 2 years ago

Yeah I think it’s a good call to consider if there’s a test that covers this issue.

documenting it is taking it from an accident to a thing we want to keep working?

nblumhardt commented 2 years ago

:+1:

Not an accident though - just regular structural equality at work :-)

Should be nice and easy to add some to expression-cases.asv if anyone's keen! I'm on the road so won't be able to loop back for a little while :-)

adamchester-lmg commented 2 years ago

I found this test case:

{rest(true)}                                         ⇶ {}

I wonder if that's enough?

nblumhardt commented 2 years ago

I think so :+1: -- that's the same logic