summaryrefslogtreecommitdiff
path: root/ojluni/src/test/java/time
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Update test expectation due to locale data change in ICU 68.2"vichang2021-01-221-3/+9
|\
| * Update test expectation due to locale data change in ICU 68.2Victor Chang2021-01-211-3/+9
| | | | | | | | | | | | Bug: 160356314 Test: atest CtsIcu4cTestCases CtsIcuTestCases CtsLibcoreTestCases CtsLibcoreOjTestCases CtsBionicTestCases CtsTextTestCases Change-Id: I068d42d5184a169cd5b6291a383e4d161f84a286
* | Update java.time.Duration partially to 11+28Nikita Iashchenko2021-01-211-1/+330
|/ | | | | | | | | | | | | | | | | Updated javadocs. Imported methods: * long dividedBy(Duration divisor) * long toDaysPart() * int toHoursPart() * int toMinutesPart() * int toSecondsPart() * int toMillisPart() * int toNanosPart() * Duration truncatedTo(TemporalUnit) Test: atest CtsLibcoreOjTestCases:tck.java.time.TCKDuration Change-Id: Ie976bec8224cd7eb0e2d91956b081202fdb022a6
* Update LocalTime partially to 11+28Nikita Iashchenko2021-01-201-1/+61
| | | | | | | | | | | | | Imported NANOS_PER_MILLI constant, updated javadocs. Imported methods: * LocalTime ofInstant(Instant, ZoneId) * long toEpochSecond(LocalDate, ZoneOffset) Added unit test from upstream. Test: n/a Change-Id: I814f1e9239c5b672e48bd54dabd0703927b91eea
* Replace @IntraCoreApi ZoneMeta.getCanonicalCLDRID with a public APIVictor Chang2020-10-141-2/+15
| | | | | | | | No known functional change. Bug: 139480281 Test: atest CtsLibcoreOjTestCases Change-Id: I29754bc25541f0b295a97b3a5c0d225f31454dd1
* Add markers for new Japanese Era related filesNikita Iashchenko2020-02-193-0/+25
| | | | | | | | | | | | | | | | | | | | CLs https://r.android.com/1237091 and https://r.android.com/940636 integrated two upstream OpenJDK commits to finalize support for new Japanese Era Reiwa: * http://hg.openjdk.java.net/jdk/jdk/rev/6a4abdb6749c 8174268: Declare a public field in JapaneseEra for the era starting May 2019 * http://hg.openjdk.java.net/jdk/jdk/rev/3d8934bf505a 8205432: Replace the placeholder Japanese era name This CL adds the appropriate change markers for the differences relative to the respective upstream revision (OpenJDK 8u121-b13 or 8u222, depending on the file). Bug: 149437171 Test: CtsLibcoreTestCases CtsLibcoreOjTestCases Change-Id: I182bc98a374c127b2e6cee41991427f4fe5b9b54
* Declare a public field for new Japanese Era ReiwaNikita Iashchenko2020-02-183-15/+15
| | | | | | | | | | | | Integrate OpenJDK commit for new Japanese Era name: * 8174268: Declare a public field in JapaneseEra for the era starting May 2019 http://hg.openjdk.java.net/jdk/jdk/rev/6a4abdb6749c Bug: 149437171 Test: CtsLibcoreTestCases CtsLibcoreOjTestCases Merged-In: I3e84ed1d809376d2c646ceadc3421b5fb55982b5 Change-Id: I3e84ed1d809376d2c646ceadc3421b5fb55982b5
* Android patch: update TestDateTimeTextProvider test expectations with CLDR ↵Nikita Iashchenko2019-12-191-20/+21
| | | | | | | | data from icu65.1 Bug: 138853239 Test: atest CtsLibcoreOjTestCases:test.java.time.format.TestDateTimeTextProvider Change-Id: Ib01fc67914523b81d253db1a2d43d9e17076520c
* Cleanup "NewEra" comment after implementing new Japanese EraNikita Iashchenko2019-04-251-1/+1
| | | | | | | | | | | This comment has been removed in the upstream commit http://hg.openjdk.java.net/jdk/jdk/rev/3d8934bf505a#l15.25 and should have also been removed in http://r.android.com/940636, but we missed that during merging. Bug: 77858319 Test: m droid Change-Id: Ifa1b08e72328aaefd48a615a445e2331e9407d5f
* New Japanese Era implementation with actual Reiwa name (part 2)Nikita Iashchenko2019-04-241-2/+1
| | | | | | | | | | | | | | This change should have been done as a part of http://r.android.com/940636 but was accidentally missed during merging. It includes the following upstream commit: 8205432: Replace the placeholder Japanese era name http://hg.openjdk.java.net/jdk/jdk/rev/3d8934bf505a Bug: 77858319 Test: cts-tradefed run cts-dev -m CtsLibcoreOjTestCases Test: cts-tradefed run cts-dev -m CtsLibcoreTestCases Change-Id: Ie74af5b9cb5559a829cbb671f87fd791d1680d8b
* New Japanese Era implementation with actual Reiwa nameNikita Iashchenko2019-04-174-19/+44
| | | | | | | | | | | | Integrate OpenJDK commit for new Japanese Era name: - 8205432: Replace the placeholder Japanese era name http://hg.openjdk.java.net/jdk/jdk/rev/3d8934bf505a Bug: 77858319 Test: CtsLibcoreTestCases Test: CtsLibcoreOjTestCases Change-Id: Ic07b536e7fd62b2d3e0fe4e9edd36d6c6f183b06
* New Japanese Era implementation in ojluni with a placeholder nameNikita Iashchenko2019-04-175-13/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | This integrates all upstream changes up to OpenJDK 8u212-b01 It consists the following commits from upstream - 8202088: Japanese new era implementation http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/bc0a3a91a074 - 8212941: Support new Japanese era in java.time.chrono.JapaneseEra http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/c35f231af17a - 8171049: Era.getDisplayName doesn't work with non-IsoChronology http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/3cb43f3afe1c - 8177678: Overstatement of universality of Era.getDisplayName() implementation http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/49bcab3213c1 - 8054214: JapaneseEra.getDisplayName doesn't return names if it's an additional era http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/0d9af9ca16e2 new Android-changed: - JapaneseImperialCalendar.currentEra is changed to be hard-coded because Zygote could initialize currentEra with incorrect system time. - TestNonIsoFormatter#test_lenientEraYear is updated to use CLDR data Bug: 77858319 Test: CtsLibcoreTestCases Test: CtsLibcoreOjTestCases Change-Id: I74b05bcbd39c5caec48c0de13e784127044b19ff
* Updated test expectations for ICU 60.Fredrik Roubert2017-12-071-2/+2
| | | | | | | | | | - Blacklist StringTest.test_23831 test until b/69599767 is fixed - Other tests are changed due to changes in CLDR data (version 31 -> 32) Bug: 68208236 Test: CtsLibcoreOjTestCases Test: CtsLibcoreTestCases Change-Id: Ic295f81c6140441876a3cf53b88affcc0001b9cd
* Revert accidental change in test.Joachim Sauer2017-11-201-2/+2
| | | | | | | | | | | | | | | | | | | I accidentally reverted a change in TestFormatter to TestFormatter.java in commit If50d927265136e8de964b54ae879291c7be85cfc. Since the original change was unrelated to DecimalFormat, reverting it was not supposed to happen in that commit. The issue was not caught because CtsLibcoreOjTestCases wasn't run for that test (only CtsLibcoreTestCases). Bug: 69418703 Test: CtsLibcoreOjTestCases (cherry picked from commit 044bd5e685b4bd9302ace9f77b7339cbe7e6f893) Change-Id: I4c1935cc120966035e2891a41791fe563e308db1 Merged-In: If6a2dbb615a70739350cbae91cc33754afe2b793
* Use DecimalFormat_ICU58_Android in DecimalFormat.Joachim Sauer2017-11-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | java.text.DecimalFormat delegates most behaviour to android.icu.text.DecimalFormat. ICU 59 introduced a variety of behaviour changes many of which are not desireable to inherit for java.text.DecimalFormat. This changes java.text.DecimalFormat to delegate to android.icu.text.DecimalFormat_ICU58_Android instead. This class is the ICU 58 implementation of DecimalFormat that ICU ships for testing purposes only. This is a stop-gap measure until we can get the new implementation configured in a way to be close enough to the old behaviour to use in java.text.DecimalFormat. This commit also partially reverts the test that were changed to accomodate the switch to ICU 59 in commit 51f8d749d3100694d695fa0cd32d2fb99c02ba74. The reason the revert is only partial is that not all test changes were caused by code changes. A significant portion was caused by CLDR changes which still affect us, even if we use DecimalFormat_ICU58. Bug: 68143370 Test: CtsLibcoreTestCases Change-Id: If50d927265136e8de964b54ae879291c7be85cfc
* Fix OpenJDK TCK test after 2017c updateNeil Fuller2017-11-071-7/+9
| | | | | | | | | | A 2017c data change for historic transitions broke one of the upstream tests. See also https://bugs.openjdk.java.net/browse/JDK-8190259 Bug: 68878031 Test: run cts -m CtsLibcoreOjTestCases -t tck.java.time.zone.TCKZoneRules Change-Id: I6c15c0a19202d1ad90ec7d05b6e01750e0815849
* Updated test expectations for ICU 59.Fredrik Roubert2017-08-101-2/+2
| | | | | | | Bug: 62410016 Test: CtsLibcoreOjTestCases Test: CtsLibcoreTestCases Change-Id: I49de49cd356f6e28429e4fc22d493f77b5efe4c5
* Clear DateFormat.is24Hour during test.Joachim Sauer2017-07-171-0/+16
| | | | | | | | | | | | | | | | | TCKLocalizedPrinterParser checks if java.time.format.DateTimeFormatter and java.text.DateFormat produce the same output for equivalent input. java.text.DateFormat takes into account DateFormat.is24Hour which represents a user-setting forcing a 12- or 24-hour clock. java.time intentionally doesn't respect that, which causes this test to fail when either a 12h or a 24h clock is forced. This commits clears the setting for the duration of the test and re-sets it to its orginal value afterwards. Test: cts --primary-abi-only -m CtsLibcoreOjTestCases Bug: 62651881 Change-Id: I30bab1d5f04cac8bdfc9a455c8ddc3ff39271077
* Make Android patch docs in ojluni more consistent with style guideTobias Thierer2017-03-0613-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL consists of an automated and a manual part (originally reviewed as separate CLs, then squashed together before submitting in order to minimize the number of times each Android-changed line is touch, since that makes future git archaeology on these simpler). Automated part: Run the following command (performs regex replacements): find ojluni -name \*\.java | xargs sed -i \ -e 's/Android[- ]changed/Android-changed/ig' \ -e 's/Android-changed :/Android-changed:/g' \ -e 's/Android-changed \(BEGIN\|END\)/\1 Android-changed/g' \ -e 's/Android-changed - /Android-changed: /g' \ -e 's/Android[- ]removed/Android-removed/ig' \ -e 's/Android-removed :/Android-removed:/g' \ -e 's/Android-removed \(BEGIN\|END\)/\1 Android-removed/g' \ -e 's/Android-removed - /Android-removed: /g' \ -e 's/Android[- ]added/Android-added/ig' \ -e 's/Android-added :/Android-added:/g' \ -e 's/Android-added \(BEGIN\|END\)/\1 Android-added/g' \ -e 's/Android-added - /Android-added: /g' \ -e 's/----- \(BEGIN\|END\) android\( -----\)\?/\1 Android-changed/g' \ -e 's/\/\* \(BEGIN\|END\) Android-changed \*\//\/\/ \1 Android-changed/g' Manual part: Move BEGIN Android-* lines out of block comments Some Android-{changed,removed,added} lines occurred inside block comments. This CL targets places in ojluni that contained the String "* BEGIN Android-" Changes made by this CL include: - Move the "BEGIN Android-" line into a line comment (the style guide mandates that "Android-" lines are always in line comments). In many cases, that line comment is immediately followed by a block comment holding commented-out upstream code. - Add corresponding "// END Android-" line comments, where missing. - Drop documented import changes altogether. These create noise for little benefit: (1.) Most import problems will be found at compile time (2.) They generally correspond to documented changes elsewhere in the file. - In most cases, the phrasing of comments and the decision whether to keep commented out upstream code was not changed by this CL. - Some additional tweaks were made in line with the style guide. No attempt was made to: - Verify that commented-out upstream code actually matches the current upstream. - Make any fixes (eg. to comments) that would have required git archaeology (looking up historic commits). Bug: 35841464 Test: make droid cts update-api Change-Id: Ibc60979cb6061cfb0e9c7096cc9dcab30ddfa733
* Document Android changes/additions vs. upstream in Calendar.javaTobias Thierer2017-02-152-2/+2
| | | | | | | | | | | | | | | | | - Add missing comments for Android additions/changes - Clarify the extent of changes with existing comments by introducing BEGIN/END lines. - Fix typo in Android-added @hide method name getJapanesImperialInstance() Consideration whether each change is correct or should be upstreamed is not part of this CL. Bug: 35235723 Test: make droid cts Change-Id: I5fa9565162b62c1d4ce51875c7b83a000ef1b289
* Revert "Revert "java.time.Instant.toEpochMilli() fixes""Tobias Thierer2017-02-142-1/+33
| | | | | | | | | | | | | | | | | | | | This reapplies commit ca2b1f0f50392f5a8e91a3d5513ea850ba4e686b. The original commit was reverted. It had broken DateTest because it changed the minimum/maximum Instant that is convertible to Date. Those boundaries are undocumented; the old behavior was more arbitrary and was never launched in Android. Therefore, it's reasonable to just update the test. This CL reapplies the original change and updates DateTest accordingly. Test: DateTest Test: CtsLibcoreTestCases Bug: 31028374 Bug: 35245079 This reverts commit 18db57ad9257a1ba0451fa808294066e8f329287. Change-Id: I8dd24ac6f0d0d5f58d2d0bb51404ba5c8ced2473
* Merge "Revert "java.time.Instant.toEpochMilli() fixes""Calin Juravle2017-02-102-33/+1
|\
| * Revert "java.time.Instant.toEpochMilli() fixes"Tobias Thierer2017-02-102-33/+1
| | | | | | | | | | | | | | | | | | | | Reason: likely that this CL broke libcore.java.util.DateTest Bug: 35245079 This reverts commit ca2b1f0f50392f5a8e91a3d5513ea850ba4e686b. Change-Id: I867b18f3123f45e6fd04bba70c4e44cc8cd402b8
* | Merge "java.time.Instant.toEpochMilli() fixes"Przemyslaw Szczepaniak2017-02-102-1/+33
|\|
| * java.time.Instant.toEpochMilli() fixesPrzemyslaw Szczepaniak2017-02-082-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ported from openjdk8u121 changeset: 11000:2fdb5825ea0a user: igerasim date: Sat Aug 08 03:25:36 2015 +0300 summary: 8133022: Instant.toEpochMilli() silently overflows changeset: 10999:492f4fb4a130 user: igerasim date: Sat Aug 08 03:23:52 2015 +0300 summary: 8074032: Instant.ofEpochMilli(millis).toEpochMilli() can throw arithmetic overflow in toEpochMilli() Test: CtsLibcoreTestCases & CtsLibcoreOjTestCases Bug: 31028374 Change-Id: If2856c62e60e0cf2330f70e23acecdb23475d5aa
* | java.time.chrono.Chronology.isLeapYear fixPrzemyslaw Szczepaniak2017-02-091-0/+18
|/ | | | | | | | | | | | | Ported from openjdk8u121 changeset: 11249:17ed74f96963 user: robm date: Fri Dec 04 18:40:59 2015 +0000 summary: 8067800: Clarify java.time.chrono.Chronology.isLeapYear for out of range years Test: CtsLibcoreTestCases & CtsLibcoreOjTestCases Bug: 31028374 Change-Id: I0f515a82a36af1f6da0186510d2c5ca808f3a41a
* Update java.util.Formatter to 8u60.Joachim Sauer2017-01-301-7/+19
| | | | | | | | | | | | The main change is that it now supports formatting of java.time types. - Adapt relevant test to Android sepcifics. - Add Android-changed comments where appropriate - Removed unused mantissa() and exponent() methods Bug: 28832222 Test: run cts -m CtsLibcoreOjTestCases Change-Id: I8a5de3f4bd39b6bad09850d4e5329a54331a2315
* Make Chronology/ServiceLoader tests pass.Joachim Sauer2017-01-301-1/+4
| | | | | | | | | | | | Add necessary resources to CTS target for Chronology tests. Also modify TestServiceLoader to avoid the assumption that the system classloader will always see test resources (does not hold true in CTS). Bug: 28832222 Test: run cts -m LibcoreOj -t test.java.time.chrono.TestServiceLoader Test: run cts -m LibcoreOj -t tck.java.time.chrono.TCKTestServiceLoader Change-Id: I831d71d12a47107ef0011a7e171da7639eb34184
* Use BeforeClass instead of BeforeMethod.Joachim Sauer2017-01-307-35/+58
| | | | | | | | | | | | | | | | | Several java.time tests use @BeforeMethod to populate a field that is used as in @DataProvider methods. @BeforeMethod runs after @DataProvider is executed, 'though. The only reason this worked is because the first test that's run in those tests doesn't use the @DataProvider, so by the time it's executed, the field will already have been populated. Change the field initialization to use @BeforeClass and change the affected fields to static. Test: CtsLibcoreOjTestCases Bug: 28832222 Change-Id: I499dde830a456dced8375632c45801640f795e33
* Modify TestZoneTextPrinterParser.Joachim Sauer2017-01-301-8/+31
| | | | | | | | | | | | | | | | | | | | - disable test_ParseText() as it doesn't assert anything and produces a lot of unnecessary output - only run one iteration of test_printText(), as the test takes a very long time to run and has not revealed any problems in any iterations other than the first. - skip non-canonical time zone ids, as they have errors in TimeZone.getDisplayName(): http://b/33197219 - skip locales "ji", as it doesn't seem to correctly load timezone names in TimeZone.getDisplayName(), possibly due to http://b/8634320 - TimeZone.getDisplayName() will never return strings starting with "GMT", so accept "GMT+00:00" as equivalent. - modify order of iteration to iterate over locales before timezones, as the original order was significantly slower on Android. Bug: 28832222 Test: ran test.java.time.format.TestZoneTextPrinterParser Change-Id: I658ab09ba6da5f1a9647bc81614410ba30199b2f
* Modify test assumptions.Joachim Sauer2017-01-308-100/+119
| | | | | | | | | | | | | | | | | | | | | | | | | Modify test assumptions that are not true on Android, for several reasons: - java.time RI uses non-CLDR data sources by default which has slightly different data, whereas Android basically uses CLDR for almost everything. - Arabic locale actually uses arabic digits - Portuguese month names are not capitalized in CLDR - Russian month names are not capitalized in CLDR and use a full stop after abbreviations - java.time RI uses an older CLDR version, so many data points such as format patterns have seen significant changes in the one we use (currently CLDR 31). - field names use lower case for locale en in CLDR - change Locale in TCKFormatStyle because en_US doesn't use "CEST" as an abbreviation for european time zones in CLDR, but en_GB does. - TCK ZoneRule assumes an optimization that our data source doesn't contain and are not necessary for correct operation. Bug: 28832222 Test: artrun testng-time.xml Change-Id: I42edefb052c9c2f007f971abe70740feb92a3a17
* Fix various test failures.Joachim Sauer2017-01-244-8/+6
| | | | | | | | | | | | - move chronology service registration file to directory that's actually used for tests. - Update expected calendar names to current CLDR data in TCKChronology - Disable test that depends on Calendar supporting buddhist calendar - delete unneeded TEST.properties Bug: 28832222 Test: artrun testng-time.xml Change-Id: I294e2dbce88495cbc6c792bb76caecdb5fffe4ff
* Fix Japanese Chronology.Joachim Sauer2017-01-241-3/+2
| | | | | | | | | | | | | | | | | | | | | | The JapaneseChronology class depends on the ImperialJapaneseCalendar being returned by Calendard.getInstance(). Since Android always returns a GregorianCalendar from that class, the tests will fail. This fixes the problem by importing the JapaneseImperialCalendar class from the OpenJDK (with minor tweaks to remove mentions of the ZoneInfo class) and adapting the relevant classes to use a new explicit method on Calendar to request such a calendar instance. Also apply update LocaleGregorianCalendar to jdk8u60 which fixes an off-by-one error in calculations related to eras. Added ChronologyDisplayNameTest to ensure future Chronologies return sane values for their display name and their eras display names. Bug: 28832222 Test: artrun testng-time.xml Test: run cts -m CtsLibcoreTestCases Change-Id: I3eb5d4509ad03ee3d736c7926c605f378b56d0b2
* Change time zone tests to respect Android changes.Joachim Sauer2017-01-242-19/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a difference in how java.time on the OpenJDK treats time zone names and how Android as a whole treats them, specifically when it comes to the short names (abbreviations) of zones. Android uses the CLDR data exclusively. CLDR only includes time zone abbreviations in a given locale when that abbreviation is widely used in that locale (for example: "CST" is "Central Standard Time" in en_US). Other abbreviations that are arguably correct, but are not widely known or used are not included in the data, such as "CST" for "Chinese Standard Time". This means that there are rarely conflicts in the abbreviations and no resolution mechanism is needed (and in fact ICU doesn't provide one). java.time in the OpenJDK (as well as other time zone name handling methods) has abbreviations for almost every zone, even when the zones are rarely used. This of course leads to many conflicts (such as CST for Central Standard Time and Chinese Standard Time). This port of java.time will stay consistent with how Android as a whole handles time zone names and will use the ICU/CLDR data. This means that many tests that expect specific results will fail. Bug: 28832222 Test: compiles, fewer tests fail Change-Id: Ic23c2795a440d61d97db8c4c44cfd35a053c0105
* Initial import of java.time.Joachim Sauer2017-01-12171-0/+66708
This is a verbatim copy of the classes in java.time from the jdk8u60 branch of the OpenJDK. They are not yet part of the build and wouldn't compile yet (no local modifications whatsoever). Bug: 28832222 Test: Not build, not tested. Change-Id: I8bb148cb1095b08af895c4abffed9f22b107c218