www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22043] New: [std.string] the example of `outdent` in

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

          Issue ID: 22043
           Summary: [std.string] the example of `outdent` in dlang.org is
                    wroung although the original unittest is correct
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/phobos/
                OS: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: ttanjo gmail.com

I tentatively set the component field of this bug to `dlang.org` but I'm not
sure it is an appropriate. Please fix the component field if another component
is more appropriate for it.

The example of `outdent` is wrong in dlang.org because there is a missing
indent for the line `writeln("Hello");` in `ugly` as follows.

- https://dlang.org/phobos-prerelease/std_string.html#.outdent

```dlang
enum pretty = q{
   import std.stdio;
   void main() {
       writeln("Hello");
   }
}.outdent();

enum ugly = q{
import std.stdio;
void main() {
writeln("Hello");
}
};

writeln(pretty); // ugly
```

However, the original documented unittest in std.string.outdent is correct as
follows:

-
https://github.com/dlang/phobos/blob/afb382485b3625e149bb20d593b6d1fe679410af/std/string.d#L6903

```dlang
 safe pure unittest
{
    enum pretty = q{
       import std.stdio;
       void main() {
           writeln("Hello");
       }
    }.outdent();

    enum ugly = q{
import std.stdio;
void main() {
    writeln("Hello");
}
};

    assert(pretty == ugly);
}
```

It seems a bug in the document generator in dmd or related components.

--
Jun 19