tests: fix some tests, that failed due to the stricter immutable checks
parent
86862d6a94
commit
ae8f7cf569
|
@ -7,6 +7,7 @@ module csv
|
|||
import strings
|
||||
|
||||
struct Writer {
|
||||
mut:
|
||||
sb strings.Builder
|
||||
pub mut:
|
||||
use_crlf bool
|
||||
|
|
|
@ -28,7 +28,6 @@ pub struct EventBus {
|
|||
pub mut:
|
||||
registry &Registry
|
||||
publisher &Publisher
|
||||
pub:
|
||||
subscriber &Subscriber
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@ pub struct Client {
|
|||
retry int
|
||||
eb &eventbus.EventBus
|
||||
is_ssl bool
|
||||
lock &sync.Mutex = sync.new_mutex()
|
||||
write_lock &sync.Mutex = sync.new_mutex()
|
||||
// subprotocol_len int
|
||||
// cwebsocket_subprotocol *subprotocol;
|
||||
// cwebsocket_subprotocol *subprotocols[];
|
||||
mut:
|
||||
lock &sync.Mutex = sync.new_mutex()
|
||||
write_lock &sync.Mutex = sync.new_mutex()
|
||||
state State
|
||||
socket net.Socket
|
||||
flags []Flag
|
||||
|
|
|
@ -4,7 +4,7 @@ import time
|
|||
// time than you have specified. To avoid false positives from CI test
|
||||
// failures, some of the asserts will be run only if you pass `-d stopwatch`
|
||||
fn test_stopwatch_works_as_intended() {
|
||||
sw := time.new_stopwatch({})
|
||||
mut sw := time.new_stopwatch({})
|
||||
// sample code that you want to measure:
|
||||
println('Hello world')
|
||||
time.sleep_ms(1)
|
||||
|
@ -15,7 +15,7 @@ fn test_stopwatch_works_as_intended() {
|
|||
|
||||
fn test_stopwatch_time_between_pause_and_start_should_be_skipped_in_elapsed() {
|
||||
println('Testing pause function')
|
||||
sw := time.new_stopwatch({})
|
||||
mut sw := time.new_stopwatch({})
|
||||
time.sleep_ms(10) // A
|
||||
eprintln('Elapsed after 10ms nap: ${sw.elapsed().milliseconds()}ms')
|
||||
assert sw.elapsed().milliseconds() >= 10
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vlib/v/checker/tests/const_field_add_err.v:6:2: error: cannot assign to constant `a`
|
||||
vlib/v/checker/tests/const_field_add_err.v:6:2: error: cannot modify constant `a`
|
||||
4 |
|
||||
5 | fn main() {
|
||||
6 | a += 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vlib/v/checker/tests/const_field_dec_err.v:6:2: error: cannot assign to constant `a`
|
||||
vlib/v/checker/tests/const_field_dec_err.v:6:2: error: cannot modify constant `a`
|
||||
4 |
|
||||
5 | fn main() {
|
||||
6 | a--
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vlib/v/checker/tests/const_field_inc_err.v:6:2: error: cannot assign to constant `a`
|
||||
vlib/v/checker/tests/const_field_inc_err.v:6:2: error: cannot modify constant `a`
|
||||
4 |
|
||||
5 | fn main() {
|
||||
6 | a++
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vlib/v/checker/tests/const_field_sub_err.v:6:2: error: cannot assign to constant `a`
|
||||
vlib/v/checker/tests/const_field_sub_err.v:6:2: error: cannot modify constant `a`
|
||||
4 |
|
||||
5 | fn main() {
|
||||
6 | a -= 1
|
||||
|
|
|
@ -16,10 +16,10 @@ const (
|
|||
|
||||
pub struct Fmt {
|
||||
pub:
|
||||
out strings.Builder
|
||||
out_imports strings.Builder
|
||||
table &table.Table
|
||||
pub mut:
|
||||
out_imports strings.Builder
|
||||
out strings.Builder
|
||||
indent int
|
||||
empty_line bool
|
||||
line_len int
|
||||
|
|
|
@ -89,7 +89,7 @@ fn test_scan() {
|
|||
assert t == 2
|
||||
})
|
||||
|
||||
tfn := TestFn{}
|
||||
mut tfn := TestFn{}
|
||||
tfn.tst_1()
|
||||
tfn.tst_2(fn(i int){
|
||||
t := i + 1
|
||||
|
@ -102,7 +102,7 @@ fn test_scan() {
|
|||
// Test @STRUCT
|
||||
assert @STRUCT == ''
|
||||
|
||||
ts := TestStruct { test: "test" }
|
||||
mut ts := TestStruct { test: "test" }
|
||||
ts.test_struct()
|
||||
r1 := ts.test_struct_w_return()
|
||||
r2 := ts.test_struct_w_high_order(fn(i int)string{
|
||||
|
|
|
@ -46,7 +46,7 @@ import os
|
|||
import live
|
||||
|
||||
fn append_to_file(fname, s string) {
|
||||
f := os.open_append(fname) or {
|
||||
mut f := os.open_append(fname) or {
|
||||
println('>>>> could not open file \$fname for appending, err: \$err ')
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue