Skip to content

Commit 2e3f0b2

Browse files
committed
builtin,vdoc: make v doc -unsafe-run-examples -time -f ansi vlib/builtin/ pass too
1 parent 82cd81e commit 2e3f0b2

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

cmd/tools/vdoc/main.v

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ fn main() {
7070
vd.vprintln('Setting output type to "${cfg.output_type}"')
7171
vd.generate_docs_from_file()
7272
if cfg.run_examples != .skip {
73-
println('')
7473
if vd.example_oks == 0 && vd.example_failures == 0 {
7574
println(term.colorize(term.bright_yellow, 'Found NO examples.'))
7675
} else {

vlib/builtin/array.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ pub fn (mut a array) reset() {
430430

431431
// trim trims the array length to `index` without modifying the allocated data.
432432
// If `index` is greater than `len` nothing will be changed.
433-
// Example: mut a := [1,2,3,4]; a.trim(3); assert a.len == 10
433+
// Example: mut a := [1,2,3,4]; a.trim(3); assert a.len == 3
434434
pub fn (mut a array) trim(index int) {
435435
if index < a.len {
436436
a.len = index
@@ -819,7 +819,7 @@ pub fn (a &array) free() {
819819
// Each function takes a boolean test expression as its single argument.
820820
// These test expressions may use `it` as a pointer to a single element at a time.
821821
//
822-
// Example: a := [10,20,30,3,5,99]; assert a.filter(it < 5) == [3,5] // create an array of elements less than 5
822+
// Example: a := [10,20,30,3,5,99]; assert a.filter(it < 5) == [3] // create an array of elements less than 5
823823
// Example: a := [10,20,30,3,5,99]; assert a.filter(it % 2 == 1) == [3,5,99] // create an array of only odd elements
824824
// Example: struct Named { name string }; a := [Named{'Abc'}, Named{'Bcd'}, Named{'Az'}]; assert a.filter(it.name[0] == `A`).len == 2
825825
pub fn (a array) filter(predicate fn (voidptr) bool) array
@@ -878,7 +878,7 @@ pub fn (a array) map(callback fn (voidptr) voidptr) array
878878
//
879879
// Example: mut aa := [5,2,1,10]; aa.sort(); assert aa == [1,2,5,10] // will sort the array in ascending order
880880
// Example: mut aa := [5,2,1,10]; aa.sort(b < a); assert aa == [10,5,2,1] // will sort the array in descending order
881-
// Example: struct Named { name string }; mut aa := [Named{'Abc'}, Named{'Xyz'}]; aa.sort(b.name < a.name); assert aa.map(it.name) == ['Abc', 'Xyz'] // will sort descending by the .name field
881+
// Example: struct Named { name string }; mut aa := [Named{'Abc'}, Named{'Xyz'}]; aa.sort(b.name < a.name); assert aa.map(it.name) == ['Xyz','Abc'] // will sort descending by the .name field
882882
pub fn (mut a array) sort(callback fn (voidptr, voidptr) int)
883883

884884
// sorted returns a sorted copy of the original array. The original array is *NOT* modified.

vlib/builtin/string.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2846,7 +2846,7 @@ pub fn (s string) is_identifier() bool {
28462846
// camel_to_snake convert string from camelCase to snake_case
28472847
// Example: assert 'Abcd'.camel_to_snake() == 'abcd'
28482848
// Example: assert 'aaBB'.camel_to_snake() == 'aa_bb'
2849-
// Example: assert 'BBaa'.camel_to_snake() == 'b_baa'
2849+
// Example: assert 'BBaa'.camel_to_snake() == 'bb_aa'
28502850
// Example: assert 'aa_BB'.camel_to_snake() == 'aa_bb'
28512851
@[direct_array_access]
28522852
pub fn (s string) camel_to_snake() string {

0 commit comments

Comments
 (0)