lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] NightOwl888 commented on issue #346: Remove Debugging.AssertsEnabled
Date Wed, 23 Sep 2020 06:30:10 GMT

NightOwl888 commented on issue #346:
URL: https://github.com/apache/lucenenet/issues/346#issuecomment-697161956


   > Couldn't we just add a conditional compilation flag for when compiling the tests projects?
Instead of a #if DEBUG it could be #if TESTING and otherwise the flag just defaults to false
always...
   
   End users who need to test their extensions in the compiled release will need to enable
the asserts. The [test framework requires asserts to be enabled](https://github.com/apache/lucenenet/blob/de5251c848b79223d394778cbb17ffc1388877ba/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs#L228)
in order to run all of the conditions and throw all of the expected exceptions.
   
   In addition, the [`CheckIndex` feature is "more thorough" with asserts enabled](https://github.com/apache/lucene-solr/blob/8fdf89690404c0e65784b2c5477552b9dec58591/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java#L1940).
   
   The main issue is the Lucene designers made no distinction between the `NUnit` asserts
and `Debug.Assert()`. The latter were designed to be able to be turned on in production by
end users as well as during testing.
   
   Not to mention, what are we actually testing if we rebuild after we test, and how do we
know the final build does what is expected?
   
   Your results might actually be skewed because you are seeing the initial impact of loading
up the `SystemProperties`. Keep in mind, that is only loaded once per application startup
and stored in a static field and then only has a minimal impact during running. It is crucial
that it is loaded up before the first time it is read (and it is using `LazyInitializer` already
to ensure only 1 thread has the impact).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message