mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tests: fix keep tests with spawn
This commit is contained in:
parent
9f2ab9aad6
commit
02acb8433c
@ -1,6 +1,9 @@
|
||||
## V 0.3.3
|
||||
-*Not yet released*
|
||||
- vfmt now supports `// vfmt off` and `// vfmt on` for turning off the formatting locally for *short* snippets of code. Useful for keeping your carefully arranged matrices in tact.
|
||||
*Not yet released*
|
||||
- `go foo()` has been replaced with `spawn foo()` (launches an OS thread, `go` will be used for
|
||||
upcoming coroutines instead).
|
||||
- vfmt now supports `// vfmt off` and `// vfmt on` for turning off the formatting locally for *short* snippets of code. Useful for keeping your carefully arranged matrices in tact.
|
||||
|
||||
## V 0.3.2
|
||||
*31 Oct 2022*
|
||||
- New simplified string interpolation: `println("Hello, {name}!")`. It will be the only way, old syntax (`${name}` and `$name`)
|
||||
|
@ -39,7 +39,7 @@ fn do_rec_calc_send(chs []chan i64, sem sync.Semaphore) {
|
||||
fn test_channel_array_mut() {
|
||||
mut chs := [chan i64{}, chan i64{cap: 10}]
|
||||
sem := sync.new_semaphore()
|
||||
go do_rec_calc_send(chs, sem)
|
||||
spawn do_rec_calc_send(chs, sem)
|
||||
mut t := i64(100)
|
||||
for _ in 0 .. num_iterations {
|
||||
chs[0] <- t
|
||||
@ -57,7 +57,7 @@ fn test_channel_array_mut() {
|
||||
sem.wait()
|
||||
assert t == 100 + num_iterations
|
||||
ch2 := chan mut St{cap: 10}
|
||||
go g(ch2)
|
||||
spawn g(ch2)
|
||||
}
|
||||
|
||||
fn g(ch chan mut St) {
|
||||
|
@ -24,7 +24,7 @@ fn do_send_2(ch chan int, val int) ?int {
|
||||
|
||||
fn main() {
|
||||
ch := chan int{}
|
||||
go f(ch)
|
||||
spawn f(ch)
|
||||
mut s := 1
|
||||
for {
|
||||
s = do_send(ch, s) or { break }
|
||||
|
@ -2,7 +2,7 @@ import sync
|
||||
|
||||
fn go_with_anon_fn() {
|
||||
wg.add(1)
|
||||
go fn (mut wg sync.WaitGroup) {
|
||||
spawn fn (mut wg sync.WaitGroup) {
|
||||
wg.done()
|
||||
}(mut wg)
|
||||
wg.wait()
|
||||
|
@ -82,7 +82,7 @@ fn test_select_blocks() {
|
||||
}
|
||||
assert r == true
|
||||
assert t == true
|
||||
go f2(ch2, ch3, sem)
|
||||
spawn f2(ch2, ch3, sem)
|
||||
n := <-ch3
|
||||
assert n == 23
|
||||
ch2 <- St{
|
||||
@ -90,7 +90,7 @@ fn test_select_blocks() {
|
||||
}
|
||||
sem.wait()
|
||||
stopwatch := time.new_stopwatch()
|
||||
go f1(ch1, ch2, ch3, ch4, ch5, sem)
|
||||
spawn f1(ch1, ch2, ch3, ch4, ch5, sem)
|
||||
sem.wait()
|
||||
elapsed_ms := f64(stopwatch.elapsed()) / time.millisecond
|
||||
assert elapsed_ms >= 295.0
|
||||
|
Loading…
Reference in New Issue
Block a user