Introduce assertions for DateTime#382
Merged
vincentparrett merged 3 commits intoVSoftTechnologies:masterfrom Apr 13, 2026
Merged
Introduce assertions for DateTime#382vincentparrett merged 3 commits intoVSoftTechnologies:masterfrom
vincentparrett merged 3 commits intoVSoftTechnologies:masterfrom
Conversation
added 2 commits
March 27, 2026 09:34
Member
|
Thanks, this looks good - I wasn't able to check D2010 & XE as I don't have them installed, but SameDate appears in XE2 (the earliest version I have installed). Not too worried, we can IFDEF for XE or earlier for now until we know for sure. |
Member
|
Hi Luebbe Can you merge master into your branch and fix the conflicts and I will merge the PR. We can deal with 2010/XE if someone has a problem. Gemini tells me SameDate was added in D6 but who knows if that is correct. |
Resolved conflicts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As always, a PR out of personal need :)
Since Assert.AreEqual can't really distinguish between date/time values and floats and Assert.IsTrue(SameDate(...)) doesn't really help to point out the differences, I introduced assertions for date/time values.
DUnitX' own tests deliver failing tests on German locale, because TValue.From fails to parse the English dates in the test cases (All dates convert to 30.12.1899). This is why I can show you some nice before/after screenshots here.
Before (using Assert.IsTrue):
After (using the new assertions):
You can provoke failures on Englisch locale if you set expectedDate and expectedTime in DUnitX.Test.Utils to something else.
90% of the changes in Tests/DUnitX.Tests.Utils.pas are caused by tabs being converted to spaces when the file was saved.
Maybe we need an IFDEF for XE* Versions. I don't know when the Same(Date/Time) functions where introduced. The new assertions should at least work from Delphi 10 onwards.