Skip to content

Add unit tests for DateFormatPattern - #17873

Merged
alperozturk96 merged 5 commits into
nextcloud:masterfrom
Ruby20-50:add-date-format-pattern-test
Nov 4, 2026
Merged

alperozturk96 merged 5 commits into
nextcloud:masterfrom
Ruby20-50:add-date-format-pattern-test

Conversation

@Ruby20-50

Copy link
Copy Markdown
Contributor

Adds unit tests for DateFormatPattern.

Each test formats a fixed date (3 August 2024, 14:38, English locale) with one
pattern and checks the result against the example in the pattern's
documentation. The tests are plain JVM unit tests and need no Android SDK.

Run with:
.\gradlew.bat testGplayDebugUnitTest --tests "com.nextcloud.utils.date.DateFormatPatternTest"

🖼️ Screenshots

  • no screenshots
🏚️ Before 🏡 After
B A
N/A (test-only change, no UI) N/A

🏁 Checklist

  • [X ] ⛑️Tests (unit) are included
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • [X ] 🌸 PR title is meaningful (it is)

🤖 AI (if applicable)

  • [X ] The content of this PR was partly or fully generated using AI (N/A)
    I wrote and adapted this PR myself, with help from an AI assistant. It
    helped review the test, the commit message and explained
    the contribution workflow. I initiated the code, ran the tests and the style
    checks locally, and fixed problems along the way.

Format a fixed date with each pattern and compare the result with the example given in the pattern's documentation.

Signed-off-by: Ruby20-50 <rubamogalli@gmail.com>
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2026 <Ruba Mogalli> <rubamogalli@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hey,

Thank you for the PR. Could you please update license header via AGPL-3.0-or-later?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

noted

}

@Test
fun monthWithDate_formatsShortMonthAndDay() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have oriented my code on the second case with the backticks '`'
Thank you for the feedback

Ruby20-50 and others added 4 commits November 3, 2026 21:37
Signed-off-by: Ruby20-50 <rubamogalli@gmail.com>
Signed-off-by: Ruby20-50 <rubamogalli@gmail.com>
@alperozturk96
alperozturk96 merged commit 3b53419 into nextcloud:master Nov 4, 2026
4 of 5 checks passed
@Ruby20-50
Ruby20-50 deleted the add-date-format-pattern-test branch November 7, 2026 23:11
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

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