Branch: refs/heads/main
Revision: 0c1f82b
Author: DanilaFe
Link: Factor common code from dyno resolution tests by DanilaFe · Pull Request #20201 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #20201 from DanilaFe/factor-dyno-tests
A lot of the dyno resolution tests use the same common functions, such as parseModule
.
However, each test file includes its own copy of these functions, which leads to a lot of
duplication, and introduces the possibility of these functions going out of sync. If possible,
we'd like to avoid this.
This PR introduces a new library target / object file that contains common functions
intended to be shared among all dyno tests. This new library is linked with all tests, and
thus allows them to share common code. Here's a summary of the changes:
- The CMake function
comp_unit_test
is pushed intodyno/tests/CMakeLists.txt
from
dyno/CMakeLists.txt
. It seemed cleaner to introduce the new "common test code"
library indyno/tests
, and then refer to it in the same place from inside
comp_unit_test
. The existingtests
target is also pushed to the subdirectory. - The
parseModule
,parseTypeOfX
andparseTypeOfXInit
functions are moved
into newcommon.{h, cpp}
files. TheparseTypeOfX
function is different across some
tests (which seems to me like a good reason to have a "canonical" place for these things);
the two versions are renamed toparseTypeOfX
(version returningType*
) and
parseQualifiedTypeOfX
(version returningQualifiedType
).
Reviewed by @mppf, thank you!
Modified Files:
A compiler/dyno/test/common.cpp
A compiler/dyno/test/common.h
M compiler/dyno/CMakeLists.txt
M compiler/dyno/test/CMakeLists.txt
M compiler/dyno/test/resolution/testEnums.cpp
M compiler/dyno/test/resolution/testFieldAccess.cpp
M compiler/dyno/test/resolution/testLoopIndexVars.cpp
M compiler/dyno/test/resolution/testMultiDecl.cpp
M compiler/dyno/test/resolution/testParamFolding.cpp
M compiler/dyno/test/resolution/testProcThis.cpp
M compiler/dyno/test/resolution/testTuples.cpp
M compiler/dyno/test/resolution/testTypeAndInit.cpp
M compiler/dyno/test/resolution/testTypeConstruction.cpp
M compiler/dyno/test/resolution/testTypeQueries.cpp
Compare: https://github.com/chapel-lang/chapel/compare/63ff0a63a5b5...0c1f82be1910