Skip to content

Commit

Permalink
use defer to restore TZ after tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kimshrier committed Nov 16, 2024
1 parent a95985f commit 8d735f5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions vlib/x/encoding/asn1/time_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ fn test_create_utctime_from_std_time_with_negative_offset() ! {
tz := os.getenv('TZ')
os.setenv('TZ', 'utc 1', true)

defer {
os.setenv('TZ', tz, true)
}

now := time.new(year: 2024, month: 11, day: 13, hour: 17, minute: 45, second: 50)
UtcTime.from_time(now)!

os.setenv('TZ', tz, true)
}

fn test_serialize_utctime_error_without_z() ! {
Expand Down Expand Up @@ -131,8 +133,10 @@ fn test_create_generalizedtime_from_std_time_with_negative_offset() ! {
tz := os.getenv('TZ')
os.setenv('TZ', 'utc 1', true)

defer {
os.setenv('TZ', tz, true)
}

now := time.new(year: 2024, month: 11, day: 13, hour: 17, minute: 45, second: 50)
GeneralizedTime.from_time(now)!

os.setenv('TZ', tz, true)
}

0 comments on commit 8d735f5

Please sign in to comment.