-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No longer make Month and DayOfWeek type aliases on the JVM
Fixes #96
- Loading branch information
1 parent
02e4e4d
commit 52dac5a
Showing
12 changed files
with
115 additions
and
57 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2019-2024 JetBrains s.r.o. and contributors. | ||
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file. | ||
*/ | ||
|
||
package kotlinx.datetime.test | ||
|
||
import kotlinx.datetime.* | ||
import kotlin.test.* | ||
|
||
class DayOfWeekTest { | ||
@Test | ||
fun testExhaustiveWhenDayOfWeek() { | ||
for (dayOfWeek in DayOfWeek.entries) { | ||
when (dayOfWeek) { | ||
DayOfWeek.MONDAY -> assertEquals(1, dayOfWeek.isoDayNumber) | ||
DayOfWeek.TUESDAY -> assertEquals(2, dayOfWeek.isoDayNumber) | ||
DayOfWeek.WEDNESDAY -> assertEquals(3, dayOfWeek.isoDayNumber) | ||
DayOfWeek.THURSDAY -> assertEquals(4, dayOfWeek.isoDayNumber) | ||
DayOfWeek.FRIDAY -> assertEquals(5, dayOfWeek.isoDayNumber) | ||
DayOfWeek.SATURDAY -> assertEquals(6, dayOfWeek.isoDayNumber) | ||
DayOfWeek.SUNDAY -> assertEquals(7, dayOfWeek.isoDayNumber) | ||
} | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2019-2024 JetBrains s.r.o. and contributors. | ||
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file. | ||
*/ | ||
|
||
package kotlinx.datetime.test | ||
|
||
import kotlinx.datetime.* | ||
import kotlin.test.* | ||
|
||
class MonthTest { | ||
@Test | ||
fun testExhaustiveWhen() { | ||
for (month in Month.entries) { | ||
when (month) { | ||
Month.JANUARY -> assertEquals(1, month.number) | ||
Month.FEBRUARY -> assertEquals(2, month.number) | ||
Month.MARCH -> assertEquals(3, month.number) | ||
Month.APRIL -> assertEquals(4, month.number) | ||
Month.MAY -> assertEquals(5, month.number) | ||
Month.JUNE -> assertEquals(6, month.number) | ||
Month.JULY -> assertEquals(7, month.number) | ||
Month.AUGUST -> assertEquals(8, month.number) | ||
Month.SEPTEMBER -> assertEquals(9, month.number) | ||
Month.OCTOBER -> assertEquals(10, month.number) | ||
Month.NOVEMBER -> assertEquals(11, month.number) | ||
Month.DECEMBER -> assertEquals(12, month.number) | ||
} | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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