Skip to content

Run textwrap.dedent on text files created by the test runner #21101

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

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jan 18, 2024

This means we can indent out test snippets in the python code and should never need to use column 1.

The files on disc that the test runner writes will have sane/normal indentation even if we use extra indentation in the python source to make things readable.

For example:

    create_file('a.c', '''
       int main()
         printf("hello\n");
       }
    ''')

Would generate a file on disc containing:

int main()
  printf("hello\n");
}

This means we can indent out test snippets in the python code and should
never need to use column 1.

The files on disc that the test runner writes will have sane/normal
indentation even if we use extra indentation in the python source to
make things readable.

For example:

```
    create_file('a.c', '''
       int main()
         printf("hello\n");
       }
    ''')
```

Would generate a file on disc containing:

```
int main()
  printf("hello\n");
}
```
@sbc100 sbc100 requested a review from kripken January 18, 2024 19:56
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm if tests pass. I worry some test might care about the indentation... but maybe we already dedented those manually before.

@sbc100
Copy link
Collaborator Author

sbc100 commented Jan 19, 2024

lgtm if tests pass. I worry some test might care about the indentation... but maybe we already dedented those manually before.

Its possible, but very unlikely, and we would know right away if a test was effected by this. Most significant tests already use standalone files rather then embedding sources.

@sbc100 sbc100 merged commit 9993c51 into emscripten-core:main Jan 19, 2024
@sbc100 sbc100 deleted the dedent_test_files branch January 19, 2024 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants