bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 12 forks source link

Assertions aren't evaluated in debug build #121

Closed woollybah closed 9 years ago

woollybah commented 9 years ago

From @FWeinb on July 2, 2015 8:38

I just tried the latest version and noticed that assertions aren't evaluated in any way.

Here is a reduced test case:

SuperStrict
Framework BRL.System

Function test(value:Int)
  Assert value > 0, "This is not possible"
  DebugLog "Function run"
End Function

Try
   test(-1)
   DebugLog "This is wrong!"
Catch e:Object
   DebugLog e.toString()
End Try

With the original bcc/bmk in debug build this evaluated to:

DebugLog:This is not possible

Process complete

In bmx-ng the assertion is ignored in a debug build and this is evaluated to:

DebugLog:Function run
DebugLog:This is wrong!

Copied from original issue: bmx-ng/bmx-ng#4

FWeinb commented 9 years ago

Thanks for moving, wasn't sure where to put it,

woollybah commented 9 years ago

Assertions are one of the remaining core features yet to be implemented...

FWeinb commented 9 years ago

Okay, good to know. I am experimenting with building a dependency injection module (injection.mod) based on reflection and to avoid a runtime penalty I try to check most things in the debug build with assertions.

FWeinb commented 9 years ago

Awesome! Great I will try it right now.

FWeinb commented 9 years ago

Thanks for fix it. Everything is now working fine for me.