This is an archive of the discontinued LLVM Phabricator instance.

[SyntaxTree] Split tests
ClosedPublic

Authored by eduucaldas on Aug 12 2020, 1:57 AM.

Details

Summary

We do that because:

  • Big tests generated big tree dumps that could hardly serve as documentation.
  • In most cases the tests didn't share setup, thus there was not much addition in lines of code.

Diff Detail

Event Timeline

eduucaldas created this revision.Aug 12 2020, 1:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2020, 1:57 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
eduucaldas requested review of this revision.Aug 12 2020, 1:57 AM

Before we had an UnqualifiedId test that tested for everything in the grammar. Now we just split this test and test the alternatives separately.

clang/unittests/Tooling/Syntax/TreeTest.cpp
635–666

It seems inappropriate to always repeat UnqualfiiedId, do you have any other suggestion?

Split tests for UserDefinedLiteral
Split tests for NumericUserDefinedLiteral
Split tests for NestedBinaryOperator
Split tests for UserDefinedBinaryOperator
Split tests for UserDefinedPrefixOperator

  • [SyntaxTree] Split tests for QualifiedId

Rename tests following TestSuite_TestCase

eduucaldas added inline comments.Aug 12 2020, 7:03 AM
clang/unittests/Tooling/Syntax/TreeTest.cpp
635–666

Last commit change names to TestSuite_TestCase

1005

Here I didn't merely split the tests, I also changed them a bit. PTAL.

1712–1714

Same setup for FloatUserDefinedLiteral. I think it is justified with the Annotations we can constraint the dump just to the expressions being tested

gribozavr2 accepted this revision.Aug 12 2020, 3:47 PM

Please also consider splitting the file into multiple.

clang/unittests/Tooling/Syntax/TreeTest.cpp
1238

Indent -2.

1412

For consistency with other test names: QualifiedId_DecltypeSpecifier

2646

BinaryOperator_NestedWithParenthesis

2690

BinaryOperator_Associativity

2750

BinaryOperator_Precedence

2805

UserDefinedOperator => OverloadedOperator?

"user-defined" seems to suggest that the operator was previously not a thing in C++.

3021

UserDefinedOperator_LeftShift

3161

UserDefinedOperator_PointerToMember

3230

PrefixIncrement

3284

UserDefinedOperator_Negation

3393

PostfixIncrement

Also, group it right after prefix increment?

This revision is now accepted and ready to land.Aug 12 2020, 3:47 PM
eduucaldas marked 11 inline comments as done.

Answer review comments

clang/unittests/Tooling/Syntax/TreeTest.cpp
2805

Actually it is a very good point! Thanks!

3393

I'm grouping together Prefix operators. But you're right it makes sense to put them close to each other. I've put PrefixIncrement as the last Prefix operator to achieve that

eduucaldas added inline comments.Aug 13 2020, 12:57 AM
clang/unittests/Tooling/Syntax/TreeTest.cpp
1712–1714

Taking account the Annotations change. Duplicating two lines of code between tests should be ok.

We'll split this file in a future change

This revision was landed with ongoing or failed builds.Aug 13 2020, 1:18 AM
This revision was automatically updated to reflect the committed changes.