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

fmt: remove space in front of ? and ! (#14366)

This commit is contained in:
Daniel Däschle
2022-05-13 05:56:21 +02:00
committed by GitHub
parent df029da942
commit d679146a80
324 changed files with 1865 additions and 1879 deletions

View File

@@ -23,7 +23,7 @@ pub fn parse_rfc3339(s string) ?Time {
// Check if sn is date only
if !parts[0].contains_any(' Z') && parts[0].contains('-') {
year, month, day := parse_iso8601_date(sn) ?
year, month, day := parse_iso8601_date(sn)?
t = new_time(Time{
year: year
month: month
@@ -34,7 +34,7 @@ pub fn parse_rfc3339(s string) ?Time {
// Check if sn is time only
if !parts[0].contains('-') && parts[0].contains(':') {
mut hour_, mut minute_, mut second_, mut microsecond_, mut unix_offset, mut is_local_time := 0, 0, 0, 0, i64(0), true
hour_, minute_, second_, microsecond_, unix_offset, is_local_time = parse_iso8601_time(parts[0]) ?
hour_, minute_, second_, microsecond_, unix_offset, is_local_time = parse_iso8601_time(parts[0])?
t = new_time(Time{
hour: hour_
minute: minute_
@@ -124,10 +124,10 @@ pub fn parse_iso8601(s string) ?Time {
if !(parts.len == 1 || parts.len == 2) {
return error_invalid_time(12)
}
year, month, day := parse_iso8601_date(parts[0]) ?
year, month, day := parse_iso8601_date(parts[0])?
mut hour_, mut minute_, mut second_, mut microsecond_, mut unix_offset, mut is_local_time := 0, 0, 0, 0, i64(0), true
if parts.len == 2 {
hour_, minute_, second_, microsecond_, unix_offset, is_local_time = parse_iso8601_time(parts[1]) ?
hour_, minute_, second_, microsecond_, unix_offset, is_local_time = parse_iso8601_time(parts[1])?
}
mut t := new_time(
year: year

View File

@@ -1,7 +1,7 @@
import time
fn test_add_to_day_in_the_previous_century() ? {
a := time.parse_iso8601('1900-01-01') ?
a := time.parse_iso8601('1900-01-01')?
aa := a.add_days(180)
dump(a.debug())
dump(aa.debug())
@@ -9,25 +9,25 @@ fn test_add_to_day_in_the_previous_century() ? {
}
fn test_add_to_day_in_the_past() ? {
a := time.parse_iso8601('1990-03-01') ?
a := time.parse_iso8601('1990-03-01')?
aa := a.add_days(180)
assert aa.ymmdd() == '1990-08-27'
}
fn test_add_to_day_in_the_recent_past() ? {
a := time.parse_iso8601('2021-03-01') ?
a := time.parse_iso8601('2021-03-01')?
aa := a.add_days(180)
assert aa.ymmdd() == '2021-08-28'
}
fn test_add_to_day_in_the_future_1() ? {
a := time.parse_iso8601('3000-11-01') ?
a := time.parse_iso8601('3000-11-01')?
aa := a.add_days(180)
assert aa.ymmdd() == '3001-04-30'
}
fn test_add_to_day_in_the_future_2() ? {
a := time.parse_iso8601('3000-12-30') ?
a := time.parse_iso8601('3000-12-30')?
aa := a.add_days(180)
assert aa.ymmdd() == '3001-06-28'
}