https://issues.dlang.org/show_bug.cgi?id=18488

Seb <greensunn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |greensunn...@gmail.com
         Resolution|---                         |WONTFIX

--- Comment #1 from Seb <greensunn...@gmail.com> ---
It's not a bug, but a feature.

1) ALL public examples need to be runnable locally and dlang.org
That's not optional, but a deep requirement from mistakes in the past and the
resulting bad image.

2) We don't use version(unittest) for future code and are about to weed out the
last usages in Phobos, because you essentially just ended up with
- accidentally exposing a public symbol
- adding different behavior for -unittest (i.e. the testsuites) - there have
been quite a few bugs where `version(unittest) { import std.stdio;}` led to
bugs in user code because of templates and their dependence on the
version(unittest) imports which obviously wasn't caught by the testsuite.

While I really like your enthusiasm and in general a lot of things in the D
lang are old, same are quite new and have a reason for being there, so
sometimes taking a moment to step back and check why there's a CI warning (and
not directly opening a bug report + finding "workarounds") would save you save
time and frustration.

> The solution would be for test_extractor to export `vesion(unittest)` 
> declarations.

That wouldn't help and you can already do better today with a
ConditionalDeclaration visitor, e.g. in pseudo-code:

---
override void visit(const ConditionalDeclaration decl){
   // if decl is unittest
    auto text = cast(immutable(char)[]) sourceCode[decl.startLocation
decl.endLocation];    
}
---

--

Reply via email to