@@ -5,61 +5,9 @@ module IOTests
55using Test
66using Dates
77
8- @testset " string/show representation of Period" begin
9- @test string (Dates. Year (2018 )) == " 2018 years"
10- @test sprint (show, Dates. Year (2018 )) == " Dates.Year(2018)"
11- @test sprint (print, Dates. Year (2018 )) == " 2018 years"
12- @test repr (Dates. Year (2018 )) == " Dates.Year(2018)"
13-
14- @test string (Dates. Month (12 )) == " 12 months"
15- @test sprint (show, Dates. Month (12 )) == " Dates.Month(12)"
16- @test sprint (print, Dates. Month (12 )) == " 12 months"
17- @test repr (Dates. Month (12 )) == " Dates.Month(12)"
18-
19- @test string (Dates. Week (4 )) == " 4 weeks"
20- @test sprint (show, Dates. Week (4 )) == " Dates.Week(4)"
21- @test sprint (print, Dates. Week (4 )) == " 4 weeks"
22- @test repr (Dates. Week (4 )) == " Dates.Week(4)"
23-
24- @test string (Dates. Day (12 )) == " 12 days"
25- @test sprint (show, Dates. Day (12 )) == " Dates.Day(12)"
26- @test sprint (print,Dates. Day (12 )) == " 12 days"
27- @test repr (Dates. Day (12 )) == " Dates.Day(12)"
28-
29- @test string (Dates. Hour (12 )) == " 12 hours"
30- @test sprint (show, Dates. Hour (12 )) == " Dates.Hour(12)"
31- @test sprint (print,Dates. Hour (12 )) == " 12 hours"
32- @test repr (Dates. Hour (12 )) == " Dates.Hour(12)"
33-
34- @test string (Dates. Minute (12 )) == " 12 minutes"
35- @test sprint (show, Dates. Minute (12 )) == " Dates.Minute(12)"
36- @test sprint (print,Dates. Minute (12 )) == " 12 minutes"
37- @test repr (Dates. Minute (12 )) == " Dates.Minute(12)"
38-
39- @test string (Dates. Second (12 )) == " 12 seconds"
40- @test sprint (show, Dates. Second (12 )) == " Dates.Second(12)"
41- @test sprint (print,Dates. Second (12 )) == " 12 seconds"
42- @test repr (Dates. Second (12 )) == " Dates.Second(12)"
43-
44- @test string (Dates. Millisecond (12 )) == " 12 milliseconds"
45- @test sprint (show, Dates. Millisecond (12 )) == " Dates.Millisecond(12)"
46- @test sprint (print,Dates. Millisecond (12 )) == " 12 milliseconds"
47- @test repr (Dates. Millisecond (12 )) == " Dates.Millisecond(12)"
48-
49- @test string (Dates. Microsecond (12 )) == " 12 microseconds"
50- @test sprint (show, Dates. Microsecond (12 )) == " Dates.Microsecond(12)"
51- @test sprint (print,Dates. Microsecond (12 )) == " 12 microseconds"
52- @test repr (Dates. Microsecond (12 )) == " Dates.Microsecond(12)"
53-
54- @test string (Dates. Nanosecond (12 )) == " 12 nanoseconds"
55- @test sprint (show, Dates. Nanosecond (12 )) == " Dates.Nanosecond(12)"
56- @test sprint (print,Dates. Nanosecond (12 )) == " 12 nanoseconds"
57- @test repr (Dates. Nanosecond (12 )) == " Dates.Nanosecond(12)"
58- end
59-
608@testset " string/show representation of Date" begin
619 @test string (Dates. Date (1 , 1 , 1 )) == " 0001-01-01" # January 1st, 1 AD/CE
62- @test sprint (show, Dates. Date (1 , 1 , 1 )) == " Dates. Date(1, 1, 1)"
10+ @test sprint (show, Dates. Date (1 , 1 , 1 )) == " Date(1, 1, 1)"
6311 @test string (Dates. Date (0 , 12 , 31 )) == " 0000-12-31" # December 31, 1 BC/BCE
6412 @test Dates. Date (1 , 1 , 1 ) - Dates. Date (0 , 12 , 31 ) == Dates. Day (1 )
6513 @test Dates. Date (Dates. UTD (- 306 )) == Dates. Date (0 , 2 , 29 )
6816 @test string (Dates. Date (- 1000000 , 1 , 1 )) == " -1000000-01-01"
6917 @test string (Dates. Date (1000000 , 1 , 1 )) == " 1000000-01-01"
7018 @test string (Dates. DateTime (2000 , 1 , 1 , 0 , 0 , 0 , 1 )) == " 2000-01-01T00:00:00.001"
71- @test sprint (show, Dates. DateTime (2000 , 1 , 1 , 0 , 0 , 0 , 1 )) == " Dates. DateTime(2000, 1, 1, 0, 0, 0, 1)"
19+ @test sprint (show, Dates. DateTime (2000 , 1 , 1 , 0 , 0 , 0 , 1 )) == " DateTime(2000, 1, 1, 0, 0, 0, 1)"
7220 @test string (Dates. DateTime (2000 , 1 , 1 , 0 , 0 , 0 , 2 )) == " 2000-01-01T00:00:00.002"
7321 @test string (Dates. DateTime (2000 , 1 , 1 , 0 , 0 , 0 , 500 )) == " 2000-01-01T00:00:00.5"
7422 @test string (Dates. DateTime (2000 , 1 , 1 , 0 , 0 , 0 , 998 )) == " 2000-01-01T00:00:00.998"
0 commit comments