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

time: move time.random() to time.misc module

avoids importing rand to programs that do not need pseudo random generation).
This commit is contained in:
Delyan Angelov
2020-01-07 13:58:24 +02:00
committed by Alexander Medvednikov
parent a0c8ad7398
commit 6d30697d9b
4 changed files with 62 additions and 50 deletions

View File

@ -1,21 +1,18 @@
/*
// TODO: Fix this.
import time
import time.misc as tmisc
// using a manual temporary intermediate variable should always work:
fn test_call_fn_that_requires_reference_with_function_that_returns_a_struct_manual(){
t1 := time.random()
fn test_call_fn_that_requires_reference_with_function_that_returns_a_struct_manual() {
t1 := tmisc.random()
t2 := t1.calc_unix()
println('tmp: $t2')
println('res: $t2')
assert true
}
/*
// TODO: Fix this.
// v should produce temporary intermediate variables in chained calls:
fn test_call_fn_that_requires_reference_with_function_that_returns_a_struct_chained(){
res := (time.random().calc_unix())
res := (tmisc.random().calc_unix())
println('res: $res')
assert true
}
*/
fn test_dummy(){}