Skip to content

Commit

Permalink
all: change single blank comment to blank line (#22016)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 authored Aug 9, 2024
1 parent 793b66d commit 19f080f
Show file tree
Hide file tree
Showing 147 changed files with 319 additions and 339 deletions.
4 changes: 2 additions & 2 deletions cmd/tools/modules/testing/common.v
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}

Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions cmd/tools/modules/testing/output.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/modules/vgit/vgit.v
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vast/vast.v
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vcover/data.v
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/vcover/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vtest-parser.v
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vup.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion examples/gg/mandelbrot.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions examples/term.ui/pong.v
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions vlib/arrays/arrays_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
Expand All @@ -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}
Expand Down Expand Up @@ -550,7 +550,7 @@ fn test_each() {
for x in a {
control_sum += x
}
//

each(a, fn (x int) {
println(x)
})
Expand All @@ -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}')
})
Expand Down
4 changes: 2 additions & 2 deletions vlib/benchmark/benchmark_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ fn test_record_measure() {
assert x > 50_000
// assert x < 200_000
flush_stdout()
//

println('step 2')
flush_stdout()
time.sleep(150 * time.millisecond)
y := b.record_measure('sleeping 2')
assert y > 100_000
// assert y < 200_000
flush_stdout()
//

res := b.all_recorded_measures()
println('All recorded measurements:')
println(res)
Expand Down
2 changes: 1 addition & 1 deletion vlib/builtin/array_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions vlib/builtin/builtin.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
13 changes: 6 additions & 7 deletions vlib/builtin/float_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion vlib/builtin/js/array_test.js.v
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions vlib/builtin/lambda_expr_array_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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]
}
Expand Down
10 changes: 5 additions & 5 deletions vlib/builtin/rune_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 0 additions & 5 deletions vlib/builtin/string_int_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand All @@ -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}'
Expand All @@ -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}'
Expand All @@ -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}'
}
Expand Down
Loading

0 comments on commit 19f080f

Please sign in to comment.