Skip to content

Commit 999a6e3

Browse files
authored
ci: add a report-wrong-examples-in-doc-comments job, that runs ./v doc -check-examples -f none vlib/ (#25554)
1 parent 848cdb7 commit 999a6e3

5 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎.github/workflows/docs_ci.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,13 @@ jobs:
7171
vlib/rand/ vlib/compress/ vlib/clipboard/ \
7272
vlib/time/ \
7373
vlib/os
74+
75+
report-wrong-examples-in-doc-comments:
76+
runs-on: ubuntu-24.04
77+
timeout-minutes: 15
78+
steps:
79+
- uses: actions/checkout@v5
80+
- name: Build V
81+
run: make
82+
- name: Check examples in the doc comments for all vlib modules
83+
run: ./v doc -check-examples -f none vlib/

‎vlib/os/os_nix.c.v‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ pub fn loginname() !string {
263263

264264
// ls returns ![]string of the files and dirs in the given `path` ( os.ls uses C.readdir ). Symbolic links are returned to be files. For recursive list see os.walk functions.
265265
// See also: `os.walk`, `os.walk_ext`, `os.is_dir`, `os.is_file`
266-
// Example: https://github.com/vlang/v/blob/master/examples/readdir.v
266+
// Example:
267267
// ```
268268
// entries := os.ls(os.home_dir()) or { [] }
269269
// for entry in entries {

‎vlib/sokol/audio/audio.c.v‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ pub fn fclamp(x f32, flo f32, fhi f32) f32 {
205205
// min - helper function to return the smaller of two numbers
206206
//
207207
// NOTE: math.min returns `f32` values, this returns `int` values
208-
// Example: smaller := audio.min(1, 5) // smaller == 1
208+
// Example: println(audio.min(1, 5))
209209
pub fn min(x int, y int) int {
210210
if x < y {
211211
return x
@@ -216,7 +216,7 @@ pub fn min(x int, y int) int {
216216
// max - helper function to return the larger of two numbers
217217
//
218218
// NOTE: math.max returns `f32` values, this returns `int` values
219-
// Example: larger := audio.max(1, 5) // larger == 5
219+
// Example: println(audio.max(1, 5))
220220
pub fn max(x int, y int) int {
221221
if x < y {
222222
return y

‎vlib/strconv/utilities.c.v‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn f32_to_str_l(f f32) string {
3737
// f32_to_str_l_with_dot returns `f` as a `string` in decimal notation with a maximum of 8 digits after the dot.
3838
// If the decimal digits after the dot are zero, a '.0' is appended for clarity.
3939
//
40-
// Example: assert strconv.f32_to_str_l_with_dot(34.) == '34.0'
40+
// Example: assert strconv.f32_to_str_l_with_dot(34.2) == '34.2'
4141
@[manualfree]
4242
pub fn f32_to_str_l_with_dot(f f32) string {
4343
s := f32_to_str(f, 8)
@@ -60,7 +60,7 @@ pub fn f64_to_str_l(f f64) string {
6060
// f64_to_str_l_with_dot returns `f` as a `string` in decimal notation with a maximum of 18 digits after the dot.
6161
// If the decimal digits after the dot are zero, a '.0' is appended for clarity.
6262
//
63-
// Example: assert strconv.f64_to_str_l_with_dot (34.) == '34.0'
63+
// Example: assert strconv.f64_to_str_l_with_dot(34.7) == '34.7'
6464
@[manualfree]
6565
pub fn f64_to_str_l_with_dot(f f64) string {
6666
s := f64_to_str(f, 18)

‎vlib/strconv/vprintf.c.v‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn v_printf(str string, pt ...voidptr) {
4040
// Example:
4141
// ```v
4242
// x := 3.141516
43-
// assert strconv.v_sprintf('aaa %G', x) == 'aaa 3.141516'
43+
// assert unsafe{strconv.v_sprintf('aaa %G', x)} == 'aaa 3.141516'
4444
// ```
4545
@[direct_array_access; manualfree; unsafe]
4646
pub fn v_sprintf(str string, pt ...voidptr) string {

0 commit comments

Comments
 (0)