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

Refactored four test method pairs #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AliIman
Copy link

@AliIman AliIman commented Jun 16, 2021

As part of a research project at the University of Waterloo, we are exploring automatic test refactoring tools and submitting vetted proposed refactorings upstream. These refactorings make it easier to add additional related tests and should help with the maintainability of the tests.
These are all automated refactorings, but we have checked every case and made sure that all the test cases still pass successfully.
If it helps, we can also propose a test case that uses these refactored methods. We explained each of the four refactoring cases briefly below.

  1. Test method pair "testRead_partialArray()" and "testRead_partialArray_sliceLarger()" only differ in an int value (8 vs 10). We create parametrized "jimfsInputStreamTestTestRead_partialTemplate(int i1)" method, which allows you to add similar test cases with different argument i1.

  2. Test method pairs "testNormalizeNfc_pattern()" and "testNormalizeNfd_pattern()", and "testNormalizeNfcCaseFoldAscii_pattern()" and "testNormalizeNfdCaseFoldAscii_pattern()", only differ in a PathNormalization (NFC vs NFD). We create parametrized "pathNormalizationTestTestNormalizeCaseFoldAscii_patternTemplate(PathNormalization pathNormalization1)" and "pathNormalizationTestTestNormalizeTemplate(PathNormalization pathNormalization1)" methods.

  3. Test method pair "testWindows_relativePathsWithDriveRoot_unsupported()" and "testWindows_absolutePathOnCurrentDrive_unsupported()" only differ in two strings ("C:" vs "\foo\bar" and "C:foo\bar" vs "\"). We create parametrized "public void windowsPathTypeTestTestTemplate(String string1, String string2)" method.

@google-cla
Copy link

google-cla bot commented Jun 16, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Jun 16, 2021
@AliIman
Copy link
Author

AliIman commented Jun 16, 2021

@googlebot I signed it!

@google-cla google-cla bot added cla: yes and removed cla: no labels Jun 16, 2021
@cgdecker
Copy link
Member

Thanks for the PR. I'm not going to merge it at the moment because it's not clear to me that this is an improvement... reducing duplication is generally good, but not as much so in tests where some amount of duplication can make the expected behavior more clear in each test case. But I'll leave it open for the moment because it's possible this could benefit from reducing duplication to some extent.

@cgdecker cgdecker added the P4 label Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants