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

tests: fix some tests, that failed due to the stricter immutable checks

This commit is contained in:
Delyan Angelov 2020-06-01 18:24:38 +03:00
parent 86862d6a94
commit ae8f7cf569
11 changed files with 14 additions and 14 deletions

View File

@ -7,6 +7,7 @@ module csv
import strings
struct Writer {
mut:
sb strings.Builder
pub mut:
use_crlf bool

View File

@ -28,7 +28,6 @@ pub struct EventBus {
pub mut:
registry &Registry
publisher &Publisher
pub:
subscriber &Subscriber
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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--

View File

@ -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++

View File

@ -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

View File

@ -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

View File

@ -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{

View File

@ -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
}