[Issue 18623] Documented unittest should not allow private symbol access

2022-03-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18623

--- Comment #9 from Nick Treleaven  ---
>From the pull:

> If someone wants to document private symbols, why prevent it ? 
> In the example, the documented unittest is attached to a private symbol, 
> isn't it ?

If you want to support that unusual case, require private unittest to enable
using private symbols in the documented test. (The documented unittest could
even be inferred as private if the symbol it's documenting is private).

I would like to reopen this.

--


[Issue 18623] Documented unittest should not allow private symbol access

2022-03-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18623

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |WONTFIX

--- Comment #8 from RazvanN  ---
Closing as per comments in: https://github.com/dlang/dmd/pull/13783

--


[Issue 18623] Documented unittest should not allow private symbol access

2022-03-08 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18623

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #7 from Dlang Bot  ---
@RazvanN7 created dlang/dmd pull request #13783 "Fix Issue 18623 - Documented
unittest should not allow private symbol access" fixing this issue:

- Fix Issue 18623 - Documented unittest should not allow private symbol access

https://github.com/dlang/dmd/pull/13783

--


[Issue 18623] Documented unittest should not allow private symbol access

2018-07-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18623

--- Comment #6 from greenify  ---
FWIW the tools extractor that is used by Phobos is now on dub:

https://code.dlang.org/packages/dtools

dub fetch dtools
dub run dtools:tests_extractor

--


[Issue 18623] Documented unittest should not allow private symbol access

2018-05-06 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18623

--- Comment #5 from greenify  ---
Andrei and Walter are not really keen on adding more and more cli switches.
The unittest extraction pipeline is far from ideal, but it's probably the best
we will get in this sector.

--


[Issue 18623] Documented unittest should not allow private symbol access

2018-05-06 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18623

--- Comment #4 from Steven Schveighoffer  ---
I agree that can be a valid concern.

Let me restate that I would recommend if we do this, make it an opt-in switch.

--


[Issue 18623] Documented unittest should not allow private symbol access

2018-05-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18623

--- Comment #3 from Nick Treleaven  ---
(In reply to Steven Schveighoffer from comment #2)
> You may want to test things inside
> your unit test that have nothing to do with the example, but use the same
> code for setup, and then you have to write that code twice.

If you really want your *documented* unittest not to be runnable by a user, you
can wrap your private code in a free function with `protected` access as a
workaround.

> It's pretty easy to say // private data, for testing only.

The whole point of this issue is for when the programmer is unaware that the
documented example contains private symbols *unintentionally*. This is clearly
a significant problem otherwise @greenify wouldn't have added a custom
automated test for Phobos to check this. Copying and pasting from other tests
is a classic trigger for this.

--


[Issue 18623] Documented unittest should not allow private symbol access

2018-03-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18623

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@yahoo.com

--- Comment #2 from Steven Schveighoffer  ---
I would vote to close this as WONTFIX. You may want to test things inside your
unit test that have nothing to do with the example, but use the same code for
setup, and then you have to write that code twice. It's pretty easy to say //
private data, for testing only.

--


[Issue 18623] Documented unittest should not allow private symbol access

2018-03-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18623

greenify  changed:

   What|Removed |Added

 CC||greeen...@gmail.com

--- Comment #1 from greenify  ---
I agree though the compiler currently doesn't know whether the test is ddoc-ed
when -D isn't passed. As it throws away all documentation text during parsing.

For Phobos we use a workaround which extracts all public tests and puts them in
separate files and then executes them:

https://github.com/dlang/tools/blob/master/tests_extractor.d

--


[Issue 18623] Documented unittest should not allow private symbol access

2018-03-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18623

Alex  changed:

   What|Removed |Added

 CC||sascha.or...@gmail.com

--