Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[std.string] the example of outdent in dlang.org is wroung although the original unittest is correct #97

Open
mdparker opened this issue Jun 21, 2023 · 0 comments

Comments

@mdparker
Copy link
Member

ttanjo reported this on 2021-06-19T12:16:53Z

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

CC List

  • moonlightsentinel

Description

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.

```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:

```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.

Comments

moonlightsentinel commented on 2021-06-20T12:06:50Z

Changed the component to tools because the asserts are replaced by assert_writeln_magic.d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant