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

context: cleanup the tests and the documentation (#12175)

This commit is contained in:
Ulises Jeremias Cornejo Fandos
2021-10-14 07:32:42 -03:00
committed by GitHub
parent 4c2cb1b6df
commit 4490d5ed29
5 changed files with 113 additions and 112 deletions

View File

@@ -11,8 +11,7 @@ const (
fn test_with_deadline() {
dur := time.now().add(short_duration)
mut background := context.background()
mut b := &background
mut ctx, cancel := context.with_deadline(mut b, dur)
mut ctx, cancel := context.with_deadline(mut &background, dur)
defer {
// Even though ctx will be expired, it is good practice to call its
@@ -36,8 +35,7 @@ fn test_with_timeout() {
// Pass a context with a timeout to tell a blocking function that it
// should abandon its work after the timeout elapses.
mut background := context.background()
mut b := &background
mut ctx, cancel := context.with_timeout(mut b, short_duration)
mut ctx, cancel := context.with_timeout(mut &background, short_duration)
defer {
cancel()
}