Skip to content

Add unit tests for DateFormatPattern - #17873

Open
Ruby20-50 wants to merge 1 commit into
nextcloud:masterfrom
Ruby20-50:add-date-format-pattern-test
Open

Ruby20-50 wants to merge 1 commit into
nextcloud:masterfrom
Ruby20-50:add-date-format-pattern-test

Conversation

@Ruby20-50

Copy link
Copy Markdown

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?

}

@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.

This branch has not been deployed

No deployments
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