Zig in Depth: Testing

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 7

  • @flyLeonardofly
    @flyLeonardofly 10 месяцев назад +1

    Is the test code included when compiling a release build? Or put differently, is there a way to not compiling the test code when building a release?

    • @dudethebuilder
      @dudethebuilder  10 месяцев назад +3

      No, the test code is not included in release builds. The Zig compiler is quite aggressive when it comes to not including anything that's not needed in a release build. In fact, it doesn't even evaluate functions that are never called!

  • @user-dz6il2bx5p70
    @user-dz6il2bx5p70 Год назад +1

    Nice video, thank you! I know it's pretty simple to create it on our own, but does zig testing system also provides a table testing mechanism?

    • @dudethebuilder
      @dudethebuilder  Год назад +1

      At the moment it's a "build your own" type of situation (and maybe it'll stay that way given Zig's emphasis on keeping lean and simple) but building a table of structs and looping over them is pretty simple so the friction is low.

  • @doru-catalintogea4889
    @doru-catalintogea4889 8 месяцев назад +1

    Great video again!
    I noticed when you showed the build.zig file that (it seems) you had a init-lib type of project in this case. in my build.zig file from an init-exe I did not have this line where you can filter the tests. Maybe it can be added, I did not try, as I got your point. :-)

    • @dudethebuilder
      @dudethebuilder  8 месяцев назад

      Interestingly, in the 0.12 development version, they removed the split between init-exe and init-lib and now there's just one `int` that produces main.zig for an executable and root.zig for a library, and a build.zig that works for both. You can then add and remove as needed by your project.

  • @carlodom7422
    @carlodom7422 Год назад

    Promo'SM ☀️