From 19f080ffb8f8f01976692f6b79d9f857c685e109 Mon Sep 17 00:00:00 2001 From: yuyi Date: Fri, 9 Aug 2024 19:55:58 +0800 Subject: [PATCH] all: change single blank comment to blank line (#22016) --- cmd/tools/modules/testing/common.v | 4 +-- cmd/tools/modules/testing/output.v | 6 ++--- cmd/tools/modules/vgit/vgit.v | 2 +- cmd/tools/vast/vast.v | 2 +- cmd/tools/vcover/data.v | 2 +- cmd/tools/vcover/main.v | 4 +-- cmd/tools/vtest-parser.v | 2 +- cmd/tools/vup.v | 2 +- examples/gg/mandelbrot.v | 2 +- examples/term.ui/pong.v | 6 ++--- vlib/arrays/arrays_test.v | 8 +++--- vlib/benchmark/benchmark_test.v | 4 +-- vlib/builtin/array_test.v | 2 +- vlib/builtin/builtin.v | 8 +++--- vlib/builtin/float_test.v | 13 +++++----- vlib/builtin/js/array_test.js.v | 2 +- vlib/builtin/lambda_expr_array_test.v | 4 +-- vlib/builtin/rune_test.v | 10 +++---- vlib/builtin/string_int_test.v | 5 ---- vlib/builtin/string_match_glob_test.v | 14 +++++----- vlib/builtin/string_test.v | 3 +-- vlib/crypto/internal/subtle/comparison_test.v | 2 +- vlib/encoding/base64/base64_memory_test.v | 2 +- vlib/gg/gg.c.v | 12 ++++----- vlib/gg/gg.js.v | 8 +++--- vlib/gg/image.v | 2 +- vlib/gx/color.v | 2 +- vlib/gx/color_test.v | 4 +-- vlib/hash/fnv1a/fnv1a_test.v | 4 +-- vlib/io/custom_string_reading_test.v | 2 +- vlib/json/cjson/cjson_wrapper.c.v | 4 +-- vlib/maps/maps_test.v | 4 +-- vlib/math/math_test.v | 6 ++--- vlib/net/http/file/static_server.v | 2 +- vlib/net/http/http.v | 4 +-- vlib/net/http/request.v | 4 +-- vlib/net/http/server.v | 4 +-- vlib/net/http/server_test.v | 8 +++--- .../tcp_self_dial_from_many_clients_test.v | 8 +++--- vlib/net/tcp_simple_client_server_test.v | 2 +- .../unix/use_net_and_net_unix_together_test.v | 4 +-- vlib/net/websocket/websocket_test.v | 4 +-- vlib/os/dir_expansions_test.v | 2 +- vlib/os/file_buffering_test.v | 6 ++--- vlib/os/file_test.v | 10 +++---- vlib/os/find_abs_path_of_executable_test.v | 12 ++++----- vlib/os/os_test.c.v | 2 +- vlib/os/process_test.v | 4 +-- vlib/os/process_windows.c.v | 4 +-- vlib/sokol/gfx/enums.v | 18 ++++++------- vlib/sokol/gfx/gfx_structs.c.v | 6 ++--- vlib/strconv/atof.c.v | 2 +- vlib/strings/builder_test.js.v | 2 +- vlib/strings/builder_test.v | 2 +- .../strings/textscanner/textscanner_test.js.v | 4 +-- vlib/strings/textscanner/textscanner_test.v | 4 +-- .../many_writers_and_receivers_on_1_channel.v | 7 +++-- vlib/term/term_test.v | 6 ++--- vlib/time/duration_test.v | 14 +++++----- vlib/time/parse.c.v | 2 +- vlib/time/parse_test.v | 6 ++--- vlib/time/stopwatch_test.v | 2 +- vlib/time/time.v | 2 +- vlib/time/time_test.v | 10 +++---- vlib/toml/scanner/scanner_test.v | 4 +-- vlib/toml/tests/burntsushi_toml_test.v | 2 +- vlib/toml/tests/key_test.v | 2 +- vlib/v/ast/ast.v | 2 +- vlib/v/ast/str.v | 2 +- vlib/v/builder/builder.v | 5 ++-- vlib/v/builder/cbuilder/parallel_cc.v | 2 +- vlib/v/builder/cc.v | 26 +++++++++---------- .../interpreterbuilder/v_interpret_test.v | 2 +- vlib/v/builder/msvc_windows.v | 8 +++--- vlib/v/builder/rebuilding.v | 2 +- vlib/v/checker/checker.v | 8 +++--- vlib/v/compiler_errors_test.v | 6 ++--- vlib/v/eval/eval.v | 4 +-- vlib/v/eval/interpret_test.v | 2 +- vlib/v/gen/c/cgen.v | 2 +- vlib/v/gen/c/cmain.v | 4 +-- vlib/v/gen/c/fn.v | 1 - vlib/v/gen/c/live.v | 2 +- vlib/v/gen/c/str_intp.v | 2 +- vlib/v/gen/golang/tests/golang_test.v | 2 +- vlib/v/gen/native/gen.v | 2 +- vlib/v/gen/native/macho.v | 2 +- vlib/v/gen/native/tests/native_test.v | 2 +- vlib/v/gen/wasm/gen.v | 2 +- vlib/v/gen/wasm/tests/wasm_test.v | 2 +- vlib/v/live/executable/reloader.c.v | 8 +++--- vlib/v/live/live_test.v | 2 +- vlib/v/markused/walker.v | 2 +- vlib/v/parser/tmpl.v | 4 +-- vlib/v/pref/default.v | 4 +-- vlib/v/pref/options_test.v | 8 +++--- vlib/v/pref/pref.v | 17 ++++++------ vlib/v/pref/should_compile.v | 8 +++--- vlib/v/preludes/test_runner_dump.v | 4 +-- vlib/v/preludes/test_runner_normal.v | 3 +-- vlib/v/preludes/test_runner_simple.v | 4 +-- vlib/v/preludes/test_runner_tap.v | 4 +-- vlib/v/slow_tests/assembly/asm_test.amd64.v | 2 +- .../valgrind/1.strings_and_arrays.v | 4 +-- vlib/v/slow_tests/valgrind/base64.v | 2 +- vlib/v/slow_tests/valgrind/valgrind_test.v | 4 +-- vlib/v/tests/alias_basic_types_test.v | 4 +-- ...d_maps_of_empty_structs_should_work_test.v | 2 +- ...ring_key_in_map_vs_string_value_in_array.v | 4 +-- .../comptime_for_in_fields_FieldData_test.v | 8 +++--- vlib/v/tests/comptime_kinds_test.v | 2 +- vlib/v/tests/const_test.v | 2 +- ..._str_on_struct_with_too_many_fields_test.v | 4 +-- .../dump_c_structs/dump_c_struct_test.c.v | 2 +- vlib/v/tests/enum_aliases_test.v | 2 +- vlib/v/tests/enum_bitfield_test.v | 6 ++--- .../enum_from_generic_static_method_test.v | 4 +-- vlib/v/tests/failing_tests_test.v | 2 +- vlib/v/tests/for_loop_with_option2_test.v | 8 +++--- .../generic_fn_returning_type_with_T_test.v | 2 +- vlib/v/tests/generics_struct_free_test.v | 1 - .../voidptr_casted_as_an_interface_test.v | 2 +- .../mut_receiver_returned_as_reference_test.v | 2 +- vlib/v/tests/mut_test.v | 2 +- vlib/v/tests/nested_map_test.v | 2 +- vlib/v/tests/option_test.c.v | 6 ++--- .../tests/string_interpolation_floats_test.v | 8 +++--- ...terpolation_struct_with_usize_field_test.v | 4 +-- .../string_interpolation_variadic_test.v | 8 +++--- .../tests/type_alias_of_pointer_types_test.v | 4 +-- vlib/v/tests/typeof_simple_types_test.v | 2 +- vlib/v/tests/unsafe_test.c.v | 2 +- vlib/v/util/surrounder_test.v | 2 +- vlib/v/vcache/vcache_test.v | 8 +++--- vlib/veb/csrf/csrf_test.v | 1 - vlib/veb/tests/veb_test.v | 8 +++--- vlib/veb/tests/veb_test_server.v | 2 +- vlib/vweb/tests/vweb_test.v | 8 +++--- vlib/vweb/tests/vweb_test_server/server.v | 2 +- vlib/vweb/vweb.v | 4 +-- vlib/x/crypto/chacha20/chacha.v | 6 ++--- .../chacha20poly1305/chacha20poly1305_test.v | 1 - vlib/x/crypto/poly1305/custom.v | 4 +-- vlib/x/ttf/render_sokol_cpu.v | 2 +- vlib/x/vweb/csrf/csrf_test.v | 1 - vlib/x/vweb/tests/vweb_test.v | 8 +++--- vlib/x/vweb/tests/vweb_test_server.v | 2 +- 147 files changed, 319 insertions(+), 339 deletions(-) diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index 74b8f0e099..74c19d1f07 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -93,7 +93,7 @@ pub mut: failed_cmds shared []string reporter Reporter = Reporter(NormalReporter{}) hash string // used as part of the name of the temporary directory created for tests, to ease cleanup - // + exec_mode ActionMode = .compile // .compile_and_run only for `v test` } @@ -368,7 +368,7 @@ pub fn (mut ts TestSession) test() { if current_wd == os.wd_at_startup && current_wd == ts.vroot { ts.root_relative = true } - // + ts.init() mut remaining_files := []string{} for dot_relative_file in ts.files { diff --git a/cmd/tools/modules/testing/output.v b/cmd/tools/modules/testing/output.v index 6303359294..72cde635d9 100644 --- a/cmd/tools/modules/testing/output.v +++ b/cmd/tools/modules/testing/output.v @@ -7,14 +7,14 @@ pub enum MessageKind { compile_end // sent right after *each* _test.v file compilation, the message contains the output of that compilation cmd_begin // sent right before *each* _test.v file execution, the resulting status is not known yet, but the _test.v file itself is cmd_end // sent right after *each* _test.v file execution, the message contains the output of that execution - // + ok // success of a _test.v file fail // failed _test.v file, one or more assertions failed skip // the _test.v file was skipped for some reason info // a generic information message, detailing the actions of the `v test` program (some tests could be repeated for example, and the details are sent with an .info status) - // + cannot_compile // when the _test.v file compiled with errors - // + sentinel // send just once after all executions are done; it signals that the reporting/printing thread should stop the loop and exit } diff --git a/cmd/tools/modules/vgit/vgit.v b/cmd/tools/modules/vgit/vgit.v index 64abf3c9da..e1c66550ec 100644 --- a/cmd/tools/modules/vgit/vgit.v +++ b/cmd/tools/modules/vgit/vgit.v @@ -56,7 +56,7 @@ pub fn prepare_vc_source(vcdir string, cdir string, commit string) (string, stri check_v_commit_timestamp_before_self_rebuilding(v_timestamp) scripting.chdir(vcdir) scripting.run('git checkout --quiet master') - // + mut vccommit := '' mut partial_hash := v_commithash[0..7] if '5b7a1e8'.starts_with(partial_hash) { diff --git a/cmd/tools/vast/vast.v b/cmd/tools/vast/vast.v index 769d97c14a..1380b618d2 100644 --- a/cmd/tools/vast/vast.v +++ b/cmd/tools/vast/vast.v @@ -124,7 +124,7 @@ fn json(file string) string { pref_.fill_with_defaults() pref_.enable_globals = true pref_.is_fmt = true - // + mut t := Tree{ root: new_object() table: ast.new_table() diff --git a/cmd/tools/vcover/data.v b/cmd/tools/vcover/data.v index 468cb754e8..7c3762af03 100644 --- a/cmd/tools/vcover/data.v +++ b/cmd/tools/vcover/data.v @@ -11,7 +11,7 @@ struct CounterLine { mut: file string // retrieved based on the loaded meta line int // retrieved based on the loaded meta - // + meta string // A filename in the sibling meta/ folder, should exist, to match the value from this field. The filename is a hash of both the path and the used build options, to facilitate merging coverage data from different builds/programs point int // The index of a source point. Note that it is not a line number, but an index in the meta data file, keyed by the field `meta` above. hits u64 // How many times the coverage point was executed. Only counters that are != 0 are recorded. diff --git a/cmd/tools/vcover/main.v b/cmd/tools/vcover/main.v index 3639743eb2..96b659a38b 100644 --- a/cmd/tools/vcover/main.v +++ b/cmd/tools/vcover/main.v @@ -21,11 +21,11 @@ mut: be_verbose bool filter string working_folder string - // + targets []string meta map[string]MetaData // aggregated meta data, read from all .json files all_lines_per_file map[string][]int // aggregated by load_meta - // + counters map[string]u64 // incremented by process_target, based on each .csv file lines_per_file map[string]map[int]int // incremented by process_target, based on each .csv file processed_points u64 diff --git a/cmd/tools/vtest-parser.v b/cmd/tools/vtest-parser.v index 33e4698954..f6f918f8d8 100644 --- a/cmd/tools/vtest-parser.v +++ b/cmd/tools/vtest-parser.v @@ -112,7 +112,7 @@ fn process_cli_args() &Context { context.cut_index = fp.int('cut_index', `c`, 1, 'worker specific flag - cut index in the source file, everything before that will be parsed, the rest - ignored.') context.timeout_ms = fp.int('timeout_ms', `t`, 250, 'worker specific flag - timeout in ms; a worker taking longer, will self terminate.') context.path = fp.string('path', `p`, '', 'worker specific flag - path to the current source file, which will be parsed.') - // + if context.is_help { println(fp.usage()) exit(0) diff --git a/cmd/tools/vup.v b/cmd/tools/vup.v index 855960457f..47d3fa9526 100644 --- a/cmd/tools/vup.v +++ b/cmd/tools/vup.v @@ -13,7 +13,7 @@ struct App { is_prod bool vexe string vroot string - // + skip_v_self bool // do not run `v self`, effectively enforcing the running of `make` or `make.bat` skip_current bool // skip the current hash check, enabling easier testing on the same commit, without using docker etc } diff --git a/examples/gg/mandelbrot.v b/examples/gg/mandelbrot.v index 0e86518c8f..68b75e5b50 100644 --- a/examples/gg/mandelbrot.v +++ b/examples/gg/mandelbrot.v @@ -60,7 +60,7 @@ fn (mut state AppState) update() { for t in 0 .. state.ntasks { threads << spawn state.worker(t, chunk_channel, chunk_ready_channel) } - // + mut oview := ViewRect{} mut sw := time.new_stopwatch() for { diff --git a/examples/term.ui/pong.v b/examples/term.ui/pong.v index ca150ebd35..6d509f450e 100644 --- a/examples/term.ui/pong.v +++ b/examples/term.ui/pong.v @@ -167,18 +167,18 @@ fn (mut a App) draw_menu() { y025 := int(f32(a.height) * 0.25) y075 := int(f32(a.height) * 0.75) cy := int(f32(a.height) * 0.5) - // + a.tui.set_color(white) a.tui.bold() a.tui.draw_text(cx - 2, y025, 'VONG') a.tui.reset() a.tui.draw_text(cx - 13, y025 + 1, '(A game of Pong written in V)') - // + a.tui.set_color(white) a.tui.bold() a.tui.draw_text(cx - 3, cy + 1, 'START') a.tui.reset() - // + a.tui.draw_text(cx - 9, y075 + 1, 'Press SPACE to start') a.tui.reset() a.tui.draw_text(cx - 5, y075 + 3, 'ESC to Quit') diff --git a/vlib/arrays/arrays_test.v b/vlib/arrays/arrays_test.v index af1a58585d..dfea485926 100644 --- a/vlib/arrays/arrays_test.v +++ b/vlib/arrays/arrays_test.v @@ -436,7 +436,7 @@ fn test_map_of_indexes() { assert arrays.map_of_indexes([1, 2, 3, 999]) == {1: [0], 2: [1], 3: [2], 999: [3]} assert arrays.map_of_indexes([999, 1, 2, 3]) == {1: [1], 2: [2], 3: [3], 999: [0]} assert arrays.map_of_indexes([1, 2, 3, 4, 4, 2, 1, 4, 4, 999]) == {1: [0, 6], 2: [1, 5], 3: [2], 4: [3, 4, 7, 8], 999: [9]} - // + assert arrays.map_of_indexes([]string{}) == {} assert arrays.map_of_indexes(['abc']) == {'abc': [0]} assert arrays.map_of_indexes(['abc', 'abc']) == {'abc': [0, 1]} @@ -451,7 +451,7 @@ fn test_map_of_counts() { assert map_of_counts([1, 2, 3, 999]) == {1: 1, 2: 1, 3: 1, 999: 1} assert map_of_counts([999, 1, 2, 3]) == {1: 1, 2: 1, 3: 1, 999: 1} assert map_of_counts([1, 2, 3, 4, 4, 2, 1, 4, 4, 999]) == {1: 2, 2: 2, 3: 1, 4: 4, 999: 1} - // + assert map_of_counts([]string{}) == {} assert map_of_counts(['abc']) == {'abc': 1} assert map_of_counts(['abc', 'abc']) == {'abc': 2} @@ -550,7 +550,7 @@ fn test_each() { for x in a { control_sum += x } - // + each(a, fn (x int) { println(x) }) @@ -573,7 +573,7 @@ fn test_each_indexed() { for idx, x in a { control_sum += f(idx, x) } - // + each_indexed(a, fn (idx int, x int) { println('idx: ${idx}, x: ${x}') }) diff --git a/vlib/benchmark/benchmark_test.v b/vlib/benchmark/benchmark_test.v index 37e92a6dbd..9509f23ea5 100644 --- a/vlib/benchmark/benchmark_test.v +++ b/vlib/benchmark/benchmark_test.v @@ -19,7 +19,7 @@ fn test_record_measure() { assert x > 50_000 // assert x < 200_000 flush_stdout() - // + println('step 2') flush_stdout() time.sleep(150 * time.millisecond) @@ -27,7 +27,7 @@ fn test_record_measure() { assert y > 100_000 // assert y < 200_000 flush_stdout() - // + res := b.all_recorded_measures() println('All recorded measurements:') println(res) diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v index f12c994466..484f33521c 100644 --- a/vlib/builtin/array_test.v +++ b/vlib/builtin/array_test.v @@ -1279,7 +1279,7 @@ fn test_push_arr_string_free() { lines << s // make sure the data in the array is valid after freeing the string unsafe { s.free() } - // + println(lines) assert lines.len == 2 assert lines[0] == 'hi' diff --git a/vlib/builtin/builtin.v b/vlib/builtin/builtin.v index 86a3ec2512..264cb5b2fa 100644 --- a/vlib/builtin/builtin.v +++ b/vlib/builtin/builtin.v @@ -125,22 +125,22 @@ pub: name string // the name of the field f typ int // the internal TypeID of the field f, unaliased_typ int // if f's type was an alias of int, this will be TypeID(int) - // + attrs []string // the attributes of the field f is_pub bool // f is in a `pub:` section is_mut bool // f is in a `mut:` section - // + is_shared bool // `f shared Abc` is_atomic bool // `f atomic int` , TODO is_option bool // `f ?string` , TODO - // + is_array bool // `f []string` , TODO is_map bool // `f map[string]int` , TODO is_chan bool // `f chan int` , TODO is_enum bool // `f Enum` where Enum is an enum is_struct bool // `f Abc` where Abc is a struct , TODO is_alias bool // `f MyInt` where `type MyInt = int`, TODO - // + indirections u8 // 0 for `f int`, 1 for `f &int`, 2 for `f &&int` , TODO } diff --git a/vlib/builtin/float_test.v b/vlib/builtin/float_test.v index b6991bf371..4cac703228 100644 --- a/vlib/builtin/float_test.v +++ b/vlib/builtin/float_test.v @@ -156,8 +156,7 @@ fn test_float_point_formatting_rounding() { assert '${float_2:0.0f}' == '45' assert '${float_3:0.0f}' == '239' assert '${float_4:0.0f}' == '240' - // - // + assert '${239.5555551:0.0f}' == '240' assert '${239.5555551:0.1f}' == '239.6' assert '${239.5555551:0.2f}' == '239.56' @@ -170,7 +169,7 @@ fn test_float_point_formatting_rounding() { assert '${239.5555551:0.9f}' == '239.555555100' assert '${239.5555551:0.10f}' == '239.5555551000' assert '${239.5555551:0.11f}' == '239.55555510000' - // + assert '${239.5:0.0f}' == '240' assert '${239.55:0.1f}' == '239.6' assert '${239.555:0.2f}' == '239.56' @@ -182,7 +181,7 @@ fn test_float_point_formatting_rounding() { assert '${239.555555555:0.8f}' == '239.55555556' assert '${239.5555555555:0.9f}' == '239.555555556' assert '${239.55555555555:0.10f}' == '239.5555555556' - // + assert '${239.5550:0.3f}' == '239.555' assert '${239.5551:0.3f}' == '239.555' assert '${239.5552:0.3f}' == '239.555' @@ -193,7 +192,7 @@ fn test_float_point_formatting_rounding() { assert '${239.5557:0.3f}' == '239.556' assert '${239.5558:0.3f}' == '239.556' assert '${239.5559:0.3f}' == '239.556' - // + assert '${239.5555551:0.6f}' == '239.555555' assert '${239.5555552:0.6f}' == '239.555555' assert '${239.5555553:0.6f}' == '239.555555' @@ -203,7 +202,7 @@ fn test_float_point_formatting_rounding() { assert '${239.5555557:0.6f}' == '239.555556' assert '${239.5555558:0.6f}' == '239.555556' assert '${239.5555559:0.6f}' == '239.555556' - // + assert '${239.55555555555:0.10f}' == '239.5555555556' assert '${239.55555555555:0.9f}' == '239.555555556' assert '${239.55555555555:0.8f}' == '239.55555556' @@ -215,7 +214,7 @@ fn test_float_point_formatting_rounding() { assert '${239.55555555555:0.2f}' == '239.56' assert '${239.55555555555:0.1f}' == '239.6' assert '${239.55555555555:0.0f}' == '240' - // + assert '${-239.55555555555:0.10f}' == '-239.5555555556' assert '${-239.55555555555:0.9f}' == '-239.555555556' assert '${-239.55555555555:0.8f}' == '-239.55555556' diff --git a/vlib/builtin/js/array_test.js.v b/vlib/builtin/js/array_test.js.v index ff0dec2b7b..37d75d7d24 100644 --- a/vlib/builtin/js/array_test.js.v +++ b/vlib/builtin/js/array_test.js.v @@ -1241,7 +1241,7 @@ fn test_push_arr_string_free() { lines << s // make sure the data in the array is valid after freeing the string unsafe { s.free() } - // + println(lines) assert lines.len == 2 assert lines[0] == 'hi' diff --git a/vlib/builtin/lambda_expr_array_test.v b/vlib/builtin/lambda_expr_array_test.v index f1c61f9e41..8a2ec47a7b 100644 --- a/vlib/builtin/lambda_expr_array_test.v +++ b/vlib/builtin/lambda_expr_array_test.v @@ -3,7 +3,7 @@ const a = [4, 5, 1, 2, 5, 9] fn test_map() { assert a.map(it) == a assert a.map(it * 10) == [40, 50, 10, 20, 50, 90] - // + assert a.map(|x| x) == a assert a.map(|x| x * 10) == [40, 50, 10, 20, 50, 90] assert a.map(|x| 'x: ${x}') == ['x: 4', 'x: 5', 'x: 1', 'x: 2', 'x: 5', 'x: 9'] @@ -13,7 +13,7 @@ fn test_map() { fn test_filter() { assert a.filter(it > 4) == [5, 5, 9] assert a.filter(it < 4) == [1, 2] - // + assert a.filter(|x| x > 4) == [5, 5, 9] assert a.filter(|x| x < 4) == [1, 2] } diff --git a/vlib/builtin/rune_test.v b/vlib/builtin/rune_test.v index a36b464e6e..607cfdaede 100644 --- a/vlib/builtin/rune_test.v +++ b/vlib/builtin/rune_test.v @@ -16,23 +16,23 @@ fn test_length_in_bytes() { assert rune(0x0).length_in_bytes() == 1 assert `A`.length_in_bytes() == 1 // latin letter assert rune(0x7F).length_in_bytes() == 1 - // + assert rune(0x80).length_in_bytes() == 2 assert `Д`.length_in_bytes() == 2 // cyrillic letter assert rune(0x7FF).length_in_bytes() == 2 - // + assert rune(0x800).length_in_bytes() == 3 assert `喂`.length_in_bytes() == 3 // hey assert rune(0xFFFF).length_in_bytes() == 3 - // + assert rune(0xD800).length_in_bytes() == -1 // min for surrogates assert rune(0xD866).length_in_bytes() == -1 // invalid assert rune(0xDFFF).length_in_bytes() == -1 // max for surrogates - // + assert rune(0x100000).length_in_bytes() == 4 assert rune(0x10FFD7).length_in_bytes() == 4 // "Supplementary Private Use Area-B" ¯\_(ツ)_/¯ assert rune(0x10FFFF).length_in_bytes() == 4 - // + assert rune(0x110000).length_in_bytes() == -1 } diff --git a/vlib/builtin/string_int_test.v b/vlib/builtin/string_int_test.v index 81fafa5f22..afc045713c 100644 --- a/vlib/builtin/string_int_test.v +++ b/vlib/builtin/string_int_test.v @@ -267,7 +267,6 @@ fn test_interpolation_of_negative_numbers_padding_and_width() { assert '-000000000000000004d' == '${a:020x}' assert '-0000000000001001101' == '${a:020b}' - // assert ' -77' == '${a:8}' assert ' -77' == '${a:8d}' assert ' -4d' == '${a:8x}' @@ -278,7 +277,6 @@ fn test_interpolation_of_negative_numbers_padding_and_width() { assert '-1001101' == '${a:08b}' assert '-000004d' == '${a:08x}' - // assert ' -77' == '${a:4}' assert ' -77' == '${a:4d}' assert '-1001101' == '${a:4b}' @@ -289,7 +287,6 @@ fn test_interpolation_of_negative_numbers_padding_and_width() { assert '-1001101' == '${a:04b}' assert '-04d' == '${a:04x}' - // assert '-77' == '${a:2}' assert '-77' == '${a:2d}' assert '-1001101' == '${a:2b}' @@ -300,14 +297,12 @@ fn test_interpolation_of_negative_numbers_padding_and_width() { assert '-1001101' == '${a:02b}' assert '-4d' == '${a:02x}' - // bin0 := ~6 assert bin0 == -7 assert '-0000111' == '${bin0:08b}' // a minimum of 8 characters for the whole number, including the padding and the sign assert '-0000111' == '${~6:08b}' assert ' -111' == '${~6:8b}' - // assert '-0000110' == '${-6:08b}' assert ' -110' == '${-6:8b}' } diff --git a/vlib/builtin/string_match_glob_test.v b/vlib/builtin/string_match_glob_test.v index 3a21ed8bfb..60ff5ffb30 100644 --- a/vlib/builtin/string_match_glob_test.v +++ b/vlib/builtin/string_match_glob_test.v @@ -15,20 +15,20 @@ fn test_match_glob_on_x() { fn test_match_glob_on_abc() { assert !'abc'.match_glob('') assert 'abc'.match_glob('*') - // + assert !'abc'.match_glob('ab') assert 'abc'.match_glob('abc') assert 'abc'.match_glob('abc*') - // + assert 'abc'.match_glob('*c') assert !'abc'.match_glob('*b') assert 'abc'.match_glob('*bc') assert 'abc'.match_glob('*abc') - // + assert 'abc'.match_glob('a*') assert !'abc'.match_glob('b*') assert 'abc'.match_glob('a*c') - // + assert 'abc'.match_glob('ab?') assert 'abc'.match_glob('a??') assert 'abc'.match_glob('???') @@ -49,13 +49,13 @@ fn test_match_glob_with_any_charset_patterns() { assert 'axbxcxdxe'.match_glob('*c[xyz]d*') assert 'axbxcxdxe'.match_glob('*c[yxz]d*') assert 'axbxcxdxe'.match_glob('*c[zyx]d*') - // + assert 'axbxcxdxe'.match_glob('*dx[QeW]') assert 'axbxcxdxe'.match_glob('*dx[QeW]*') - // + assert !'axbxcxdxe'.match_glob('*bx[QcW]') assert 'axbxcxdxe'.match_glob('*bx[QcW]*') - // + assert !'axbxcxdxe'.match_glob('*zx[QeW]') assert !'axbxcxdxe'.match_glob('*zx[QeW]*') } diff --git a/vlib/builtin/string_test.v b/vlib/builtin/string_test.v index 00b2ec24d7..0fdc976d3a 100644 --- a/vlib/builtin/string_test.v +++ b/vlib/builtin/string_test.v @@ -1506,12 +1506,11 @@ fn test_index_u8() { assert 'abcabca'.index_u8(`a`) == 0 assert 'abcabca'.index_u8(`b`) == 1 assert 'abcabca'.index_u8(`c`) == 2 - // + assert 'abc'.index_u8(`d`) == -1 assert 'abc'.index_u8(`A`) == -1 assert 'abc'.index_u8(`B`) == -1 assert 'abc'.index_u8(`C`) == -1 - // } fn test_last_index() { diff --git a/vlib/crypto/internal/subtle/comparison_test.v b/vlib/crypto/internal/subtle/comparison_test.v index 8222ce5568..3eab35bf18 100644 --- a/vlib/crypto/internal/subtle/comparison_test.v +++ b/vlib/crypto/internal/subtle/comparison_test.v @@ -25,7 +25,7 @@ fn test_constant_time_select() { assert constant_time_select(1, 2, 0) == 2 assert constant_time_select(1, 2, 255) == 2 assert constant_time_select(1, 2, 255 * 255) == 2 - // + assert constant_time_select(0, 1, 0) == 0 assert constant_time_select(0, 1, 255) == 255 assert constant_time_select(0, 1, 255 * 255) == 255 * 255 diff --git a/vlib/encoding/base64/base64_memory_test.v b/vlib/encoding/base64/base64_memory_test.v index 7996b76d4b..a5bd739e21 100644 --- a/vlib/encoding/base64/base64_memory_test.v +++ b/vlib/encoding/base64/base64_memory_test.v @@ -18,7 +18,7 @@ fn test_long_encoding() { unsafe { free(ebuffer) } unsafe { free(dbuffer) } } - // + encoded_size := base64.encode_in_buffer(s_original, ebuffer) mut encoded_in_buf := []u8{len: encoded_size} unsafe { vmemcpy(encoded_in_buf.data, ebuffer, encoded_size) } diff --git a/vlib/gg/gg.c.v b/vlib/gg/gg.c.v index 5a260a5b71..3a2ab54455 100644 --- a/vlib/gg/gg.c.v +++ b/vlib/gg/gg.c.v @@ -67,15 +67,15 @@ pub: native_frame_fn FNCb = unsafe { nil } cleanup_fn FNCb = unsafe { nil } // Called once, after Sokol determines that the application is finished/closed. Put your app specific cleanup/free actions here. fail_fn FNFail = unsafe { nil } // Called once per Sokol error/log message. TODO: currently it does nothing with latest Sokol, reimplement using Sokol's new sapp_logger APIs. - // + event_fn FNEvent = unsafe { nil } // Called once per each user initiated event, received by Sokol/GG. on_event FNEvent2 = unsafe { nil } // Called once per each user initiated event, received by Sokol/GG. Same as event_fn, just the parameter order is different. TODO: deprecate this, in favor of event_fn quit_fn FNEvent = unsafe { nil } // Called when the user closes the app window. - // + keydown_fn FNKeyDown = unsafe { nil } // Called once per key press, no matter how long the key is held down. Note that here you can access the scan code/physical key, but not the logical character. keyup_fn FNKeyUp = unsafe { nil } // Called once per key press, when the key is released. char_fn FNChar = unsafe { nil } // Called once per character (after the key is pressed down, and then released). Note that you can access the character/utf8 rune here, not just the scan code. - // + move_fn FNMove = unsafe { nil } // Called while the mouse/touch point is moving. click_fn FNClick = unsafe { nil } // Called once when the mouse/touch button is clicked. unclick_fn FNUnClick = unsafe { nil } // Called once when the mouse/touch button is released. @@ -103,7 +103,7 @@ pub: enable_dragndrop bool // enable file dropping (drag'n'drop), default is false max_dropped_files int = 1 // max number of dropped files to process (default: 1) max_dropped_file_path_length int = 2048 // max length in bytes of a dropped UTF-8 file path (default: 2048) - // + min_width int // desired minimum width of the window min_height int // desired minimum height of the window } @@ -169,7 +169,7 @@ pub mut: font_inited bool ui_mode bool // do not redraw everything 60 times/second, but only when the user requests frame u64 // the current frame counted from the start of the application; always increasing - // + mbtn_mask u8 mouse_buttons MouseButtons // typed version of mbtn_mask; easier to use for user programs mouse_pos_x int @@ -178,7 +178,7 @@ pub mut: mouse_dy int scroll_x int scroll_y int - // + key_modifiers Modifier // the current key modifiers key_repeat bool // whether the pressed key was an autorepeated one pressed_keys [key_code_max]bool // an array representing all currently pressed keys diff --git a/vlib/gg/gg.js.v b/vlib/gg/gg.js.v index cb9891c74e..391388d892 100644 --- a/vlib/gg/gg.js.v +++ b/vlib/gg/gg.js.v @@ -217,14 +217,14 @@ pub: native_frame_fn FNCb = unsafe { nil } cleanup_fn FNCb = unsafe { nil } fail_fn FNFail = unsafe { nil } - // + event_fn FNEvent = unsafe { nil } quit_fn FNEvent = unsafe { nil } - // + keydown_fn FNKeyDown = unsafe { nil } keyup_fn FNKeyUp = unsafe { nil } char_fn FNChar = unsafe { nil } - // + move_fn FNMove = unsafe { nil } click_fn FNClick = unsafe { nil } unclick_fn FNUnClick = unsafe { nil } @@ -284,7 +284,7 @@ pub mut: mouse_dy int scroll_x int scroll_y int - // + key_modifiers Modifier // the current key modifiers key_repeat bool // whether the pressed key was an autorepeated one pressed_keys [key_code_max]bool // an array representing all currently pressed keys diff --git a/vlib/gg/image.v b/vlib/gg/image.v index 36e6918783..3a935acdbb 100644 --- a/vlib/gg/image.v +++ b/vlib/gg/image.v @@ -18,7 +18,7 @@ pub mut: z f32 color gx.Color = gx.white effect ImageEffect = .alpha - // + rotation f32 // the amount to rotate the image in degrees, counterclockwise. Use a negative value, to rotate it clockwise. } diff --git a/vlib/gx/color.v b/vlib/gx/color.v index f1da39d4f4..54b7668770 100644 --- a/vlib/gx/color.v +++ b/vlib/gx/color.v @@ -236,7 +236,7 @@ pub fn (a Color) over(b Color) Color { aa := f32(a.a) / 255 ab := f32(b.a) / 255 ar := aa + ab * (1 - aa) - // + rr := (f32(a.r) * aa + f32(b.r) * ab * (1 - aa)) / ar gr := (f32(a.g) * aa + f32(b.g) * ab * (1 - aa)) / ar br := (f32(a.b) * aa + f32(b.b) * ab * (1 - aa)) / ar diff --git a/vlib/gx/color_test.v b/vlib/gx/color_test.v index 93836aac47..9c23c80d54 100644 --- a/vlib/gx/color_test.v +++ b/vlib/gx/color_test.v @@ -16,7 +16,7 @@ fn test_add() { b := gx.rgba(100, 100, 100, 100) r := gx.rgba(200, 200, 200, 200) assert (a + b) == r - // + assert gx.red + gx.green == gx.yellow assert gx.red + gx.blue == gx.magenta assert gx.green + gx.blue == gx.cyan @@ -27,7 +27,7 @@ fn test_sub() { b := gx.rgba(100, 100, 100, 100) r := gx.rgba(0, 0, 0, 100) assert (a - b) == r - // + assert gx.white - gx.green == gx.magenta assert gx.white - gx.blue == gx.yellow assert gx.white - gx.red == gx.cyan diff --git a/vlib/hash/fnv1a/fnv1a_test.v b/vlib/hash/fnv1a/fnv1a_test.v index 4c5dc762ac..4332be9d51 100644 --- a/vlib/hash/fnv1a/fnv1a_test.v +++ b/vlib/hash/fnv1a/fnv1a_test.v @@ -24,7 +24,7 @@ fn test_fnv1a_sum32() { assert b.hex() == ahash assert c.hex() == ahash assert d.hex() == ahash - // + mut aa := Abc{} x := fnv1a.sum32_struct(aa) aa.a[3] = 5 @@ -51,7 +51,7 @@ fn test_fnv1a_sum64() { assert b.hex() == ahash assert c.hex() == ahash assert d.hex() == ahash - // + mut aa := Abc{} x := fnv1a.sum64_struct(aa) aa.a[3] = 5 diff --git a/vlib/io/custom_string_reading_test.v b/vlib/io/custom_string_reading_test.v index adeeb73ce9..7f98fa91cc 100644 --- a/vlib/io/custom_string_reading_test.v +++ b/vlib/io/custom_string_reading_test.v @@ -29,7 +29,7 @@ fn read_from_string(text string, capacity int) []u8 { text: text } mut stream := io.new_buffered_reader(reader: str, cap: capacity) - // + mut buf := []u8{len: 1} mut res := []u8{} mut i := 0 diff --git a/vlib/json/cjson/cjson_wrapper.c.v b/vlib/json/cjson/cjson_wrapper.c.v index e9899661bb..3cf4a28beb 100644 --- a/vlib/json/cjson/cjson_wrapper.c.v +++ b/vlib/json/cjson/cjson_wrapper.c.v @@ -18,9 +18,9 @@ pub: next &C.cJSON // next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem prev &C.cJSON child &C.cJSON // An array or object item will have a child pointer pointing to a chain of the items in the array/object - // + @type int // The type of the item, as above - // + valueint int // writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead valuedouble f64 // The item's number, if type==cJSON_Number valuestring &char // The item's string, if type==cJSON_String and type == cJSON_Raw diff --git a/vlib/maps/maps_test.v b/vlib/maps/maps_test.v index 11df779f02..85869e1916 100644 --- a/vlib/maps/maps_test.v +++ b/vlib/maps/maps_test.v @@ -127,7 +127,7 @@ fn test_merge_in_place() { 'xyz': 'zyx' 'aa': 'dd' } - // + mut im1 := { 11: 22 33: 44 @@ -171,7 +171,7 @@ fn test_merge() { 'xyz': 'zyx' 'aa': 'dd' } - // + mut im1 := { 11: 22 33: 44 diff --git a/vlib/math/math_test.v b/vlib/math/math_test.v index c59dae2fbb..82b9bc0391 100644 --- a/vlib/math/math_test.v +++ b/vlib/math/math_test.v @@ -474,7 +474,7 @@ fn test_signi() { assert signi(-0.000000000001) == -1 assert signi(-0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001) == -1 assert signi(-0.0) == -1 - // + assert signi(inf(1)) == 1 assert signi(72234878292.4586129) == 1 assert signi(10) == 1 @@ -495,7 +495,7 @@ fn test_sign() { assert sign(-0.000000000001) == -1.0 assert sign(-0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001) == -1.0 assert sign(-0.0) == -1.0 - // + assert sign(inf(1)) == 1.0 assert sign(72234878292.4586129) == 1 assert sign(10) == 1.0 @@ -1098,7 +1098,7 @@ fn test_count_digits() { assert count_digits(99) == 2 assert count_digits(100) == 3 assert count_digits(999) == 3 - // + assert count_digits(12345) == 5 assert count_digits(123456789012345) == 15 assert count_digits(-67345) == 5 diff --git a/vlib/net/http/file/static_server.v b/vlib/net/http/file/static_server.v index 864a880e49..394e5b4e00 100644 --- a/vlib/net/http/file/static_server.v +++ b/vlib/net/http/file/static_server.v @@ -82,7 +82,7 @@ fn (mut h StaticHttpHandler) handle(req http.Request) http.Response { res.header.add(.content_type, 'text/html; charset=utf-8') return res } - // + mut body := '' mut content_type := 'text/html; charset=utf-8' if os.is_dir(requested_file_path) { diff --git a/vlib/net/http/http.v b/vlib/net/http/http.v index 32c83a0a8f..5e79bbab7e 100644 --- a/vlib/net/http/http.v +++ b/vlib/net/http/http.v @@ -24,7 +24,7 @@ pub mut: user_ptr voidptr = unsafe { nil } verbose bool proxy &HttpProxy = unsafe { nil } - // + validate bool // set this to true, if you want to stop requests, when their certificates are found to be invalid verify string // the path to a rootca.pem file, containing trusted CA certificate(s) cert string // the path to a cert.pem file, containing client certificate(s) for the request @@ -37,7 +37,7 @@ pub mut: on_progress RequestProgressFn = unsafe { nil } on_progress_body RequestProgressBodyFn = unsafe { nil } on_finish RequestFinishFn = unsafe { nil } - // + stop_copying_limit i64 = -1 // after this many bytes are received, stop copying to the response. Note that on_progress and on_progress_body callbacks, will continue to fire normally, until the full response is read, which allows you to implement streaming downloads, without keeping the whole big response in memory stop_receiving_limit i64 = -1 // after this many bytes are received, break out of the loop that reads the response, effectively stopping the request early. No more on_progress callbacks will be fired. The on_finish callback will fire. } diff --git a/vlib/net/http/request.v b/vlib/net/http/request.v index 4b992b1ed7..db54c96807 100644 --- a/vlib/net/http/request.v +++ b/vlib/net/http/request.v @@ -37,7 +37,7 @@ pub mut: // time = -1 for no timeout read_timeout i64 = 30 * time.second write_timeout i64 = 30 * time.second - // + validate bool // when true, certificate failures will stop further processing verify string cert string @@ -50,7 +50,7 @@ pub mut: on_progress RequestProgressFn = unsafe { nil } on_progress_body RequestProgressBodyFn = unsafe { nil } on_finish RequestFinishFn = unsafe { nil } - // + stop_copying_limit i64 = -1 // after this many bytes are received, stop copying to the response. Note that on_progress and on_progress_body callbacks, will continue to fire normally, until the full response is read, which allows you to implement streaming downloads, without keeping the whole big response in memory stop_receiving_limit i64 = -1 // after this many bytes are received, break out of the loop that reads the response, effectively stopping the request early. No more on_progress callbacks will be fired. The on_finish callback will fire. } diff --git a/vlib/net/http/server.v b/vlib/net/http/server.v index 29d8dac5b3..aed43db992 100644 --- a/vlib/net/http/server.v +++ b/vlib/net/http/server.v @@ -38,11 +38,11 @@ pub mut: pool_channel_slots int = 1024 worker_num int = runtime.nr_jobs() listener net.TcpListener - // + on_running fn (mut s Server) = unsafe { nil } // Blocking cb. If set, ran by the web server on transitions to its .running state. on_stopped fn (mut s Server) = unsafe { nil } // Blocking cb. If set, ran by the web server on transitions to its .stopped state. on_closed fn (mut s Server) = unsafe { nil } // Blocking cb. If set, ran by the web server on transitions to its .closed state. - // + show_startup_message bool = true // set to false, to remove the default `Listening on ...` message. } diff --git a/vlib/net/http/server_test.v b/vlib/net/http/server_test.v index 266141b1ab..7488a7391e 100644 --- a/vlib/net/http/server_test.v +++ b/vlib/net/http/server_test.v @@ -136,9 +136,9 @@ fn test_server_custom_handler() { assert x.status_msg == 'OK' assert y.status() == .ok assert y.http_version == '1.1' - // + http.fetch(url: 'http://${server.addr}/something/else')! - // + big_url := 'http://${server.addr}/redirect_to_big' mut progress_calls := &ProgressCalls{} z := http.fetch( @@ -173,10 +173,10 @@ fn test_server_custom_handler() { assert progress_calls.chunks[1].bytestr().starts_with('HTTP/1.1 200 OK') assert progress_calls.chunks.last().bytestr().contains('xyz def') assert progress_calls.redirected_to == ['http://${server.addr}/big'] - // + server.stop() t.wait() - // + assert handler.counter == 5 assert handler.oks == 3 assert handler.not_founds == 1 diff --git a/vlib/net/tcp_self_dial_from_many_clients_test.v b/vlib/net/tcp_self_dial_from_many_clients_test.v index 40109e5393..f05ff779b4 100644 --- a/vlib/net/tcp_self_dial_from_many_clients_test.v +++ b/vlib/net/tcp_self_dial_from_many_clients_test.v @@ -9,16 +9,16 @@ struct Context { mut: ok_client_dials int fail_client_dials int - // + ok_client_close int fail_client_close int - //// + ok_server_accepts int fail_server_accepts int - // + ok_server_close int fail_server_close int - // + received []int } diff --git a/vlib/net/tcp_simple_client_server_test.v b/vlib/net/tcp_simple_client_server_test.v index ee85f7dc24..b8395ef3f7 100644 --- a/vlib/net/tcp_simple_client_server_test.v +++ b/vlib/net/tcp_simple_client_server_test.v @@ -92,7 +92,7 @@ fn test_socket_read_line() { message := '${message1}\n${message2}\n' socket.write_string(message) or { assert false } assert true - // + line1 := reader.read_line() or { // println(reader.buf) assert false diff --git a/vlib/net/unix/use_net_and_net_unix_together_test.v b/vlib/net/unix/use_net_and_net_unix_together_test.v index 0aa3add21d..50141d8933 100644 --- a/vlib/net/unix/use_net_and_net_unix_together_test.v +++ b/vlib/net/unix/use_net_and_net_unix_together_test.v @@ -21,12 +21,12 @@ fn test_that_net_and_net_unix_can_be_imported_together_without_conflicts() { defer { l.close() or {} } - // + mut c := unix.connect_stream(test_port)! defer { c.close() or {} } - // + data := 'Hello from vlib/net!' c.write_string(data)! mut buf := []u8{len: 100} diff --git a/vlib/net/websocket/websocket_test.v b/vlib/net/websocket/websocket_test.v index 334505c7c9..dcd14ffd87 100644 --- a/vlib/net/websocket/websocket_test.v +++ b/vlib/net/websocket/websocket_test.v @@ -151,7 +151,7 @@ fn test_on_close_when_server_closing_connection() ! { res.nr_closes++ }, test_results) start_server_in_thread_and_wait_till_it_is_ready_to_accept_connections(mut ws) - // + mut client := websocket.new_client('ws://localhost:30003')! client.connect()! spawn client.listen() @@ -164,7 +164,7 @@ fn test_on_close_when_server_closing_connection() ! { fn test_on_close_when_client_closing_connection() ! { mut ws := websocket.new_server(.ip, 30004, '') start_server_in_thread_and_wait_till_it_is_ready_to_accept_connections(mut ws) - // + mut client := websocket.new_client('ws://localhost:30004')! mut test_results := WebsocketTestResults{} client.on_close_ref(fn (mut cli websocket.Client, code int, reason string, mut res WebsocketTestResults) ! { diff --git a/vlib/os/dir_expansions_test.v b/vlib/os/dir_expansions_test.v index 3ef2a2cbb7..6567dd2c3c 100644 --- a/vlib/os/dir_expansions_test.v +++ b/vlib/os/dir_expansions_test.v @@ -24,7 +24,7 @@ fn test_ensure_folder_is_writable() { fn test_expand_tilde_to_home() { os.setenv('HOME', '/tmp/home/folder', true) os.setenv('USERPROFILE', r'\tmp\home\folder', true) - // + home_test := os.join_path(os.home_dir(), 'test', 'tilde', 'expansion') home_expansion_test := os.expand_tilde_to_home(os.join_path('~', 'test', 'tilde', 'expansion')) diff --git a/vlib/os/file_buffering_test.v b/vlib/os/file_buffering_test.v index ff1740b541..129c0077e6 100644 --- a/vlib/os/file_buffering_test.v +++ b/vlib/os/file_buffering_test.v @@ -30,7 +30,7 @@ fn test_set_buffer_line_buffered() { unsafe { buf.reset() } } wfile.close() - // + content := os.read_lines('text.txt')! dump(content) assert content == ['----------------------------------', 'hello', 'world', 'hi'] @@ -57,7 +57,7 @@ fn test_set_buffer_fully_buffered() { dump(buf) // assert buf.bytestr().starts_with('---\nhello\nworld\nhi\n') // works on GLIBC, fails on MUSL assert buf.bytestr().contains('---\nhello\nworld\n') - // + content := os.read_lines('text.txt')! dump(content) assert content == ['S---', 'hello', 'world', 'hi'] @@ -80,7 +80,7 @@ fn test_set_unbuffered() { wfile.close() // dump(buf.bytestr()) assert buf.all(it == 0) - // + content := os.read_lines('text.txt')! dump(content) assert content == ['S---', 'hello', 'world', 'hi'] diff --git a/vlib/os/file_test.v b/vlib/os/file_test.v index faf13f5d8b..e5868b507e 100644 --- a/vlib/os/file_test.v +++ b/vlib/os/file_test.v @@ -334,7 +334,7 @@ fn test_seek() { // println('> ${sizeof(Point)} ${sizeof(byte)} ${sizeof(Color)} ${sizeof(Permissions)}') f = os.open_file(tfile, 'r')! - // + f.seek(i64(sizeof(Point)), .start)! assert f.tell()! == sizeof(Point) b := f.read_raw[u8]()! @@ -343,7 +343,7 @@ fn test_seek() { f.seek(i64(sizeof(Color)), .current)! x := f.read_raw[Permissions]()! assert x == another_permission - // + f.close() } @@ -411,7 +411,7 @@ fn test_open_file_wb_ab() { wfile.write_string('hello')! wfile.close() assert os.read_file('text.txt')! == 'hello' - // + mut afile := os.open_file('text.txt', 'ab', 0o666)! afile.write_string('hello')! afile.close() @@ -424,12 +424,12 @@ fn test_open_append() { f1.write_string('abc\n')! f1.close() assert os.read_lines(tfile)! == ['abc'] - // + mut f2 := os.open_append(tfile)! f2.write_string('abc\n')! f2.close() assert os.read_lines(tfile)! == ['abc', 'abc'] - // + mut f3 := os.open_append(tfile)! f3.write_string('def\n')! f3.close() diff --git a/vlib/os/find_abs_path_of_executable_test.v b/vlib/os/find_abs_path_of_executable_test.v index 5eda01b58f..641b57ae78 100644 --- a/vlib/os/find_abs_path_of_executable_test.v +++ b/vlib/os/find_abs_path_of_executable_test.v @@ -8,21 +8,21 @@ fn test_find_abs_path_of_executable() { defer { os.rmdir_all(tfolder) or {} } - // + original_path := os.getenv('PATH') original_wdir := os.getwd() defer { os.chdir(original_wdir) or {} } - // + new_path := tfolder + os.path_delimiter + original_path os.setenv('PATH', new_path, true) - // + mut myclang_file := 'myclang' $if windows { myclang_file += '.bat' } - // + os.chdir(tfolder)! os.write_file(myclang_file, 'echo hello')! os.chmod(myclang_file, 0o0777)! @@ -31,13 +31,13 @@ fn test_find_abs_path_of_executable() { defer { os.rm(myclang_file) or {} } - // + fpath := os.find_abs_path_of_executable('myclang') or { assert false return } dump(fpath) - // + os.setenv('PATH', original_path, true) os.chdir(os.home_dir())! // change to a *completely* different folder, to avoid the original PATH containing `.` if x := os.find_abs_path_of_executable('myclang') { diff --git a/vlib/os/os_test.c.v b/vlib/os/os_test.c.v index 9cf3f469aa..45cdf0aca4 100644 --- a/vlib/os/os_test.c.v +++ b/vlib/os/os_test.c.v @@ -983,7 +983,7 @@ fn move_across_partitions_using_function(f fn (src string, dst string, opts os.M os.mkdir_all(mfolder)! os.mkdir_all(cfolder)! os.mkdir_all(cdeepfolder)! - // + original_path := os.join_path(pfolder, 'original.txt') target_path := os.join_path(cdeepfolder, 'target.txt') os.write_file(original_path, 'text')! diff --git a/vlib/os/process_test.v b/vlib/os/process_test.v index 271bc77e5c..8459d301d5 100644 --- a/vlib/os/process_test.v +++ b/vlib/os/process_test.v @@ -88,7 +88,7 @@ fn test_run() { p.wait() assert p.code == 0 assert p.status == .exited - // + eprintln('polling iterations: ${i}') assert i < 50 p.close() @@ -126,7 +126,7 @@ fn test_slurping_output() { assert output.contains('stdout, 2') assert output.contains('stdout, 3') assert output.contains('stdout, 4') - // + // dump(errors) assert errors.contains('stderr, 1') assert errors.contains('stderr, 2') diff --git a/vlib/os/process_windows.c.v b/vlib/os/process_windows.c.v index 1d724949da..f0e053137a 100644 --- a/vlib/os/process_windows.c.v +++ b/vlib/os/process_windows.c.v @@ -50,10 +50,10 @@ pub mut: proc_info ProcessInformation command_line [65536]u8 child_stdin &u32 = unsafe { nil } - // + child_stdout_read &u32 = unsafe { nil } child_stdout_write &u32 = unsafe { nil } - // + child_stderr_read &u32 = unsafe { nil } child_stderr_write &u32 = unsafe { nil } } diff --git a/vlib/sokol/gfx/enums.v b/vlib/sokol/gfx/enums.v index c34758bee1..388a7f99a0 100644 --- a/vlib/sokol/gfx/enums.v +++ b/vlib/sokol/gfx/enums.v @@ -15,12 +15,12 @@ pub enum Backend { pub enum PixelFormat as u32 { _default // value 0 reserved for default-init @none - // + r8 r8sn r8ui r8si - // + r16 r16sn r16ui @@ -30,7 +30,7 @@ pub enum PixelFormat as u32 { rg8sn rg8ui rg8si - // + r32ui r32si r32f @@ -48,7 +48,7 @@ pub enum PixelFormat as u32 { rgb10a2 rg11b10f rgb9e5 - // + rg32ui rg32si rg32f @@ -57,16 +57,14 @@ pub enum PixelFormat as u32 { rgba16ui rgba16si rgba16f - // + rgba32ui rgba32si rgba32f - // - // - // + depth depth_stencil - // + bc1_rgba bc2_rgba bc3_rgba @@ -94,7 +92,7 @@ pub enum PixelFormat as u32 { eac_rg11sn astc_4x4_rgba astc_4x4_srgba - // + _num _force_u32 = 0x7FFFFFFF } diff --git a/vlib/sokol/gfx/gfx_structs.c.v b/vlib/sokol/gfx/gfx_structs.c.v index 99a057f6d1..35b4e3133b 100644 --- a/vlib/sokol/gfx/gfx_structs.c.v +++ b/vlib/sokol/gfx/gfx_structs.c.v @@ -532,7 +532,7 @@ pub type FrameStatsWGPU = C.sg_frame_stats_wgpu @[typedef] pub struct C.sg_frame_stats { frame_index u32 // current frame counter, starts at 0 - // + num_passes u32 num_apply_viewport u32 num_apply_scissor_rect u32 @@ -543,12 +543,12 @@ pub struct C.sg_frame_stats { num_update_buffer u32 num_append_buffer u32 num_update_image u32 - // + size_apply_uniforms u32 size_update_buffer u32 size_append_buffer u32 size_update_image u32 - // + gl FrameStatsGL d3d11 FrameStatsD3D11 metal FrameStatsMetal diff --git a/vlib/strconv/atof.c.v b/vlib/strconv/atof.c.v index ea00b918ab..5587ec3aad 100644 --- a/vlib/strconv/atof.c.v +++ b/vlib/strconv/atof.c.v @@ -236,7 +236,7 @@ fn converter(mut pn PrepNumber) u64 { mut r2 := u32(0) mut r1 := u32(0) mut r0 := u32(0) - // + mask28 := u32(u64(0xF) << 28) mut result := u64(0) // working on 3 u32 to have 96 bit precision diff --git a/vlib/strings/builder_test.js.v b/vlib/strings/builder_test.js.v index 48bcc31109..92fca34acd 100644 --- a/vlib/strings/builder_test.js.v +++ b/vlib/strings/builder_test.js.v @@ -28,7 +28,7 @@ fn test_sb() { assert res[res.len - 1] == `\n` println('"${res}"') assert res.trim_space() == 'x = 10 y = 20' - // + sb = strings.new_builder(10) sb.write_string('x = ${x} y = ${y}') assert sb.str() == 'x = 10 y = 20' diff --git a/vlib/strings/builder_test.v b/vlib/strings/builder_test.v index 59c4838af1..9ca8c354e7 100644 --- a/vlib/strings/builder_test.v +++ b/vlib/strings/builder_test.v @@ -28,7 +28,7 @@ fn test_sb() { assert res[res.len - 1] == `\n` println('"${res}"') assert res.trim_space() == 'x = 10 y = 20' - // + sb = strings.new_builder(10) sb.write_string('x = ${x} y = ${y}') assert sb.str() == 'x = 10 y = 20' diff --git a/vlib/strings/textscanner/textscanner_test.js.v b/vlib/strings/textscanner/textscanner_test.js.v index ef9f7b7cc4..ef91b42a44 100644 --- a/vlib/strings/textscanner/textscanner_test.js.v +++ b/vlib/strings/textscanner/textscanner_test.js.v @@ -71,7 +71,7 @@ fn test_peek() { assert s.peek() == `a` assert s.peek() == `a` assert s.peek() == `a` - // + assert s.next() == `a` assert s.next() == `b` assert s.next() == `c` @@ -85,7 +85,7 @@ fn test_peek_n() { assert s.peek_n(2) == `c` assert s.peek_n(3) == -1 assert s.peek_n(4) == -1 - // + assert s.next() == `a` assert s.next() == `b` assert s.next() == `c` diff --git a/vlib/strings/textscanner/textscanner_test.v b/vlib/strings/textscanner/textscanner_test.v index ef9f7b7cc4..ef91b42a44 100644 --- a/vlib/strings/textscanner/textscanner_test.v +++ b/vlib/strings/textscanner/textscanner_test.v @@ -71,7 +71,7 @@ fn test_peek() { assert s.peek() == `a` assert s.peek() == `a` assert s.peek() == `a` - // + assert s.next() == `a` assert s.next() == `b` assert s.next() == `c` @@ -85,7 +85,7 @@ fn test_peek_n() { assert s.peek_n(2) == `c` assert s.peek_n(3) == -1 assert s.peek_n(4) == -1 - // + assert s.next() == `a` assert s.next() == `b` assert s.next() == `c` diff --git a/vlib/sync/bench/many_writers_and_receivers_on_1_channel.v b/vlib/sync/bench/many_writers_and_receivers_on_1_channel.v index a5c9d538db..edffc6b812 100644 --- a/vlib/sync/bench/many_writers_and_receivers_on_1_channel.v +++ b/vlib/sync/bench/many_writers_and_receivers_on_1_channel.v @@ -26,10 +26,10 @@ mut: n_iters int n_readers int n_writers int - // + pops_wg &sync.WaitGroup pops []Event - // + pushes_wg &sync.WaitGroup pushes []Event } @@ -90,7 +90,6 @@ fn do_send(ch chan int, id int, mut ctx Context) { } fn main() { - // args := os.args[1..] if '-h' in args || '--help' in args { eprintln('Usage:\n many_writers_and_receivers_on_1_channel [-readers 1] [-writers 4] [-chan_cap 100] [-iterations 25000]') @@ -101,7 +100,7 @@ fn main() { n_writers := cmdline.option(args, '-writers', '4').int() chan_cap := cmdline.option(args, '-chan_cap', '100').int() eprintln('> n_iters, ${n_iters}, n_writers, ${n_writers}, n_readers, ${n_readers}, chan_cap, ${chan_cap}') - // + ch := chan int{cap: chan_cap} max_number_of_pushes := n_writers * (n_iters + 2) max_number_of_pops := max_number_of_pushes * n_readers diff --git a/vlib/term/term_test.v b/vlib/term/term_test.v index 4e559cadad..1338229558 100644 --- a/vlib/term/term_test.v +++ b/vlib/term/term_test.v @@ -62,19 +62,19 @@ fn test_get_cursor_position() { cursor_position_1 := term.get_cursor_position()! assert original_position.x == cursor_position_1.x assert original_position.y == cursor_position_1.y - // + term.set_cursor_position( x: 10 y: 11 ) cursor_position_2 := term.get_cursor_position()! - // + term.set_cursor_position( x: 5 y: 6 ) cursor_position_3 := term.get_cursor_position()! - // + term.set_cursor_position(original_position) eprintln('original_position: ${original_position}') eprintln('cursor_position_2: ${cursor_position_2}') diff --git a/vlib/time/duration_test.v b/vlib/time/duration_test.v index 66f6599b2d..87788e10c5 100644 --- a/vlib/time/duration_test.v +++ b/vlib/time/duration_test.v @@ -4,29 +4,29 @@ fn test_duration_str() { assert time.Duration(1 * time.nanosecond).str() == '1ns' assert time.Duration(999 * time.nanosecond).str() == '999ns' assert time.Duration(1000 * time.nanosecond).str() == '1.000us' - // + assert time.Duration(1 * time.microsecond).str() == '1.000us' assert time.Duration(999 * time.microsecond).str() == '999.000us' assert time.Duration(1000 * time.microsecond).str() == '1.000ms' - // + assert time.Duration(1 * time.second).str() == '1.000s' assert time.Duration(999 * time.second).str() == '16:39.000' assert time.Duration(1000 * time.second).str() == '16:40.000' - // + assert time.Duration(1 * time.minute).str() == '1:00.000' assert time.Duration(999 * time.minute).str() == '16:39:00' assert time.Duration(1000 * time.minute).str() == '16:40:00' - // + assert time.Duration(1 * time.hour).str() == '1:00:00' assert time.Duration(999 * time.hour).str() == '999:00:00' assert time.Duration(1000 * time.hour).str() == '1000:00:00' - // + assert time.Duration(1 * time.microsecond + 7 * time.nanosecond).str() == '1.007us' - // + assert time.Duration(1 * time.second + 5 * time.nanosecond).str() == '1.000s' assert time.Duration(1 * time.second + 5 * time.microsecond).str() == '1.000s' assert time.Duration(1 * time.second + 5 * time.millisecond).str() == '1.005s' - // + assert time.Duration(1 * time.hour + 5 * time.millisecond).str() == '1:00:00' assert time.Duration(1 * time.hour + 5 * time.second).str() == '1:00:05' assert time.Duration(168 * time.hour + 5 * time.minute + 7 * time.second).str() == '168:05:07' diff --git a/vlib/time/parse.c.v b/vlib/time/parse.c.v index 2c41cd3ac5..de25ae2776 100644 --- a/vlib/time/parse.c.v +++ b/vlib/time/parse.c.v @@ -80,7 +80,7 @@ pub fn parse(s string) !Time { hour_ := hms[0][1..] minute_ := hms[1] second_ := hms[2] - // + iyear := strconv.atoi(ymd[0]) or { return error_invalid_time(0, 'invalid year format: ${ymd[0]}') } diff --git a/vlib/time/parse_test.v b/vlib/time/parse_test.v index 316f88a542..1e76384e9f 100644 --- a/vlib/time/parse_test.v +++ b/vlib/time/parse_test.v @@ -159,13 +159,13 @@ fn check_invalid_date(s string) { fn test_invalid_dates_should_error_during_parse() { check_invalid_date('-99999-12-20 00:00:00') check_invalid_date('99999-12-20 00:00:00') - // + check_invalid_date('2008-00-20 00:00:00') check_invalid_date('2008-25-20 00:00:00') - // + check_invalid_date('2008-12-00 00:00:00') check_invalid_date('2008-12-32 00:00:00') - // + check_invalid_date('2008-12-01 30:00:00') check_invalid_date('2008-12-01 00:60:00') check_invalid_date('2008-12-01 00:01:60') diff --git a/vlib/time/stopwatch_test.v b/vlib/time/stopwatch_test.v index 6043864486..2d84e4b724 100644 --- a/vlib/time/stopwatch_test.v +++ b/vlib/time/stopwatch_test.v @@ -8,7 +8,7 @@ fn test_stopwatch_works_as_intended() { // sample code that you want to measure: println('Hello world') time.sleep(1 * time.millisecond) - // + println('Greeting the world took: ${sw.elapsed().nanoseconds()}ns') assert sw.elapsed().nanoseconds() > 0 } diff --git a/vlib/time/time.v b/vlib/time/time.v index 167002c158..96ef330b4f 100644 --- a/vlib/time/time.v +++ b/vlib/time/time.v @@ -46,7 +46,7 @@ pub: second int nanosecond int is_local bool // used to make time.now().local().local() == time.now().local() - // + microsecond int @[deprecated: 'use t.nanosecond / 1000 instead'; deprecated_after: '2023-08-05'] } diff --git a/vlib/time/time_test.v b/vlib/time/time_test.v index bf58b26abd..256bf2959e 100644 --- a/vlib/time/time_test.v +++ b/vlib/time/time_test.v @@ -237,14 +237,14 @@ fn test_add() { assert t2.nanosecond == t1.nanosecond + d_nanoseconds assert t2.unix() == t1.unix() + d_seconds assert t2.is_local == t1.is_local - // + t3 := local_time_to_test.add(-duration) // dump(t3.debug()) assert t3.second == t1.second - d_seconds assert t3.nanosecond == t1.nanosecond - d_nanoseconds assert t3.unix() == t1.unix() - d_seconds assert t3.is_local == t1.is_local - // + t4 := local_time_to_test.as_local() // dump(t4.debug()) t5 := t4.add(duration) @@ -319,14 +319,14 @@ fn test_unix_time() { eprintln(' ut1: ${ut1}') eprintln(' ut2: ${ut2}') assert ut2 - ut1 < 2 - // + utm1 := t1.unix_milli() utm2 := t2.unix_milli() eprintln('utm1: ${utm1}') eprintln('utm2: ${utm2}') assert (utm1 - ut1 * 1000) < 1000 assert (utm2 - ut2 * 1000) < 1000 - // + assert utm2 - utm1 > 2 assert utm2 - utm1 < 999 } @@ -334,7 +334,7 @@ fn test_unix_time() { fn test_offset() { u := time.utc() n := time.now() - // + mut diff_seconds := 0 if u.day != n.day { if u.day > n.day { diff --git a/vlib/toml/scanner/scanner_test.v b/vlib/toml/scanner/scanner_test.v index 7ac35e8781..8ba42cc671 100644 --- a/vlib/toml/scanner/scanner_test.v +++ b/vlib/toml/scanner/scanner_test.v @@ -50,7 +50,7 @@ fn test_at() { assert s.at() == `a` assert s.at() == `a` assert s.at() == `a` - // + assert s.next() == `a` assert s.next() == `b` assert s.next() == `c` @@ -64,7 +64,7 @@ fn test_peek() { assert s.peek(2) == `c` assert s.peek(3) == scanner.end_of_text assert s.peek(4) == scanner.end_of_text - // + assert s.next() == `a` assert s.next() == `b` assert s.next() == `c` diff --git a/vlib/toml/tests/burntsushi_toml_test.v b/vlib/toml/tests/burntsushi_toml_test.v index cbbe9850e8..a5435ac24b 100644 --- a/vlib/toml/tests/burntsushi_toml_test.v +++ b/vlib/toml/tests/burntsushi_toml_test.v @@ -121,7 +121,7 @@ fn test_burnt_sushi_tomltest() { invalid_folder := 'invalid' invalid_test_files := os.walk_ext('${test_root}/invalid', '.toml').map(it.replace('\\', '/')).sorted() - // + println('\nTesting ${valid_test_files.len} valid TOML files...') mut valid := 0 mut e := 0 diff --git a/vlib/toml/tests/key_test.v b/vlib/toml/tests/key_test.v index 677a2d8513..167b93b2d8 100644 --- a/vlib/toml/tests/key_test.v +++ b/vlib/toml/tests/key_test.v @@ -22,7 +22,7 @@ fn test_keys() { out_file_json := os.read_file(path_by_extension('out'))! println(toml_json) assert toml_json == out_file_json - // + if x := toml_doc.value_opt('unknown key') { assert false } else { diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index 38d2bf91ee..610452e899 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -504,7 +504,7 @@ pub enum StructInitKind { pub struct Import { pub: source_name string // The original name in the source, `import abc.def` -> 'abc.def', *no matter* how the module is resolved - // + mod string // the module name of the import alias string // the `x` in `import xxx as x` pos token.Pos diff --git a/vlib/v/ast/str.v b/vlib/v/ast/str.v index 745feadf5d..0e8992a994 100644 --- a/vlib/v/ast/str.v +++ b/vlib/v/ast/str.v @@ -302,7 +302,7 @@ fn shorten_full_name_based_on_aliases(input string, m2a map[string]string) strin if replacements.len == 0 { return input } - // + mut res := input if replacements.len > 1 { replacements.sort(a.weight > b.weight) diff --git a/vlib/v/builder/builder.v b/vlib/v/builder/builder.v index 6a2ec03d61..3f8a71994c 100644 --- a/vlib/v/builder/builder.v +++ b/vlib/v/builder/builder.v @@ -37,7 +37,6 @@ pub mut: //} table &ast.Table = unsafe { nil } ccoptions CcompilerOptions - // // Note: changes in mod `builtin` force invalidation of every other .v file mod_invalidates_paths map[string][]string // changes in mod `os`, invalidate only .v files, that do `import os` mod_invalidates_mods map[string][]string // changes in mod `os`, force invalidation of mods, that do `import os` @@ -141,7 +140,7 @@ pub fn (mut b Builder) middle_stages() ! { util.timing_start('TRANSFORM') b.transformer.transform_files(b.parsed_files) util.timing_measure('TRANSFORM') - // + b.table.complete_interface_check() if b.pref.skip_unused { markused.mark_used(mut b.table, mut b.pref, b.parsed_files) @@ -565,7 +564,7 @@ pub fn (mut b Builder) print_warnings_and_errors() { util.show_compiler_message(kind, err.CompilerMessage) } } - // + if b.pref.is_verbose && b.checker.nr_errors > 1 { println('${b.checker.nr_errors} errors') } diff --git a/vlib/v/builder/cbuilder/parallel_cc.v b/vlib/v/builder/cbuilder/parallel_cc.v index 94a42e40b1..7d8172d0de 100644 --- a/vlib/v/builder/cbuilder/parallel_cc.v +++ b/vlib/v/builder/cbuilder/parallel_cc.v @@ -49,7 +49,7 @@ fn parallel_cc(mut b builder.Builder, header string, res string, out_str string, for i in 0 .. c_files { out_files[i].close() } - // + sw := time.new_stopwatch() mut o_postfixes := ['0', 'x'] for i in 0 .. c_files { diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index f12738c4e1..0cd0bb24d8 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -113,13 +113,13 @@ struct CcompilerOptions { mut: guessed_compiler string shared_postfix string // .so, .dll - // + debug_mode bool cc CC - // + env_cflags string // prepended *before* everything else env_ldflags string // appended *after* everything else - // + args []string // ordinary C options like `-O2` wargs []string // for `-Wxyz` *exclusively* pre_args []string // options that should go before .o_args @@ -132,7 +132,7 @@ mut: fn (mut v Builder) setup_ccompiler_options(ccompiler string) { mut ccoptions := CcompilerOptions{} - // + mut debug_options := ['-g'] mut optimization_options := ['-O2'] // arguments for the C compiler @@ -263,7 +263,7 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) { } optimization_options = ['-Ofast'] } - // + if ccoptions.debug_mode { ccoptions.args << debug_options } @@ -287,7 +287,7 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) { if v.pref.is_o { ccoptions.args << '-c' } - // + ccoptions.shared_postfix = '.so' if v.pref.os == .macos { ccoptions.shared_postfix = '.dylib' @@ -606,7 +606,7 @@ pub fn (mut v Builder) cc() { return } } - // + vexe := pref.vexe_path() vdir := os.dir(vexe) mut tried_compilation_commands := []string{} @@ -948,7 +948,7 @@ fn (mut c Builder) cc_windows_cross() { eprintln('See https://github.com/vlang/v/blob/master/doc/docs.md#cross-compilation for instructions on how to fix that.') exit(1) } - // + c.setup_ccompiler_options(c.pref.ccompiler) c.build_thirdparty_obj_files() c.setup_output_name() @@ -956,7 +956,7 @@ fn (mut c Builder) cc_windows_cross() { args << '${c.pref.cflags}' args << '-o ${os.quoted_path(c.pref.out_name)}' args << '-w -L.' - // + cflags := c.get_os_cflags() // -I flags if c.pref.ccompiler == 'msvc' { @@ -999,14 +999,14 @@ fn (mut c Builder) cc_windows_cross() { println(builder.current_os) panic('your platform is not supported yet') } - // + mut all_args := []string{} all_args << '-std=gnu11' all_args << optimization_options all_args << debug_options - // + all_args << args - // + all_args << '-municode' all_args << c.ccoptions.linker_flags all_args << '${c.pref.ldflags}' @@ -1077,7 +1077,7 @@ fn (mut v Builder) build_thirdparty_obj_file(mod string, path string, moduleflag // prepare for tcc, it needs relative paths to thirdparty/tcc to work: current_folder := os.getwd() os.chdir(v.pref.vroot) or {} - // + mut all_options := []string{} all_options << v.pref.third_party_option all_options << moduleflags.c_options_before_target() diff --git a/vlib/v/builder/interpreterbuilder/v_interpret_test.v b/vlib/v/builder/interpreterbuilder/v_interpret_test.v index 60f1a857cc..fe9e0de193 100644 --- a/vlib/v/builder/interpreterbuilder/v_interpret_test.v +++ b/vlib/v/builder/interpreterbuilder/v_interpret_test.v @@ -14,7 +14,7 @@ fn interp_test(expression string, expected string) ! { defer { os.rmdir_all(tmpdir) or {} } - // + tmpfile := os.join_path(tmpdir, 'input.v') outfile := os.join_path(tmpdir, 'output.txt') os.write_file(tmpfile, interpreter_wrap(expression))! diff --git a/vlib/v/builder/msvc_windows.v b/vlib/v/builder/msvc_windows.v index e2666f2525..6a45d89a48 100644 --- a/vlib/v/builder/msvc_windows.v +++ b/vlib/v/builder/msvc_windows.v @@ -258,13 +258,13 @@ pub fn (mut v Builder) cc_msvc() { out_name_pdb := os.real_path(v.out_name_c + '.pdb') out_name_cmd_line := os.real_path(v.out_name_c + '.rsp') mut a := []string{} - // + env_cflags := os.getenv('CFLAGS') mut all_cflags := '${env_cflags} ${v.pref.cflags}' if all_cflags != ' ' { a << all_cflags } - // + // Default arguments // `-w` no warnings // `/we4013` 2 unicode defines, see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4013?redirectedfrom=MSDN&view=msvc-170 @@ -406,7 +406,7 @@ fn (mut v Builder) build_thirdparty_obj_file_with_msvc(mod string, path string, flags := msvc_string_flags(moduleflags) inc_dirs := flags.inc_paths.join(' ') defines := flags.defines.join(' ') - // + mut oargs := []string{} env_cflags := os.getenv('CFLAGS') mut all_cflags := '${env_cflags} ${v.pref.cflags}' @@ -415,7 +415,7 @@ fn (mut v Builder) build_thirdparty_obj_file_with_msvc(mod string, path string, } oargs << '/NOLOGO' oargs << '/volatile:ms' - // + if v.pref.is_prod { oargs << '/O2' oargs << '/MD' diff --git a/vlib/v/builder/rebuilding.v b/vlib/v/builder/rebuilding.v index 6d48b0d049..a94d384cf6 100644 --- a/vlib/v/builder/rebuilding.v +++ b/vlib/v/builder/rebuilding.v @@ -34,7 +34,7 @@ pub fn (mut b Builder) find_invalidated_modules_by_files(all_files []string) []s mut new_hashes := map[string]string{} mut old_hashes := map[string]string{} mut sb_new_hashes := strings.new_builder(1024) - // + mut cm := vcache.new_cache_manager(all_files) sold_hashes := cm.load('.hashes', 'all_files') or { ' ' } // eprintln(sold_hashes) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index b21f63ee6a..983b397b19 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -42,10 +42,10 @@ pub const vroot_is_deprecated_message = '@VROOT is deprecated, use @VMODROOT or pub struct Checker { pub mut: pref &pref.Preferences = unsafe { nil } // Preferences shared from V struct - // + table &ast.Table = unsafe { nil } file &ast.File = unsafe { nil } - // + nr_errors int nr_warnings int nr_notices int @@ -57,7 +57,7 @@ pub mut: notice_lines map[string]bool // dedup notices error_details []string should_abort bool // when too many errors/warnings/notices are accumulated, .should_abort becomes true. It is checked in statement/expression loops, so the checker can return early, instead of wasting time. - // + expected_type ast.Type expected_or_type ast.Type // fn() or { 'this type' } eg. string. expected or block type expected_expr_type ast.Type // if/match is_expr: expected_type @@ -135,7 +135,7 @@ mut: variant_data_type ast.Type fn_return_type ast.Type orm_table_fields map[string][]ast.StructField // known table structs - // + v_current_commit_hash string // same as old C.V_CURRENT_COMMIT_HASH assign_stmt_attr string // for `x := [1,2,3] @[freed]` } diff --git a/vlib/v/compiler_errors_test.v b/vlib/v/compiler_errors_test.v index 4705db317e..9fc9390b5c 100644 --- a/vlib/v/compiler_errors_test.v +++ b/vlib/v/compiler_errors_test.v @@ -87,7 +87,7 @@ fn test_all() { global_run_dir := '${checker_dir}/globals_run' run_dir := '${checker_dir}/run' skip_unused_dir := 'vlib/v/tests/skip_unused' - // + checker_tests := get_tests_in_dir(checker_dir, false).filter(!it.contains('with_check_option')) parser_tests := get_tests_in_dir(parser_dir, false) scanner_tests := get_tests_in_dir(scanner_dir, false) @@ -115,7 +115,7 @@ fn test_all() { tasks.add('', checker_with_check_option_dir, '-check', '.out', checker_with_check_option_tests, false) tasks.run() - // + if os.user_os() == 'linux' { mut skip_unused_tasks := Tasks{ vexe: vexe @@ -128,7 +128,7 @@ fn test_all() { '.skip_unused.run.out', skip_unused_dir_tests, false) skip_unused_tasks.run() } - // + if github_job == 'ubuntu-tcc' { // This is done with tcc only, because the error output is compiler specific. // Note: the tasks should be run serially, since they depend on diff --git a/vlib/v/eval/eval.v b/vlib/v/eval/eval.v index f99fd29022..cda753e8d3 100644 --- a/vlib/v/eval/eval.v +++ b/vlib/v/eval/eval.v @@ -66,7 +66,7 @@ pub mut: return_values []Object cur_mod string cur_file string - // + trace_file_paths []string trace_function_names []string back_trace []EvalTrace @@ -97,7 +97,7 @@ pub fn (mut e Eval) run_func(func ast.FnDecl, _args ...Object) { e.back_trace.pop() } is_main := func.name == 'main.main' - // + mut args := _args.clone() if !is_main && func.params.len != args.len && !func.is_variadic { e.error('mismatched parameter length for ${func.name}: got `${args.len}`, expected `${func.params.len}`') diff --git a/vlib/v/eval/interpret_test.v b/vlib/v/eval/interpret_test.v index df8b877ca0..1fc91deef6 100644 --- a/vlib/v/eval/interpret_test.v +++ b/vlib/v/eval/interpret_test.v @@ -11,7 +11,7 @@ fn test_interpret() { os.chdir(vroot)! dir := os.join_path(vroot, 'vlib/v/eval/testdata') files := os.ls(dir)! - // + tests := files.filter(it.ends_with('.vv')) if tests.len == 0 { println('no interpreter tests found') diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 8f03ab4726..0b32ec8c2e 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -507,7 +507,7 @@ pub fn gen(files []&ast.File, mut table ast.Table, pref_ &pref.Preferences) (str g.definitions.writeln('int _v_type_idx_${sym.cname}() { return ${idx}; };') } } - // + // v files are finished, what remains is pure C code g.gen_vlines_reset() if g.pref.build_mode != .build_module { diff --git a/vlib/v/gen/c/cmain.v b/vlib/v/gen/c/cmain.v index 45108b16fe..259e01338f 100644 --- a/vlib/v/gen/c/cmain.v +++ b/vlib/v/gen/c/cmain.v @@ -301,7 +301,7 @@ pub fn (mut g Gen) gen_c_main_for_tests() { g.writeln('\t_vinit(___argc, (voidptr)___argv);') g.writeln('\tmain__vtest_init();') g.gen_c_main_profile_hook() - // + mut all_tfuncs := g.get_all_test_function_names() all_tfuncs = g.filter_only_matching_fn_names(all_tfuncs) g.writeln('\tstring v_test_file = ${ctoslit(g.pref.path)};') @@ -350,7 +350,7 @@ pub fn (mut g Gen) gen_c_main_for_tests() { g.writeln('') g.writeln('\t_vtrunner._method_finish(_vtobj);') g.writeln('\tint test_exit_code = _vtrunner._method_exit_code(_vtobj);') - // + g.writeln('\t_vtrunner._method__v_free(_vtobj);') g.writeln('') g.writeln('\t_vcleanup();') diff --git a/vlib/v/gen/c/fn.v b/vlib/v/gen/c/fn.v index fddea8e4fe..27b08c70c1 100644 --- a/vlib/v/gen/c/fn.v +++ b/vlib/v/gen/c/fn.v @@ -345,7 +345,6 @@ fn (mut g Gen) gen_fn_decl(node &ast.FnDecl, skip bool) { } } - // if is_live_wrap { if is_livemain { g.definitions.write_string('${type_name} (* ${impl_fn_name})(') diff --git a/vlib/v/gen/c/live.v b/vlib/v/gen/c/live.v index 570dfc6e06..281f4f5155 100644 --- a/vlib/v/gen/c/live.v +++ b/vlib/v/gen/c/live.v @@ -84,7 +84,7 @@ fn (mut g Gen) generate_hotcode_reloading_main_caller() { ccompiler := '-cc ${ccpath}' so_debug_flag := if g.pref.is_debug { '-cg' } else { '' } vopts := '${ccompiler} ${so_debug_flag} -sharedlive -shared' - // + g.writeln('\t\t// start background reloading thread') if g.pref.os == .windows { g.writeln('\t\tlive_fn_mutex = CreateMutexA(0, 0, 0);') diff --git a/vlib/v/gen/c/str_intp.v b/vlib/v/gen/c/str_intp.v index 1a0829b3f4..cfe5ea970b 100644 --- a/vlib/v/gen/c/str_intp.v +++ b/vlib/v/gen/c/str_intp.v @@ -156,7 +156,7 @@ fn (mut g Gen) str_format(node ast.StringInterLiteral, i int, fmts []u8) (u64, s } res := get_str_intp_u32_format(fmt_type, node.fwidths[i], node.precisions[i], remove_tail_zeros, node.pluss[i], u8(pad_ch), base, upper_case) - // + return res, fmt_type.str() } diff --git a/vlib/v/gen/golang/tests/golang_test.v b/vlib/v/gen/golang/tests/golang_test.v index 4561362900..34b0c31df4 100644 --- a/vlib/v/gen/golang/tests/golang_test.v +++ b/vlib/v/gen/golang/tests/golang_test.v @@ -18,7 +18,7 @@ fn test_golang() { vroot := os.dir(vexe) dir := os.join_path(vroot, 'vlib/v/gen/golang/tests') files := os.ls(dir) or { panic(err) } - // + wrkdir := os.join_path(os.vtmp_dir(), 'golang_tests') os.mkdir_all(wrkdir) or { panic(err) } defer { diff --git a/vlib/v/gen/native/gen.v b/vlib/v/gen/native/gen.v index b341b81fd7..53f2289696 100644 --- a/vlib/v/gen/native/gen.v +++ b/vlib/v/gen/native/gen.v @@ -1091,7 +1091,7 @@ fn (mut g Gen) println(comment string) { sb.write_string(hexstr) } g.debug_pos = i32(g.buf.len) - // + colored := sb.str() plain := term.strip_ansi(colored) padding := ' '.repeat(mu.max(1, 40 - plain.len)) diff --git a/vlib/v/gen/native/macho.v b/vlib/v/gen/native/macho.v index 9040da1ccf..bee6f079a5 100644 --- a/vlib/v/gen/native/macho.v +++ b/vlib/v/gen/native/macho.v @@ -326,7 +326,7 @@ pub fn (mut g Gen) generate_macho_object_header() { g.write32(0) // lc_symtab g.sym_table_command() - // + g.macho_add_loadcommand(native.lc_dysymtab, native.macho_d_size) g.write32(0) g.write32(2) diff --git a/vlib/v/gen/native/tests/native_test.v b/vlib/v/gen/native/tests/native_test.v index b029843827..e1cd497e27 100644 --- a/vlib/v/gen/native/tests/native_test.v +++ b/vlib/v/gen/native/tests/native_test.v @@ -20,7 +20,7 @@ fn test_native() { vroot := os.dir(vexe) dir := os.join_path(vroot, 'vlib', 'v', 'gen', 'native', 'tests') files := os.ls(dir) or { panic(err) } - // + wrkdir := os.join_path(os.vtmp_dir(), 'native_tests') os.mkdir_all(wrkdir) or { panic(err) } defer { diff --git a/vlib/v/gen/wasm/gen.v b/vlib/v/gen/wasm/gen.v index 049261f90b..89c68d5196 100644 --- a/vlib/v/gen/wasm/gen.v +++ b/vlib/v/gen/wasm/gen.v @@ -25,7 +25,7 @@ mut: table &ast.Table = unsafe { nil } eval eval.Eval enum_vals map[string]Enum - // + mod wasm.Module pool serialise.Pool func wasm.Function diff --git a/vlib/v/gen/wasm/tests/wasm_test.v b/vlib/v/gen/wasm/tests/wasm_test.v index bc8f38d360..04b36c47c7 100644 --- a/vlib/v/gen/wasm/tests/wasm_test.v +++ b/vlib/v/gen/wasm/tests/wasm_test.v @@ -31,7 +31,7 @@ fn test_wasm() { vroot := os.dir(vexe) dir := os.join_path(vroot, 'vlib/v/gen/wasm/tests') files := os.ls(dir)! - // + wrkdir := os.join_path(os.vtmp_dir(), 'wasm_tests') os.mkdir_all(wrkdir)! defer { diff --git a/vlib/v/live/executable/reloader.c.v b/vlib/v/live/executable/reloader.c.v index 210498b106..c389422d0a 100644 --- a/vlib/v/live/executable/reloader.c.v +++ b/vlib/v/live/executable/reloader.c.v @@ -103,18 +103,18 @@ fn load_lib(mut r live.LiveReloadInfo, new_lib_path string) { elog(r, 'live mutex locking...') C.pthread_mutex_lock(r.live_fn_mutex) elog(r, 'live mutex locked') - // + if r.cb_locked_before != unsafe { nil } { r.cb_locked_before(r) } - // + protected_load_lib(mut r, new_lib_path) - // + r.reloads_ok++ if r.cb_locked_after != unsafe { nil } { r.cb_locked_after(r) } - // + elog(r, 'live mutex unlocking...') C.pthread_mutex_unlock(r.live_fn_mutex) elog(r, 'live mutex unlocked') diff --git a/vlib/v/live/live_test.v b/vlib/v/live/live_test.v index 5ab1c2156c..da2b51b300 100644 --- a/vlib/v/live/live_test.v +++ b/vlib/v/live/live_test.v @@ -175,7 +175,7 @@ fn test_live_program_can_be_compiled() { compile_cmd := '${os.quoted_path(vexe)} -cg -keepc -nocolor -live -o ${os.quoted_path(genexe_file)} ${os.quoted_path(main_source_file)}' eprintln('> compile_cmd: ${compile_cmd}') os.system(compile_cmd) - // + cmd := '${os.quoted_path(genexe_file)} > /dev/null &' eprintln('Running with: ${cmd}') res := os.system(cmd) diff --git a/vlib/v/markused/walker.v b/vlib/v/markused/walker.v index f6c8963867..304e602826 100644 --- a/vlib/v/markused/walker.v +++ b/vlib/v/markused/walker.v @@ -530,7 +530,7 @@ pub fn (mut w Walker) call_expr(mut node ast.CallExpr) { } w.expr(node.left) w.or_block(node.or_block) - // + fn_name := node.fkey() if w.used_fns[fn_name] { return diff --git a/vlib/v/parser/tmpl.v b/vlib/v/parser/tmpl.v index 817e8fd235..925eea4d41 100644 --- a/vlib/v/parser/tmpl.v +++ b/vlib/v/parser/tmpl.v @@ -232,13 +232,13 @@ fn vweb_tmpl_${fn_name}() string { ') source.write_string(tmpl_str_start) - // + mut state := State.simple template_ext := os.file_ext(template_file) if template_ext.to_lower() == '.html' { state = .html } - // + mut in_span := false mut end_of_line_pos := 0 mut start_of_line_pos := 0 diff --git a/vlib/v/pref/default.v b/vlib/v/pref/default.v index 0d408e88f0..b24586f747 100644 --- a/vlib/v/pref/default.v +++ b/vlib/v/pref/default.v @@ -21,7 +21,7 @@ fn (mut p Preferences) expand_lookup_paths() { } p.vlib = os.join_path(p.vroot, 'vlib') p.vmodules_paths = os.vmodules_paths() - // + if p.lookup_path.len == 0 { p.lookup_path = ['@vlib', '@vmodules'] } @@ -143,7 +143,7 @@ pub fn (mut p Preferences) fill_with_defaults() { // No OS specified? Use current system p.os = if p.backend != .wasm { get_host_os() } else { .wasi } } - // + p.try_to_use_tcc_by_default() if p.ccompiler == '' { p.default_c_compiler() diff --git a/vlib/v/pref/options_test.v b/vlib/v/pref/options_test.v index cbc1214320..ecf5894c10 100644 --- a/vlib/v/pref/options_test.v +++ b/vlib/v/pref/options_test.v @@ -22,20 +22,20 @@ fn test_cflags() { debug_arg = '/MDd /D_DEBUG' optimised_arg = '/O1' } - // + println('> test whether -cflags is passed to the backend C compiler') fail := custom_compile('failing.exe', 'NONSENSE_OPTION') assert fail.compilation.exit_code != 0 println('> NONSENSE_OPTION failed the C build, OK') - // + dbg := custom_compile('debug_hw.exe', debug_arg) assert dbg.compilation.exit_code == 0 assert dbg.file_size > 0 - // + opt := custom_compile('optimised_hw.exe', optimised_arg) assert opt.compilation.exit_code == 0 assert opt.file_size > 0 - // + $if !tinyc { // tcc does almost no optimisations, so the differences are very insignificant // optimised_file_size should be smaller in general, but not on the Ubuntu CI for some reason :-| diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 88e4a8c1ba..ffeb2f60f7 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -185,22 +185,21 @@ pub mut: path string // Path to file/folder to compile line_info string // `-line-info="file.v:28"`: for "mini VLS" (shows information about objects on provided line) linfo LineInfo - // + run_only []string // VTEST_ONLY_FN and -run-only accept comma separated glob patterns. exclude []string // glob patterns for excluding .v files from the list of .v files that otherwise would have been used for a compilation, example: `-exclude @vlib/math/*.c.v` // Only test_ functions that match these patterns will be run. -run-only is valid only for _test.v files. - // // -d vfmt and -d another=0 for `$if vfmt { will execute }` and `$if another ? { will NOT get here }` compile_defines []string // just ['vfmt'] compile_defines_all []string // contains both: ['vfmt','another'] compile_values map[string]string // the map will contain for `-d key=value`: compile_values['key'] = 'value', and for `-d ident`, it will be: compile_values['ident'] = 'true' - // + run_args []string // `v run x.v 1 2 3` => `1 2 3` printfn_list []string // a list of generated function names, whose source should be shown, for debugging - // + print_v_files bool // when true, just print the list of all parsed .v files then stop. print_watched_files bool // when true, just print the list of all parsed .v files + all the compiled $tmpl files, then stop. Used by `v watch run webserver.v` - // + skip_running bool // when true, do no try to run the produced file (set by b.cc(), when -o x.c or -o x.js) skip_warnings bool // like C's "-w", forces warnings to be ignored. skip_notes bool // force notices to be ignored/not shown. @@ -211,14 +210,14 @@ pub mut: reuse_tmpc bool // do not use random names for .tmp.c and .tmp.c.rsp files, and do not remove them no_rsp bool // when true, pass C backend options directly on the CLI (do not use `.rsp` files for them, some older C compilers do not support them) no_std bool // when true, do not pass -std=gnu99(linux)/-std=c99 to the C backend - // + no_parallel bool // do not use threads when compiling; slower, but more portable and sometimes less buggy parallel_cc bool // whether to split the resulting .c file into many .c files + a common .h file, that are then compiled in parallel, then linked together. only_check_syntax bool // when true, just parse the files, then stop, before running checker check_only bool // same as only_check_syntax, but also runs the checker experimental bool // enable experimental features skip_unused bool // skip generating C code for functions, that are not used - // + use_color ColorOutput // whether the warnings/errors should use ANSI color escapes. cleanup_files []string // list of temporary *.tmp.c and *.tmp.c.rsp files. Cleaned up on successful builds. build_options []string // list of options, that should be passed down to `build-module`, if needed for -usecache @@ -289,11 +288,11 @@ fn run_code_in_tmp_vfile_and_exit(args []string, mut res Preferences, option_nam command_options := cmdline.options_after(args, [option_name])[1..].join(' ') vexe := vexe_path() tmp_cmd := '${os.quoted_path(vexe)} ${output_option} ${run_options} run ${os.quoted_path(tmp_v_file_path)} ${command_options}' - // + res.vrun_elog('tmp_cmd: ${tmp_cmd}') tmp_result := os.system(tmp_cmd) res.vrun_elog('exit code: ${tmp_result}') - // + if output_option != '' { res.vrun_elog('remove tmp exe file: ${tmp_exe_file_path}') os.rm(tmp_exe_file_path) or {} diff --git a/vlib/v/pref/should_compile.v b/vlib/v/pref/should_compile.v index bced1b51e8..aa5a7101e4 100644 --- a/vlib/v/pref/should_compile.v +++ b/vlib/v/pref/should_compile.v @@ -85,7 +85,7 @@ pub fn (prefs &Preferences) should_compile_filtered_files(dir string, files_ []s } all_v_files << os.join_path(dir, file) } - // + mut defaults := []string{} mut fnames_no_postfixes := map[string][]string{} for file in all_v_files { @@ -183,18 +183,18 @@ pub fn (prefs &Preferences) should_compile_c(file string) bool { if prefs.os != .windows && (file.ends_with('_windows.c.v') || file.ends_with('_windows.v')) { return false } - // + if prefs.os != .linux && (file.ends_with('_linux.c.v') || file.ends_with('_linux.v')) { return false } - // + if prefs.os != .macos && (file.ends_with('_darwin.c.v') || file.ends_with('_darwin.v')) { return false } if prefs.os != .macos && (file.ends_with('_macos.c.v') || file.ends_with('_macos.v')) { return false } - // + if prefs.os != .ios && (file.ends_with('_ios.c.v') || file.ends_with('_ios.v')) { return false } diff --git a/vlib/v/preludes/test_runner_dump.v b/vlib/v/preludes/test_runner_dump.v index 1b28d1d658..7601c70531 100644 --- a/vlib/v/preludes/test_runner_dump.v +++ b/vlib/v/preludes/test_runner_dump.v @@ -16,13 +16,13 @@ mut: fname string plan_tests int test_counter int - // + file_test_info VTestFileMetaInfo fn_test_info VTestFnMetaInfo fn_assert_passes u64 fn_passes u64 fn_fails u64 - // + total_assert_passes u64 total_assert_fails u64 } diff --git a/vlib/v/preludes/test_runner_normal.v b/vlib/v/preludes/test_runner_normal.v index 89e3271794..dee277b187 100644 --- a/vlib/v/preludes/test_runner_normal.v +++ b/vlib/v/preludes/test_runner_normal.v @@ -20,14 +20,13 @@ pub mut: use_color bool use_relative_paths bool all_assertsions []&VAssertMetaInfo - // mut: file_test_info VTestFileMetaInfo fn_test_info VTestFnMetaInfo fn_assert_passes u64 fn_passes u64 fn_fails u64 - // + total_assert_passes u64 total_assert_fails u64 } diff --git a/vlib/v/preludes/test_runner_simple.v b/vlib/v/preludes/test_runner_simple.v index 8ee7c3081f..ba52068389 100644 --- a/vlib/v/preludes/test_runner_simple.v +++ b/vlib/v/preludes/test_runner_simple.v @@ -9,13 +9,13 @@ fn vtest_init() { struct SimpleTestRunner { mut: fname string - // + file_test_info VTestFileMetaInfo fn_test_info VTestFnMetaInfo fn_assert_passes u64 fn_passes u64 fn_fails u64 - // + total_assert_passes u64 total_assert_fails u64 } diff --git a/vlib/v/preludes/test_runner_tap.v b/vlib/v/preludes/test_runner_tap.v index a016588a9d..f712c13518 100644 --- a/vlib/v/preludes/test_runner_tap.v +++ b/vlib/v/preludes/test_runner_tap.v @@ -25,13 +25,13 @@ mut: fname string plan_tests int test_counter int - // + file_test_info VTestFileMetaInfo fn_test_info VTestFnMetaInfo fn_assert_passes u64 fn_passes u64 fn_fails u64 - // + total_assert_passes u64 total_assert_fails u64 } diff --git a/vlib/v/slow_tests/assembly/asm_test.amd64.v b/vlib/v/slow_tests/assembly/asm_test.amd64.v index 98b78e64d7..2efba7dc01 100644 --- a/vlib/v/slow_tests/assembly/asm_test.amd64.v +++ b/vlib/v/slow_tests/assembly/asm_test.amd64.v @@ -217,7 +217,7 @@ fn test_asm_generic() { u := u64(49) assert generic_asm(u) == 14 assert u == 63 - // + i := i32(123) assert generic_asm(i) == 14 assert i == 137 diff --git a/vlib/v/slow_tests/valgrind/1.strings_and_arrays.v b/vlib/v/slow_tests/valgrind/1.strings_and_arrays.v index a91160d1c0..7c5b01fd4f 100644 --- a/vlib/v/slow_tests/valgrind/1.strings_and_arrays.v +++ b/vlib/v/slow_tests/valgrind/1.strings_and_arrays.v @@ -85,7 +85,7 @@ fn str_replace() { mut s := 'hello world' s = s.replace('hello', 'hi') // s can't be freed as usual before the assignment, since it's used in the right expr println(s) - // + mut s2 := 'aa' + 'bb' s2 = s2.replace('a', 'c') println(s2) @@ -115,7 +115,7 @@ fn reassign_str() { } mut x := 'a' x = 'b' // nothing has to be freed here - // + mut s := 'a' + 'b' s = 'x' + 'y' // 'a' + 'b' must be freed before the re-assignment s = s + '!' // old s ref must be copied and freed after the assignment, since s is still used in the right expr diff --git a/vlib/v/slow_tests/valgrind/base64.v b/vlib/v/slow_tests/valgrind/base64.v index 23ab8efe3b..3177967b9f 100644 --- a/vlib/v/slow_tests/valgrind/base64.v +++ b/vlib/v/slow_tests/valgrind/base64.v @@ -18,7 +18,7 @@ fn main() { unsafe { free(ebuffer) } unsafe { free(dbuffer) } } - // + encoded_size := base64.encode_in_buffer(s_original, ebuffer) mut encoded_in_buf := []u8{len: encoded_size} unsafe { vmemcpy(encoded_in_buf.data, ebuffer, encoded_size) } diff --git a/vlib/v/slow_tests/valgrind/valgrind_test.v b/vlib/v/slow_tests/valgrind/valgrind_test.v index 2fa53748a9..00bb672b8a 100644 --- a/vlib/v/slow_tests/valgrind/valgrind_test.v +++ b/vlib/v/slow_tests/valgrind/valgrind_test.v @@ -66,11 +66,11 @@ fn test_all() { dir := os.join_path(vroot, valgrind_test_path) mut files := os.ls(dir) or { panic(err) } files.sort() - // + wrkdir := os.join_path(os.vtmp_dir(), 'valgrind_tests') os.mkdir_all(wrkdir) or { panic(err) } os.chdir(wrkdir) or {} - // + only_ordinary_v_files := files.filter(it.ends_with('.v') && !it.ends_with('_test.v')) tests := vtest.filter_vtest_only(only_ordinary_v_files, basepath: valgrind_test_path) bench.set_total_expected_steps(tests.len) diff --git a/vlib/v/tests/alias_basic_types_test.v b/vlib/v/tests/alias_basic_types_test.v index 91813a50f9..4846497bc8 100644 --- a/vlib/v/tests/alias_basic_types_test.v +++ b/vlib/v/tests/alias_basic_types_test.v @@ -77,12 +77,12 @@ fn test_modifying_a_struct_using_an_alias_to_int() { my_struct.a += 5 my_struct.b += 10 my_struct.c += 'abc' - // + my_struct.a += 3 my_struct.b += 20 my_struct.c += 'def' println(my_struct) - // + assert my_struct.a == 8 assert my_struct.b == 30 assert my_struct.c == 'abcdef' diff --git a/vlib/v/tests/arrays_and_maps_of_empty_structs_should_work_test.v b/vlib/v/tests/arrays_and_maps_of_empty_structs_should_work_test.v index 9eef41b43b..43be8701f0 100644 --- a/vlib/v/tests/arrays_and_maps_of_empty_structs_should_work_test.v +++ b/vlib/v/tests/arrays_and_maps_of_empty_structs_should_work_test.v @@ -7,7 +7,7 @@ fn test_array_append_empty_struct() { names << EmptyStruct{} dump(names) assert (EmptyStruct{} in names) == true - // + mut fa := [EmptyStruct{}, EmptyStruct{}]! assert fa.len == 2 dump(fa[0]) diff --git a/vlib/v/tests/bench/bench_string_key_in_map_vs_string_value_in_array.v b/vlib/v/tests/bench/bench_string_key_in_map_vs_string_value_in_array.v index 6bcb6b7deb..4e8ed7bb76 100644 --- a/vlib/v/tests/bench/bench_string_key_in_map_vs_string_value_in_array.v +++ b/vlib/v/tests/bench/bench_string_key_in_map_vs_string_value_in_array.v @@ -35,7 +35,7 @@ fn main() { eprintln('> m.len: ${m.len} | a_as_first.len: ${a_as_first.len} | a_as_last.len: ${a_as_last.len} | a_as_middle.len: ${a_as_middle.len}') mut b := benchmark.start() - // + sum = 0 for _ in 0 .. max_iterations { sum += int(m[key]) @@ -48,10 +48,8 @@ fn main() { } b.measure('sum: ${sum} | key in m') - // b = benchmark.start() - // sum = 0 for _ in 0 .. max_iterations { sum += int(key in a_as_last) diff --git a/vlib/v/tests/comptime_for_in_fields_FieldData_test.v b/vlib/v/tests/comptime_for_in_fields_FieldData_test.v index f0d6f3baf8..ca0efdc7ea 100644 --- a/vlib/v/tests/comptime_for_in_fields_FieldData_test.v +++ b/vlib/v/tests/comptime_for_in_fields_FieldData_test.v @@ -18,16 +18,16 @@ struct Complex { ch_i chan int atomic_i atomic int my_alias MyInt = 144 - // + pointer1_i &int = unsafe { nil } pointer2_i &&int = unsafe { nil } pointer3_i &&&int = unsafe { nil } - // + array_i []int map_i map[int]int my_struct Abc my_struct_shared shared Abc - // + o_s ?string o_i ?int o_ch_i ?chan int = chan int{cap: 10} @@ -36,7 +36,7 @@ struct Complex { o_pointer1_i ?&int o_pointer2_i ?&&int o_pointer3_i ?&&&int - // + o_array_i ?[]int o_map_i ?map[int]int o_my_struct ?Abc diff --git a/vlib/v/tests/comptime_kinds_test.v b/vlib/v/tests/comptime_kinds_test.v index eeef19264b..b887fbb2cb 100644 --- a/vlib/v/tests/comptime_kinds_test.v +++ b/vlib/v/tests/comptime_kinds_test.v @@ -165,7 +165,7 @@ fn test_kind_alias() { assert_alias[AliasOfAbc]() assert_alias[AliasOfint]() assert_alias[AliasOfstring]() - // + assert_not_alias[int]() assert_not_alias[f32]() assert_not_alias[[]int]() diff --git a/vlib/v/tests/const_test.v b/vlib/v/tests/const_test.v index 325ca451e7..ba8cadccb4 100644 --- a/vlib/v/tests/const_test.v +++ b/vlib/v/tests/const_test.v @@ -8,7 +8,7 @@ pub const x = 10 fn test_const() { assert d == 11 - // + assert b == 1 assert a == 1 assert ccc == a + b diff --git a/vlib/v/tests/custom_str_on_struct_with_too_many_fields_test.v b/vlib/v/tests/custom_str_on_struct_with_too_many_fields_test.v index 365cdd09c0..18cb2ee6c8 100644 --- a/vlib/v/tests/custom_str_on_struct_with_too_many_fields_test.v +++ b/vlib/v/tests/custom_str_on_struct_with_too_many_fields_test.v @@ -3,12 +3,12 @@ struct Abc { b string c string d string - // + e string f string g string h string - // + x int // number of fields must be > 8 } diff --git a/vlib/v/tests/dump_c_structs/dump_c_struct_test.c.v b/vlib/v/tests/dump_c_structs/dump_c_struct_test.c.v index 4d05a502d0..b8aa9e94fd 100644 --- a/vlib/v/tests/dump_c_structs/dump_c_struct_test.c.v +++ b/vlib/v/tests/dump_c_structs/dump_c_struct_test.c.v @@ -39,7 +39,7 @@ fn test_dump_c_struct() { } dump(e) println(e) - // + mut hostent := &C.zz_hostent{ h_addr_list: unsafe { nil } h_aliases: unsafe { nil } diff --git a/vlib/v/tests/enum_aliases_test.v b/vlib/v/tests/enum_aliases_test.v index bfc6a904d9..77de4604fc 100644 --- a/vlib/v/tests/enum_aliases_test.v +++ b/vlib/v/tests/enum_aliases_test.v @@ -12,7 +12,7 @@ fn test_enum_aliases() { a := MyEnumAlias.something dump(a) assert x == a - // + dump(MyEnum.third) dump(MyEnumAlias.third) dump(int(MyEnum.third)) diff --git a/vlib/v/tests/enum_bitfield_test.v b/vlib/v/tests/enum_bitfield_test.v index 541a907ffb..2fde15d040 100644 --- a/vlib/v/tests/enum_bitfield_test.v +++ b/vlib/v/tests/enum_bitfield_test.v @@ -61,17 +61,17 @@ fn test_enum_bitfield_has_vs_all_methods_with_combined_flags() { fn test_enum_bitfield_has_vs_all_methods_with_combined_flags_2() { mut c := BfPermission.read | .execute | .other - // + assert c.has(.read | .execute | .other | .write) assert c.has(.read | .write) assert !c.all(.read | .execute | .other | .write) assert !c.all(.read | .write) - // + assert c.all(.read | .execute | .other) assert c.all(.read | .execute) assert c.all(.execute | .other) assert c.all(.read | .other) - // + assert c.has(.read | .execute | .other) assert c.has(.read | .execute) assert c.has(.execute | .other) diff --git a/vlib/v/tests/enum_from_generic_static_method_test.v b/vlib/v/tests/enum_from_generic_static_method_test.v index 869753aff5..99ebafed2e 100644 --- a/vlib/v/tests/enum_from_generic_static_method_test.v +++ b/vlib/v/tests/enum_from_generic_static_method_test.v @@ -71,11 +71,11 @@ enum Test { fn test_flagged_enum_from_0_and_empty_string() { z := Test.zero() dump(z) - // + x := Test.from(0)! dump(x) assert x == z - // + y := Test.from('')! dump(y) assert y == z diff --git a/vlib/v/tests/failing_tests_test.v b/vlib/v/tests/failing_tests_test.v index 68d44a284d..9af4ce1974 100644 --- a/vlib/v/tests/failing_tests_test.v +++ b/vlib/v/tests/failing_tests_test.v @@ -28,7 +28,7 @@ fn test_sizeof_in_assert() { // dump(res) assert res.output.contains('sizeof_used_in_assert_test.v:11: fn test_assert_offsetof') assert res.output.contains('assert __offsetof(main.Abc, y) == 1') - // + assert res.output.contains('sizeof_used_in_assert_test.v:15: fn test_assert_sizeof') assert res.output.contains('assert sizeof(main.Abc) == sizeof(main.Xyz)') } diff --git a/vlib/v/tests/for_loop_with_option2_test.v b/vlib/v/tests/for_loop_with_option2_test.v index 86a23e818e..88d4f35af4 100644 --- a/vlib/v/tests/for_loop_with_option2_test.v +++ b/vlib/v/tests/for_loop_with_option2_test.v @@ -13,28 +13,28 @@ fn test_for_in_option_fields() { c: [1.2, 2.3] d: [['foo'], ['bar']] } - // + for element in test.a { out << '${element}' } dump(out) assert out == ['1', '2', '3'] out.clear() - // + for element in test.b { out << '${element}' } dump(out) assert out == ['foo', 'bar'] out.clear() - // + for element in test.c { out << '${element}' } dump(out) assert out == ['1.2', '2.3'] out.clear() - // + for element in test.d { out << '${element}' } diff --git a/vlib/v/tests/generic_fn_returning_type_with_T_test.v b/vlib/v/tests/generic_fn_returning_type_with_T_test.v index 1a23d48a63..3bc39f7163 100644 --- a/vlib/v/tests/generic_fn_returning_type_with_T_test.v +++ b/vlib/v/tests/generic_fn_returning_type_with_T_test.v @@ -18,7 +18,7 @@ fn test_generic_function_returning_type_starting_with_t() { println(ft) assert typeof(ft).name == 'Tensor' assert '${ft}' == 'Tensor{\n x: 123\n}' - // + it := new_tensor[int](x: 456) println(it) assert typeof(it).name == 'Tensor' diff --git a/vlib/v/tests/generics_struct_free_test.v b/vlib/v/tests/generics_struct_free_test.v index 8d1a4845f7..bd1a38cd49 100644 --- a/vlib/v/tests/generics_struct_free_test.v +++ b/vlib/v/tests/generics_struct_free_test.v @@ -18,7 +18,6 @@ fn listnode_new[T]() &ListNode[T] { } fn (mut l List[T]) free() { - // } fn test_generic_struct_free() { diff --git a/vlib/v/tests/interface_edge_cases/voidptr_casted_as_an_interface_test.v b/vlib/v/tests/interface_edge_cases/voidptr_casted_as_an_interface_test.v index 5517690fb1..1da88f072d 100644 --- a/vlib/v/tests/interface_edge_cases/voidptr_casted_as_an_interface_test.v +++ b/vlib/v/tests/interface_edge_cases/voidptr_casted_as_an_interface_test.v @@ -18,7 +18,7 @@ fn test_voidptr_casted_as_an_interface_reference() { mut pi := &IAbc(unsafe { voidptr(u64(0)) }) dump(pi) assert f(pi) == '&IAbc(0x0)' - // + mut i := IAbc(Abc{}) pi = &i dump(pi) diff --git a/vlib/v/tests/mut_receiver_returned_as_reference_test.v b/vlib/v/tests/mut_receiver_returned_as_reference_test.v index b6882e94ab..c84dfb17ff 100644 --- a/vlib/v/tests/mut_receiver_returned_as_reference_test.v +++ b/vlib/v/tests/mut_receiver_returned_as_reference_test.v @@ -27,7 +27,7 @@ fn test_mut_receiver() { assert u64(p) == u64(f) z := p.set_position(111, 222) assert u64(p) == u64(z) - // + assert p.name == 'frodo' assert p.x == 111 assert p.y == 222 diff --git a/vlib/v/tests/mut_test.v b/vlib/v/tests/mut_test.v index b316e7b9eb..69f5995bed 100644 --- a/vlib/v/tests/mut_test.v +++ b/vlib/v/tests/mut_test.v @@ -24,7 +24,7 @@ fn test_mut() { println(numbers) n := 1 mut b := (&n) - // + unsafe { (*b) = 10 } diff --git a/vlib/v/tests/nested_map_test.v b/vlib/v/tests/nested_map_test.v index 140cbce92e..c4995bab10 100644 --- a/vlib/v/tests/nested_map_test.v +++ b/vlib/v/tests/nested_map_test.v @@ -28,7 +28,7 @@ fn test_map_of_map_to_struct() { mut foos := map[string]map[string]Foo{} foos['zza']['zzb'] = Foo{'bar'} assert foos['zza']['zzb'].name == 'bar' - // + foos['zza']['zzb'].name = 'baz' assert foos['zza']['zzb'].name == 'baz' } diff --git a/vlib/v/tests/option_test.c.v b/vlib/v/tests/option_test.c.v index a0cc40de51..195a8c966e 100644 --- a/vlib/v/tests/option_test.c.v +++ b/vlib/v/tests/option_test.c.v @@ -173,7 +173,7 @@ fn test_reassignment() { assert x2 == 100 x2++ assert x2 == 101 - // + mut x3 := 0 x3 = foo_ok() or { assert false @@ -416,13 +416,13 @@ fn get_bar(should_return_value bool) ?&Bar { fn test_allow_returning_an_optional_pointer_to_a_struct() { a := get_bar(true)? assert a == unsafe { nil } - // + x := get_bar(false) or { assert true unsafe { nil } } assert x == unsafe { nil } - // + get_bar(false) or { unsafe { nil } } assert true } diff --git a/vlib/v/tests/string_interpolation_floats_test.v b/vlib/v/tests/string_interpolation_floats_test.v index 5809f68119..ecbcfb3cfc 100644 --- a/vlib/v/tests/string_interpolation_floats_test.v +++ b/vlib/v/tests/string_interpolation_floats_test.v @@ -4,11 +4,11 @@ fn test_f32_widths_and_precision() { assert '|${x:-10.4f}|' == '|200.4300 |' assert '|${x:10.0f}|' == '| 200|' assert '|${x:-10.0f}|' == '|200 |' - // + assert '|${x:0.4f}|' == '|200.4300|' assert '|${x:.3f}|' == '|200.430|' assert '|${x:.0f}|' == '|200|' - // + y := f32(200.90) assert '|${y:.0f}|' == '|201|' } @@ -19,11 +19,11 @@ fn test_f64_widths_and_precision() { assert '|${x:-10.4f}|' == '|200.4300 |' assert '|${x:10.0f}|' == '| 200|' assert '|${x:-10.0f}|' == '|200 |' - // + assert '|${x:0.4f}|' == '|200.4300|' assert '|${x:.3f}|' == '|200.430|' assert '|${x:.0f}|' == '|200|' - // + y := f64(200.90) assert '|${y:.0f}|' == '|201|' } diff --git a/vlib/v/tests/string_interpolation_struct_with_usize_field_test.v b/vlib/v/tests/string_interpolation_struct_with_usize_field_test.v index 47aa127e4a..c228897e39 100644 --- a/vlib/v/tests/string_interpolation_struct_with_usize_field_test.v +++ b/vlib/v/tests/string_interpolation_struct_with_usize_field_test.v @@ -2,7 +2,7 @@ struct StructWithUsizeField { f_usize usize f_u64 u64 f_u32 u32 - // + f_isize isize f_i64 i64 f_i32 i32 @@ -24,7 +24,7 @@ fn test_stringified_usize_field_should_be_always_positive() { assert sa.contains('f_i32: -1') i := sa.split_into_lines().filter(it.contains('isize'))[0] assert i.contains('-'), 'all `i` fields should be negative, but ${i} != ${a.f_isize}' - // + assert sa.contains('f_u64: 18446744073709551615') assert sa.contains('f_u32: 4294967295') u := sa.split_into_lines().filter(it.contains('usize'))[0] diff --git a/vlib/v/tests/string_interpolation_variadic_test.v b/vlib/v/tests/string_interpolation_variadic_test.v index a49b1b14f8..bad72af8f3 100644 --- a/vlib/v/tests/string_interpolation_variadic_test.v +++ b/vlib/v/tests/string_interpolation_variadic_test.v @@ -17,16 +17,16 @@ fn test_vargs_string_interpolation() { superman := Man{'Superman', 30, ['flying', 'fighting evil', 'being nice']} results := my_variadic_function(superman, man) assert results.contains('Man{') - // + assert results.contains("name: 'Superman'") assert results.contains('age: 30') assert results.contains('}, Man{') - // + assert results.contains("interests: ['programming'") assert results.contains("name: 'Me'") - // + assert results.contains('}]') - // + println(results) } diff --git a/vlib/v/tests/type_alias_of_pointer_types_test.v b/vlib/v/tests/type_alias_of_pointer_types_test.v index 8761e247d7..4d0b904b2b 100644 --- a/vlib/v/tests/type_alias_of_pointer_types_test.v +++ b/vlib/v/tests/type_alias_of_pointer_types_test.v @@ -28,10 +28,10 @@ fn test_alias_of_pointer_types() { dump(sizeof(PPZZMyStructInt)) dump(sizeof(PPPZZInt)) dump(sizeof(PPPZZMyStructInt)) - // + assert sizeof(ZZInt) == sizeof(int) assert sizeof(ZZMyStructInt) == sizeof(int) - // + assert sizeof(PZZInt) == sizeof(voidptr) assert sizeof(PZZMyStructInt) == sizeof(voidptr) assert sizeof(PPZZInt) == sizeof(voidptr) diff --git a/vlib/v/tests/typeof_simple_types_test.v b/vlib/v/tests/typeof_simple_types_test.v index 850e09bfff..f20a6a0814 100644 --- a/vlib/v/tests/typeof_simple_types_test.v +++ b/vlib/v/tests/typeof_simple_types_test.v @@ -26,7 +26,7 @@ fn test_typeof_for_builtin_int_types() { assert typeof(u16(1)).name == 'u16' assert typeof(u32(1)).name == 'u32' assert typeof(u64(1)).name == 'u64' - // + assert typeof(char(1)).name == 'char' } diff --git a/vlib/v/tests/unsafe_test.c.v b/vlib/v/tests/unsafe_test.c.v index e133aae91a..8f1f05efcf 100644 --- a/vlib/v/tests/unsafe_test.c.v +++ b/vlib/v/tests/unsafe_test.c.v @@ -79,7 +79,7 @@ const fixedbytes = [100]u8{} fn test_unsafe_pointers() { fsize := fixedbytes.len src := &fixedbytes[0] - // + b := []u8{} eprintln('b.data before: ${b.data}') eprintln('b.len before: ${b.len}') diff --git a/vlib/v/util/surrounder_test.v b/vlib/v/util/surrounder_test.v index c1435ccc06..7e3d6066f7 100644 --- a/vlib/v/util/surrounder_test.v +++ b/vlib/v/util/surrounder_test.v @@ -6,7 +6,7 @@ fn test_creation() { mut sr0 := new_surrounder(0) assert sr0.befores.cap == 0 assert sr0.afters.cap == 0 - // + mut sr10 := new_surrounder(10) assert sr10.befores.cap == 10 assert sr10.afters.cap == 10 diff --git a/vlib/v/vcache/vcache_test.v b/vlib/v/vcache/vcache_test.v index 4df9d87e48..6ac4d82ed5 100644 --- a/vlib/v/vcache/vcache_test.v +++ b/vlib/v/vcache/vcache_test.v @@ -53,25 +53,25 @@ fn test_different_options_should_produce_different_cache_entries_for_same_key_an fn test_exists() { mut cm := vcache.new_cache_manager([]) cm.exists('.o', 'abc') or { assert true } - // + x := cm.save('.x', 'abc', '') or { assert false '' } cm.exists('.o', 'abc') or { assert true } - // + y := cm.save('.o', 'zbc', '') or { assert false '' } cm.exists('.o', 'abc') or { assert true } - // + z := cm.save('.o', 'abc', '') or { assert false '' } cm.exists('.o', 'abc') or { assert false } - // + assert os.is_file(x) assert os.is_file(y) assert os.is_file(z) diff --git a/vlib/veb/csrf/csrf_test.v b/vlib/veb/csrf/csrf_test.v index 947940a950..5195709d3c 100644 --- a/vlib/veb/csrf/csrf_test.v +++ b/vlib/veb/csrf/csrf_test.v @@ -282,7 +282,6 @@ fn protect_route_util(path string) { res = req.do() or { panic(err) } assert res.status() == .forbidden - // req = http.Request{ method: .post url: 'http://${localserver}/${path}' diff --git a/vlib/veb/tests/veb_test.v b/vlib/veb/tests/veb_test.v index ca4c703584..70dfb5940c 100644 --- a/vlib/veb/tests/veb_test.v +++ b/vlib/veb/tests/veb_test.v @@ -153,7 +153,7 @@ fn test_http_client_settings_page() { x := http.get('http://${localserver}/bilbo/settings') or { panic(err) } assert_common_http_headers(x)! assert x.body == 'username: bilbo' - // + y := http.get('http://${localserver}/kent/settings') or { panic(err) } assert_common_http_headers(y)! assert y.body == 'username: kent' @@ -163,11 +163,11 @@ fn test_http_client_user_repo_settings_page() { x := http.get('http://${localserver}/bilbo/gostamp/settings') or { panic(err) } assert_common_http_headers(x)! assert x.body == 'username: bilbo | repository: gostamp' - // + y := http.get('http://${localserver}/kent/golang/settings') or { panic(err) } assert_common_http_headers(y)! assert y.body == 'username: kent | repository: golang' - // + z := http.get('http://${localserver}/missing/golang/settings') or { panic(err) } assert z.status() == .not_found } @@ -191,7 +191,7 @@ fn test_http_client_json_post() { assert x.body == json_for_ouser nuser := json.decode(User, x.body) or { User{} } assert '${ouser}' == '${nuser}' - // + x = http.post_json('http://${localserver}/json', json_for_ouser) or { panic(err) } $if debug_net_socket_client ? { eprintln('/json endpoint response: ${x}') diff --git a/vlib/veb/tests/veb_test_server.v b/vlib/veb/tests/veb_test_server.v index d3568d3e6a..f88d74314f 100644 --- a/vlib/veb/tests/veb_test_server.v +++ b/vlib/veb/tests/veb_test_server.v @@ -41,7 +41,7 @@ fn main() { timeout := os.args[2].int() assert timeout > 0 spawn exit_after_timeout(timeout) - // + mut app := &ServerApp{ port: http_port timeout: timeout diff --git a/vlib/vweb/tests/vweb_test.v b/vlib/vweb/tests/vweb_test.v index 62df331f50..ed2ec58486 100644 --- a/vlib/vweb/tests/vweb_test.v +++ b/vlib/vweb/tests/vweb_test.v @@ -113,7 +113,7 @@ fn test_http_client_settings_page() { x := http.get('http://${localserver}/bilbo/settings') or { panic(err) } assert_common_http_headers(x)! assert x.body == 'username: bilbo' - // + y := http.get('http://${localserver}/kent/settings') or { panic(err) } assert_common_http_headers(y)! assert y.body == 'username: kent' @@ -123,11 +123,11 @@ fn test_http_client_user_repo_settings_page() { x := http.get('http://${localserver}/bilbo/gostamp/settings') or { panic(err) } assert_common_http_headers(x)! assert x.body == 'username: bilbo | repository: gostamp' - // + y := http.get('http://${localserver}/kent/golang/settings') or { panic(err) } assert_common_http_headers(y)! assert y.body == 'username: kent | repository: golang' - // + z := http.get('http://${localserver}/missing/golang/settings') or { panic(err) } assert z.status() == .not_found } @@ -151,7 +151,7 @@ fn test_http_client_json_post() { assert x.body == json_for_ouser nuser := json.decode(User, x.body) or { User{} } assert '${ouser}' == '${nuser}' - // + x = http.post_json('http://${localserver}/json', json_for_ouser) or { panic(err) } $if debug_net_socket_client ? { eprintln('/json endpoint response: ${x}') diff --git a/vlib/vweb/tests/vweb_test_server/server.v b/vlib/vweb/tests/vweb_test_server/server.v index b570e04d1f..36e833804d 100644 --- a/vlib/vweb/tests/vweb_test_server/server.v +++ b/vlib/vweb/tests/vweb_test_server/server.v @@ -14,7 +14,7 @@ pub fn start_in_background(http_port int, timeout time.Duration) ! { linfo('>> ${@FN}, http_port: ${http_port}, timeout: ${timeout}') assert http_port > 0 assert timeout > 0 - // + spawn fn (timeout time.Duration) { time.sleep(timeout) linfo('>> webserver: pid: ${os.getpid()}, exiting cleanly after ${timeout.milliseconds()}ms ...') diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 916443058b..a0f73ef29c 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -229,7 +229,7 @@ pub fn (mut ctx Context) send_response_to_client(mimetype string, res string) bo return false } ctx.done = true - // + mut resp := http.Response{ body: res } @@ -244,7 +244,7 @@ pub fn (mut ctx Context) send_response_to_client(mimetype string, res string) bo http.CommonHeader.content_length: resp.body.len.str() }).join(ctx.header) resp.header = header.join(vweb.headers_close) - // + resp.set_version(.v1_1) resp.set_status(http.status_from_int(ctx.status.int())) // send_string(mut ctx.conn, resp.bytestr()) or { return false } diff --git a/vlib/x/crypto/chacha20/chacha.v b/vlib/x/crypto/chacha20/chacha.v index 8d911b0f18..69633f8ad5 100644 --- a/vlib/x/crypto/chacha20/chacha.v +++ b/vlib/x/crypto/chacha20/chacha.v @@ -142,17 +142,17 @@ pub fn (mut c Cipher) reset() { c.counter = u32(0) c.overflow = false c.precomp = false - // + c.p1 = u32(0) c.p5 = u32(0) c.p9 = u32(0) c.p13 = u32(0) - // + c.p2 = u32(0) c.p6 = u32(0) c.p10 = u32(0) c.p14 = u32(0) - // + c.p3 = u32(0) c.p7 = u32(0) c.p11 = u32(0) diff --git a/vlib/x/crypto/chacha20poly1305/chacha20poly1305_test.v b/vlib/x/crypto/chacha20poly1305/chacha20poly1305_test.v index 33ac9e7821..f141df2f13 100644 --- a/vlib/x/crypto/chacha20poly1305/chacha20poly1305_test.v +++ b/vlib/x/crypto/chacha20poly1305/chacha20poly1305_test.v @@ -17,7 +17,6 @@ fn test_encrypt_example_test() ! { exp_onetime_key := hex.decode('7bac2b252db447af09b67a55a4e955840ae1d6731075d9eb2a9375783ed553ff')! - // ncsize := nonce.len mut c := new(key, ncsize)! mut cs := chacha20.new_cipher(key, nonce)! diff --git a/vlib/x/crypto/poly1305/custom.v b/vlib/x/crypto/poly1305/custom.v index 23bea63510..72fe991ad8 100644 --- a/vlib/x/crypto/poly1305/custom.v +++ b/vlib/x/crypto/poly1305/custom.v @@ -98,11 +98,11 @@ fn (u Uint192) mul_128_checked(v unsigned.Uint128) (Uint192, unsigned.Uint128) { ulovlo := u128_from_64_mul(u.lo, v.lo) umivlo := u128_from_64_mul(u.mi, v.lo) uhivlo := u128_from_64_mul(u.hi, v.lo) - // + ulovhi := u128_from_64_mul(u.lo, v.hi) umivhi := u128_from_64_mul(u.mi, v.hi) uhivhi := u128_from_64_mul(u.hi, v.hi) - // + m0 := ulovlo m1, c1 := unsigned.add_128(umivlo, ulovhi, 0) m2, c2 := unsigned.add_128(uhivlo, umivhi, c1) diff --git a/vlib/x/ttf/render_sokol_cpu.v b/vlib/x/ttf/render_sokol_cpu.v index 0e54ecfc3d..f906b17596 100644 --- a/vlib/x/ttf/render_sokol_cpu.v +++ b/vlib/x/ttf/render_sokol_cpu.v @@ -204,7 +204,7 @@ pub fn (tf_skl TTF_render_Sokol) draw_text_bmp(ctx &gg.Context, x f32, y f32) { 1, ] sgl.mult_matrix(m) - // + sgl.load_pipeline(ctx.pipeline.alpha) sgl.enable_texture() sgl.texture(tf_skl.sg_img, tf_skl.sg_smp) diff --git a/vlib/x/vweb/csrf/csrf_test.v b/vlib/x/vweb/csrf/csrf_test.v index eb4cf18f02..cd4b6fc6b0 100644 --- a/vlib/x/vweb/csrf/csrf_test.v +++ b/vlib/x/vweb/csrf/csrf_test.v @@ -283,7 +283,6 @@ fn protect_route_util(path string) { res = req.do() or { panic(err) } assert res.status() == .forbidden - // req = http.Request{ method: .post url: 'http://${localserver}/${path}' diff --git a/vlib/x/vweb/tests/vweb_test.v b/vlib/x/vweb/tests/vweb_test.v index a447d672dd..038d0307ad 100644 --- a/vlib/x/vweb/tests/vweb_test.v +++ b/vlib/x/vweb/tests/vweb_test.v @@ -153,7 +153,7 @@ fn test_http_client_settings_page() { x := http.get('http://${localserver}/bilbo/settings') or { panic(err) } assert_common_http_headers(x)! assert x.body == 'username: bilbo' - // + y := http.get('http://${localserver}/kent/settings') or { panic(err) } assert_common_http_headers(y)! assert y.body == 'username: kent' @@ -163,11 +163,11 @@ fn test_http_client_user_repo_settings_page() { x := http.get('http://${localserver}/bilbo/gostamp/settings') or { panic(err) } assert_common_http_headers(x)! assert x.body == 'username: bilbo | repository: gostamp' - // + y := http.get('http://${localserver}/kent/golang/settings') or { panic(err) } assert_common_http_headers(y)! assert y.body == 'username: kent | repository: golang' - // + z := http.get('http://${localserver}/missing/golang/settings') or { panic(err) } assert z.status() == .not_found } @@ -191,7 +191,7 @@ fn test_http_client_json_post() { assert x.body == json_for_ouser nuser := json.decode(User, x.body) or { User{} } assert '${ouser}' == '${nuser}' - // + x = http.post_json('http://${localserver}/json', json_for_ouser) or { panic(err) } $if debug_net_socket_client ? { eprintln('/json endpoint response: ${x}') diff --git a/vlib/x/vweb/tests/vweb_test_server.v b/vlib/x/vweb/tests/vweb_test_server.v index e08536c1fd..5f7607d0ce 100644 --- a/vlib/x/vweb/tests/vweb_test_server.v +++ b/vlib/x/vweb/tests/vweb_test_server.v @@ -41,7 +41,7 @@ fn main() { timeout := os.args[2].int() assert timeout > 0 spawn exit_after_timeout(timeout) - // + mut app := &ServerApp{ port: http_port timeout: timeout