Re: automatically verifying code samples in phobos docs

2015-08-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-20 01:41, Laeeth Isharc wrote: Should this be done? How? Just use a documented unit tests block: /// unittest { // code goes here } It will be run as part of the unit tests and it will be included when generating the documentation. Although I don't have a good solution for

Re: automatically verifying code samples in phobos docs

2015-08-20 Thread wobbles via Digitalmars-d-learn
On Thursday, 20 August 2015 at 06:28:44 UTC, Jacob Carlborg wrote: On 2015-08-20 01:41, Laeeth Isharc wrote: [...] Just use a documented unit tests block: /// unittest { // code goes here } It will be run as part of the unit tests and it will be included when generating the

Re: automatically verifying code samples in phobos docs

2015-08-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-20 10:49, wobbles wrote: Will AutoProtocol().idup not make this work? Make an immutable copy of whatever AutoProtocol() returns, which should be then immutable char[] (i.e. string) Yes, that should work. -- /Jacob Carlborg

Re: automatically verifying code samples in phobos docs

2015-08-20 Thread jmh530 via Digitalmars-d-learn
On Thursday, 20 August 2015 at 06:28:44 UTC, Jacob Carlborg wrote: On 2015-08-20 01:41, Laeeth Isharc wrote: Should this be done? How? Just use a documented unit tests block: /// unittest { // code goes here } It will be run as part of the unit tests and it will be included when

automatically verifying code samples in phobos docs

2015-08-19 Thread Laeeth Isharc via Digitalmars-d-learn
Should this be done? How? I sent a pull request for the std.net.curl docs. They all talk about assigning the results of web requests to strings, but at least on my setup this does not work (cannot assign char[] to string). I was trying to walk someone else through using this and it was

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 20 August 2015 at 00:00:55 UTC, Timon Gehr wrote: On 08/20/2015 01:41 AM, Laeeth Isharc wrote: BTW I don't know why you can't convert a char[] to string - seems harmless enough conversion that way around. It would need to allocate a new string, otherwise, one would be able to

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Timon Gehr via Digitalmars-d-learn
On 08/20/2015 01:41 AM, Laeeth Isharc wrote: BTW I don't know why you can't convert a char[] to string - seems harmless enough conversion that way around. It would need to allocate a new string, otherwise, one would be able to modify the contents of the immutable string via the char[]

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, August 20, 2015 02:09:12 Timon Gehr via Digitalmars-d-learn wrote: On 08/20/2015 02:02 AM, Laeeth Isharc wrote: On Thursday, 20 August 2015 at 00:00:55 UTC, Timon Gehr wrote: On 08/20/2015 01:41 AM, Laeeth Isharc wrote: BTW I don't know why you can't convert a char[] to

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Timon Gehr via Digitalmars-d-learn
On 08/20/2015 02:02 AM, Laeeth Isharc wrote: On Thursday, 20 August 2015 at 00:00:55 UTC, Timon Gehr wrote: On 08/20/2015 01:41 AM, Laeeth Isharc wrote: BTW I don't know why you can't convert a char[] to string - seems harmless enough conversion that way around. It would need to allocate a

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 20 August 2015 at 01:56:31 UTC, Jonathan M Davis In general, the code examples are supposed to be unit tests with an empty ddoc comment on them so that they're unit tested. However, in the case of std.net.curl, because it would be contacting websites, I doubt that they're going