1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: smarter if condition wrapping (#8201)

This commit is contained in:
Lukas Neubert
2021-01-23 09:33:22 +01:00
committed by GitHub
parent 9812230847
commit 8b61891348
65 changed files with 686 additions and 811 deletions

View File

@@ -6,8 +6,8 @@ fn test_parse() {
assert false
return
}
assert t.year == 2018 &&
t.month == 1 && t.day == 27 && t.hour == 12 && t.minute == 48 && t.second == 34
assert t.year == 2018 && t.month == 1 && t.day == 27 && t.hour == 12 && t.minute == 48
&& t.second == 34
assert t.unix == 1517057314
}
@@ -26,16 +26,16 @@ fn test_parse_rfc2822() {
assert false
return
}
assert t1.year == 2019 &&
t1.month == 12 && t1.day == 12 && t1.hour == 6 && t1.minute == 7 && t1.second == 45
assert t1.year == 2019 && t1.month == 12 && t1.day == 12 && t1.hour == 6 && t1.minute == 7
&& t1.second == 45
assert t1.unix == 1576130865
s2 := 'Thu 12 Dec 2019 06:07:45 +0800'
t2 := time.parse_rfc2822(s2) or {
assert false
return
}
assert t2.year == 2019 &&
t2.month == 12 && t2.day == 12 && t2.hour == 6 && t2.minute == 7 && t2.second == 45
assert t2.year == 2019 && t2.month == 12 && t2.day == 12 && t2.hour == 6 && t2.minute == 7
&& t2.second == 45
assert t2.unix == 1576130865
}

View File

@@ -87,14 +87,12 @@ fn test_format_ss() {
}
fn test_format_ss_milli() {
assert '11.07.1980 21:23:42.123' ==
time_to_test.get_fmt_str(.dot, .hhmmss24_milli, .ddmmyyyy)
assert '11.07.1980 21:23:42.123' == time_to_test.get_fmt_str(.dot, .hhmmss24_milli, .ddmmyyyy)
assert '1980-07-11 21:23:42.123' == time_to_test.format_ss_milli()
}
fn test_format_ss_micro() {
assert '11.07.1980 21:23:42.123456' ==
time_to_test.get_fmt_str(.dot, .hhmmss24_micro, .ddmmyyyy)
assert '11.07.1980 21:23:42.123456' == time_to_test.get_fmt_str(.dot, .hhmmss24_micro, .ddmmyyyy)
assert '1980-07-11 21:23:42.123456' == time_to_test.format_ss_micro()
}