builtin,vdoc: make v doc -unsafe-run-examples -time -f ansi vlib/builtin/ pass too

This commit is contained in:
Delyan Angelov 2025-08-13 16:28:37 +03:00
parent 82cd81e963
commit 2e3f0b27f0
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED
3 changed files with 4 additions and 5 deletions

View file

@ -70,7 +70,6 @@ fn main() {
vd.vprintln('Setting output type to "${cfg.output_type}"') vd.vprintln('Setting output type to "${cfg.output_type}"')
vd.generate_docs_from_file() vd.generate_docs_from_file()
if cfg.run_examples != .skip { if cfg.run_examples != .skip {
println('')
if vd.example_oks == 0 && vd.example_failures == 0 { if vd.example_oks == 0 && vd.example_failures == 0 {
println(term.colorize(term.bright_yellow, 'Found NO examples.')) println(term.colorize(term.bright_yellow, 'Found NO examples.'))
} else { } else {

View file

@ -430,7 +430,7 @@ pub fn (mut a array) reset() {
// trim trims the array length to `index` without modifying the allocated data. // trim trims the array length to `index` without modifying the allocated data.
// If `index` is greater than `len` nothing will be changed. // If `index` is greater than `len` nothing will be changed.
// Example: mut a := [1,2,3,4]; a.trim(3); assert a.len == 10 // Example: mut a := [1,2,3,4]; a.trim(3); assert a.len == 3
pub fn (mut a array) trim(index int) { pub fn (mut a array) trim(index int) {
if index < a.len { if index < a.len {
a.len = index a.len = index
@ -819,7 +819,7 @@ pub fn (a &array) free() {
// Each function takes a boolean test expression as its single argument. // Each function takes a boolean test expression as its single argument.
// These test expressions may use `it` as a pointer to a single element at a time. // These test expressions may use `it` as a pointer to a single element at a time.
// //
// Example: a := [10,20,30,3,5,99]; assert a.filter(it < 5) == [3,5] // create an array of elements less than 5 // Example: a := [10,20,30,3,5,99]; assert a.filter(it < 5) == [3] // create an array of elements less than 5
// Example: a := [10,20,30,3,5,99]; assert a.filter(it % 2 == 1) == [3,5,99] // create an array of only odd elements // Example: a := [10,20,30,3,5,99]; assert a.filter(it % 2 == 1) == [3,5,99] // create an array of only odd elements
// Example: struct Named { name string }; a := [Named{'Abc'}, Named{'Bcd'}, Named{'Az'}]; assert a.filter(it.name[0] == `A`).len == 2 // Example: struct Named { name string }; a := [Named{'Abc'}, Named{'Bcd'}, Named{'Az'}]; assert a.filter(it.name[0] == `A`).len == 2
pub fn (a array) filter(predicate fn (voidptr) bool) array pub fn (a array) filter(predicate fn (voidptr) bool) array
@ -878,7 +878,7 @@ pub fn (a array) map(callback fn (voidptr) voidptr) array
// //
// Example: mut aa := [5,2,1,10]; aa.sort(); assert aa == [1,2,5,10] // will sort the array in ascending order // Example: mut aa := [5,2,1,10]; aa.sort(); assert aa == [1,2,5,10] // will sort the array in ascending order
// Example: mut aa := [5,2,1,10]; aa.sort(b < a); assert aa == [10,5,2,1] // will sort the array in descending order // Example: mut aa := [5,2,1,10]; aa.sort(b < a); assert aa == [10,5,2,1] // will sort the array in descending order
// 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 // 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
pub fn (mut a array) sort(callback fn (voidptr, voidptr) int) pub fn (mut a array) sort(callback fn (voidptr, voidptr) int)
// sorted returns a sorted copy of the original array. The original array is *NOT* modified. // sorted returns a sorted copy of the original array. The original array is *NOT* modified.

View file

@ -2846,7 +2846,7 @@ pub fn (s string) is_identifier() bool {
// camel_to_snake convert string from camelCase to snake_case // camel_to_snake convert string from camelCase to snake_case
// Example: assert 'Abcd'.camel_to_snake() == 'abcd' // Example: assert 'Abcd'.camel_to_snake() == 'abcd'
// Example: assert 'aaBB'.camel_to_snake() == 'aa_bb' // Example: assert 'aaBB'.camel_to_snake() == 'aa_bb'
// Example: assert 'BBaa'.camel_to_snake() == 'b_baa' // Example: assert 'BBaa'.camel_to_snake() == 'bb_aa'
// Example: assert 'aa_BB'.camel_to_snake() == 'aa_bb' // Example: assert 'aa_BB'.camel_to_snake() == 'aa_bb'
@[direct_array_access] @[direct_array_access]
pub fn (s string) camel_to_snake() string { pub fn (s string) camel_to_snake() string {