[phobos] Example from std.format throws exception
Sebastian Wilzbach via phobos
phobos at puremagic.com
Thu Jul 20 10:23:02 PDT 2017
Hi Igor,
thanks a lot for taking the time to report this, but could you please
use the issue tracker next time?
In other words: why didn't you respond to the issue to which I replied
within __an hour__? [1]
Regarding #17672: as mentioned there, we do automatically check that all
runnable examples work [2].
However, there was a bug fix [3] which landed in 2.075 that also changed
the public example (for reference the public examples at previous
release looked different [4]).
Now the reason why you experienced the issue was that the daily cron job
that updates the Docker images hasn't run yet and thus the backend was
still testing with 2.074.1.
As mentioned on [1] I immediately triggered a rebuilt and will keep a
closer eye on the next release (TBH I was impressed to see this
happening).
Hence, I marked the issue as resolved - you could have reopened it ;-)
Now to the example that you posted, the key difference is the following:
Your example:
---
assert(format("%12,3.3f", 1234.5678) == " 1,234.568", "'" ~
format("%12,3.3f", 1234.5678) ~ "'");
---
Example on dlang.org:
---
assert(format("%12,3.3f", 1234.5678) == " 1,234.568", "'" ~
format("%12,3.3f", 1234.5678) ~ "'");
---
I also tested with multiple browsers - it still works nicely [6].
Did you modify the example yourself?
Could you please provide more details, s.t. we can help you?
Regards,
Seb
[1] https://issues.dlang.org/show_bug.cgi?id=17672
[2]
http://dlang.org/blog/2017/03/08/editable-and-runnable-doc-examples-on-dlang-org
[3]
https://github.com/dlang/phobos/commit/cc8eff102f4ddcf15c4def1a5b87786c3040689d
[4] https://docarchives.dlang.io/v2.074.0/phobos/std_format.html
[5] https://is.gd/b3UxtJ
[6] http://imgur.com/a/6aQEU
On 2017-07-20 12:11, ikornilov via phobos wrote:
> Example
> https://run.dlang.io/?compiler=dmd&source=void%20main()%0A%7B%0A%20import%20std.format;%0A%20import%20std.stdio:%20write,%20writeln,%20writef,%20writefln;%0A%20writeln(format(%22%25,d%22,%201000));%20%2F%2F%20%221,000%22%0A%20writeln(format(%22%25,f%22,%201234567.891011));%20%2F%2F%20%221,234,567.891,011%22%0A%20writeln(format(%22%25,%3Fd%22,%20%27%3F%27,%201000));%20%2F%2F%20%221%3F000%22%0A%20writeln(format(%22%25,1d%22,%201000));%20%2F%2F%20%221,0,0,0%22%0A%20writeln(format(%22%25,*d%22,%204,%20-12345));%20%2F%2F%20%22-1,2345%22%0A%20writeln(format(%22%25,*%3Fd%22,%204,%20%27_%27,%20-12345));%20%2F%2F%20%22-1_2345%22%0A%20writeln(format(%22%25,6%3Fd%22,%20%27_%27,%20-12345678));%20%2F%2F%20%22-12_345678%22%0A%20assert(format(%22%2512,3.3f%22,%201234.5678)%20%3D%3D%20%22%201,234.568%22,%20%22%27%22%20~%0A%20format(%22%2512,3.3f%22,%201234.5678)%20~%20%22%27%22);%0A%7D
> from page https://dlang.org/phobos/std_format.html throws exception:
> std.format.FormatException at C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(1744):
> integral
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
More information about the phobos
mailing list