Skip to content

builtin: fix tests for isnil#24531

Merged
spytheman merged 1 commit into
vlang:masterfrom
lcheylus:tests-isnil
May 21, 2025
Merged

builtin: fix tests for isnil#24531
spytheman merged 1 commit into
vlang:masterfrom
lcheylus:tests-isnil

Conversation

@lcheylus

@lcheylus lcheylus commented May 20, 2025

Copy link
Copy Markdown
Contributor

Tests OK on Linux (Debian/testing amd64)

  • Before fix
$ ./v -W test /home/fox/dev/vlang.git/vlib/builtin/isnil_test.v
---- Testing... ----------------------------------------------------------------------------------------------------------------------------
 FAIL     0.000 ms vlib/builtin/isnil_test.v
>> compilation failed:
vlib/builtin/isnil_test.v:17:8: error: cannot cast a number to a type reference, use `nil` or a voidptr cast first: `&Type(voidptr(123))`
   15 | 
   16 | fn test_isnil_intptr() {
   17 |     pi := &int(0)
      |           ~~~~~~~
   18 |     assert isnil(pi)
   19 | }

--------------------------------------------------------------------------------------------------------------------------------------------
To reproduce just failure 1 run:    '/home/fox/dev/vlang.git/v' -W '/home/fox/dev/vlang.git/vlib/builtin/isnil_test.v'
Summary for all V _test.v files: 1 failed, 1 total. Elapsed time: 1023 ms, on 1 job. Comptime: 939 ms. Runtime: 0 ms.
  • After fix
$ ./v -stats -W test /home/fox/dev/vlang.git/vlib/builtin/isnil_test.v
---- Testing... ----
        V  source  code size:      29869 lines,     137476 tokens,     802249 bytes,   285 types,    12 modules,   133 files
generated  target  code size:       9895 lines,     346743 bytes
compilation took: 466.271 ms, compilation speed: 64059 vlines/s, cgen threads: 7
running tests in: /home/fox/dev/vlang.git/vlib/builtin/isnil_test.v
      OK    [1/4]     0.001 ms     1 assert  | main.test_isnil_byteptr()
      OK    [2/4]     0.000 ms     1 assert  | main.test_isnil_voidptr()
      OK    [3/4]     0.000 ms     1 assert  | main.test_isnil_charptr()
      OK    [4/4]     0.000 ms     1 assert  | main.test_isnil_intptr()
     Summary for running V tests in "isnil_test.v": 4 passed, 4 total. Elapsed time: 0 ms.

 OK     482.842 ms vlib/builtin/isnil_test.v
----
Summary for all V _test.v files: 1 passed, 1 total. Elapsed time: 483 ms, on 1 job. Comptime: 0 ms. Runtime: 482 ms.

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22899

Signed-off-by: Laurent Cheylus <foxy@free.fr>

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

@spytheman spytheman merged commit 9fd7e3e into vlang:master May 21, 2025
73 of 74 checks passed
@lcheylus lcheylus deleted the tests-isnil branch May 21, 2025 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants