• R/O
  • SSH

kink: Commit

Kink runtime


Commit MetaInfo

Revision8f900b5d1e0ab0354ee4de61ebef3c112a97fcd4 (tree)
Time2020-11-22 10:23:58
Authormiyakawataku
Commitermiyakawataku

Log Message

add Odt.show

Change Summary

Incremental Difference

diff -r cfa0ccf79f5e -r 8f900b5d1e0a src/main/resources/kink-mods/kink/datetime/OFFSET_DATETIME.kn
--- a/src/main/resources/kink-mods/kink/datetime/OFFSET_DATETIME.kn Thu Nov 05 18:04:11 2020 +0900
+++ b/src/main/resources/kink-mods/kink/datetime/OFFSET_DATETIME.kn Sun Nov 22 10:23:58 2020 +0900
@@ -166,6 +166,20 @@
166166 INSTANT._new_instant(Java_ins)
167167 }
168168
169+ 'show' {[:Odt](:Config_fun.opt)
170+ '{%04d}-{%02d}-{%02d}T{%02d}:{%02d}:{%02d}{}{%02d}:{%02d}'.format(
171+ Odt.year
172+ Odt.month
173+ Odt.day
174+ Odt.hour
175+ Odt.minute
176+ Odt.second
177+ Odt.offset.sign
178+ Odt.offset.hour
179+ Odt.offset.minute
180+ )
181+ }
182+
169183 ## Odt1 == Odt2, Odt1 != Odt2
170184 #
171185 # offset_datetime values Odt1 and Odt2 are equal when:
diff -r cfa0ccf79f5e -r 8f900b5d1e0a src/test/kink/datetime/OFFSET_DATETIME_test.kn
--- a/src/test/kink/datetime/OFFSET_DATETIME_test.kn Thu Nov 05 18:04:11 2020 +0900
+++ b/src/test/kink/datetime/OFFSET_DATETIME_test.kn Sun Nov 22 10:23:58 2020 +0900
@@ -7,7 +7,7 @@
77 :TIMEZONE.require_from('kink/datetime/')
88 :TEST.require_from('kink/test/')
99
10-TEST.group('offset_datetime'){ # {{{1
10+TEST.group('offset_datetime'){ # {{{
1111 TEST.test('.year'){
1212 :Odt = OFFSET_DATETIME.new(2020 1 12 15 20 56.123456789 OFFSET.new(9 * 60))
1313 :Result = Odt.year
@@ -78,6 +78,22 @@
7878 Result == INSTANT.new(1578810056.123456789) || raise('got {}'.format(Result.repr))
7979 }
8080
81+ TEST.group('.show'){ # {{{
82+
83+ TEST.test('without config'){
84+ :Odt = OFFSET_DATETIME.new(2020 1 12 15 20 56.123456789 OFFSET.new(7 * 60 + 30))
85+ :Result = Odt.show
86+ Result == '2020-01-12T15:20:56.123456789+07:30' || raise('got {}'.format(Result.repr))
87+ }
88+
89+ TEST.test('with empty config'){
90+ :Odt = OFFSET_DATETIME.new(2020 1 12 15 20 56.123456789 OFFSET.new(7 * 60 + 30))
91+ :Result = Odt.show{}
92+ Result == '2020-01-12T15:20:56.123456789+07:30' || raise('got {}'.format(Result.repr))
93+ }
94+
95+ } # }}}
96+
8197 TEST.test('.repr'){
8298 :Odt = OFFSET_DATETIME.new(2020 1 12 15 20 56.123456789 OFFSET.new(9 * 60 + 30))
8399 :Result = Odt.repr
@@ -112,9 +128,7 @@
112128 }
113129 }
114130 }
115-}
116-
117-# }}}1
131+} # }}}
118132
119133 TEST.group('OFFSET_DATETIME.new'){ # {{{1
120134 TEST.test('min date time'){
Show on old repository browser