<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rneovim.git/test/unit/strings_spec.lua, branch master</title>
<subtitle>Neovim fork with Rahm's personal hacks.</subtitle>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/'/>
<entry>
<title>test(harness): migrate away from magic globals</title>
<updated>2026-07-21T11:22:39+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2026-07-20T15:16:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=6d8c8b18d551d0be0490640c00fabb816727ec10'/>
<id>6d8c8b18d551d0be0490640c00fabb816727ec10</id>
<content type='text'>
Problem:
The magic globals `it`, `describe`, etc., are more trouble than they are
worth.

- Hooking into `after_each` requires `getfenv()` hacks.
- They confuse luals/emmylua, because the top-level `.luarc.json` isn't
  merged with `test/.luarc.json` (apparently a luals limitation?)
- They totally defeat discoverability because the user just has to
  "know" about the various magic symbols.

So they harm DX, which means they serve no purpose at all.

Solution:
- Expose the test API from `testutil`, so tests can call `t.it()`,
  `t.describe()`, etc., in the conventional way.
- Drop `getfenv()` hacks.
- Drop the `setfenv()` injection in `load_chunk`.
- Drop `test/_meta.lua`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
The magic globals `it`, `describe`, etc., are more trouble than they are
worth.

- Hooking into `after_each` requires `getfenv()` hacks.
- They confuse luals/emmylua, because the top-level `.luarc.json` isn't
  merged with `test/.luarc.json` (apparently a luals limitation?)
- They totally defeat discoverability because the user just has to
  "know" about the various magic symbols.

So they harm DX, which means they serve no purpose at all.

Solution:
- Expose the test API from `testutil`, so tests can call `t.it()`,
  `t.describe()`, etc., in the conventional way.
- Drop `getfenv()` hacks.
- Drop the `setfenv()` injection in `load_chunk`.
- Drop `test/_meta.lua`.
</pre>
</div>
</content>
</entry>
<entry>
<title>test(unit/strings_spec): show ctx when vim_snprintf content check fails #32570</title>
<updated>2025-02-23T01:11:15+00:00</updated>
<author>
<name>James McCoy</name>
<email>jamessan@jamessan.com</email>
</author>
<published>2025-02-23T01:11:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=1c8173487104f905482b1d5a327defadf2c64573'/>
<id>1c8173487104f905482b1d5a327defadf2c64573</id>
<content type='text'>
Same idea as a7be4b7bf857, but that only showed the context if the
length of the string differed. Since these tests check both string
length and string content, the ctx should be provided for both.

    ERROR    test/unit/testutil.lua @ 797: vim_snprintf() positional arguments
    test/unit/testutil.lua:769: test/unit/testutil.lua:753: (string) '
    test/unit/strings_spec.lua:159: snprintf(buf, 4, "%1$0.*2$b", 12ULL, cdata&lt;int&gt;: 0xf78c8ed8) = 001100
    Expected objects to be the same.
    Passed in:
    (string) '000'
    Expected:
    (string) '001''</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Same idea as a7be4b7bf857, but that only showed the context if the
length of the string differed. Since these tests check both string
length and string content, the ctx should be provided for both.

    ERROR    test/unit/testutil.lua @ 797: vim_snprintf() positional arguments
    test/unit/testutil.lua:769: test/unit/testutil.lua:753: (string) '
    test/unit/strings_spec.lua:159: snprintf(buf, 4, "%1$0.*2$b", 12ULL, cdata&lt;int&gt;: 0xf78c8ed8) = 001100
    Expected objects to be the same.
    Passed in:
    (string) '000'
    Expected:
    (string) '001''</pre>
</div>
</content>
</entry>
<entry>
<title>test(unit/strings_spec): use correct type for binary values</title>
<updated>2025-01-29T11:30:59+00:00</updated>
<author>
<name>James McCoy</name>
<email>jamessan@jamessan.com</email>
</author>
<published>2025-01-29T01:54:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=1426f3f3ce91816351412f8cdf5849b76fd5a4a0'/>
<id>1426f3f3ce91816351412f8cdf5849b76fd5a4a0</id>
<content type='text'>
When 9.0.1856 was ported, the numbers being formatted as binary were cast
to "unsigned int" rather than uvarnumber_T, as is done upstream.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When 9.0.1856 was ported, the numbers being formatted as binary were cast
to "unsigned int" rather than uvarnumber_T, as is done upstream.
</pre>
</div>
</content>
</entry>
<entry>
<title>test(unit/strings_spec): provide context for vim_snprintf tests</title>
<updated>2025-01-29T01:32:40+00:00</updated>
<author>
<name>James McCoy</name>
<email>jamessan@jamessan.com</email>
</author>
<published>2025-01-29T01:32:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=a7be4b7bf857de9680ee3d1723a9f616e8a20776'/>
<id>a7be4b7bf857de9680ee3d1723a9f616e8a20776</id>
<content type='text'>
Since these assertions all use a common function to perform the test
assertions, it's difficult to figure out which test failed:

    ERROR    test/unit/testutil.lua @ 785: vim_snprintf() positional arguments
    test/unit/testutil.lua:757: test/unit/testutil.lua:741: (string) '
    test/unit/strings_spec.lua:143: Expected objects to be the same.
    Passed in:
    (number) 6400
    Expected:
    (number) 6'
    exit code: 256

Adding context to the assertion makes it clearer what the problem is:

    ERROR    test/unit/testutil.lua @ 785: vim_snprintf() positional arguments
    test/unit/testutil.lua:757: test/unit/testutil.lua:741: (string) '
    test/unit/strings_spec.lua:149: snprintf(buf, 0, "%1$0.*2$b", cdata&lt;unsigned int&gt;: 0xf78d0f38, cdata&lt;int&gt;: 0xf78dc4e0) = 001100
    Expected objects to be the same.
    Passed in:
    (number) 6400
    Expected:
    (number) 6'
    exit code: 256
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since these assertions all use a common function to perform the test
assertions, it's difficult to figure out which test failed:

    ERROR    test/unit/testutil.lua @ 785: vim_snprintf() positional arguments
    test/unit/testutil.lua:757: test/unit/testutil.lua:741: (string) '
    test/unit/strings_spec.lua:143: Expected objects to be the same.
    Passed in:
    (number) 6400
    Expected:
    (number) 6'
    exit code: 256

Adding context to the assertion makes it clearer what the problem is:

    ERROR    test/unit/testutil.lua @ 785: vim_snprintf() positional arguments
    test/unit/testutil.lua:757: test/unit/testutil.lua:741: (string) '
    test/unit/strings_spec.lua:149: snprintf(buf, 0, "%1$0.*2$b", cdata&lt;unsigned int&gt;: 0xf78d0f38, cdata&lt;int&gt;: 0xf78dc4e0) = 001100
    Expected objects to be the same.
    Passed in:
    (number) 6400
    Expected:
    (number) 6'
    exit code: 256
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(test): fix strings_spec.lua for AArch64</title>
<updated>2024-04-12T16:37:57+00:00</updated>
<author>
<name>Joey Gouly</name>
<email>joey.gouly@gmail.com</email>
</author>
<published>2024-04-12T16:24:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=f4c97da262424e0680e00c5e297da988937480e9'/>
<id>f4c97da262424e0680e00c5e297da988937480e9</id>
<content type='text'>
LuaJIT does not handle -0.0 correctly in 'dual number mode' (which is
the default, and only supported mode for LuaJIT arm64). If LuaJIT is
forced to use 'dual number mode' on X64 (where the default is single),
this test will fail in the same manner.

Fix this by using tonumber("-0.0") instead of a -0.0 literal.

See: https://github.com/LuaJIT/LuaJIT/issues/858
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
LuaJIT does not handle -0.0 correctly in 'dual number mode' (which is
the default, and only supported mode for LuaJIT arm64). If LuaJIT is
forced to use 'dual number mode' on X64 (where the default is single),
this test will fail in the same manner.

Fix this by using tonumber("-0.0") instead of a -0.0 literal.

See: https://github.com/LuaJIT/LuaJIT/issues/858
</pre>
</div>
</content>
</entry>
<entry>
<title>refactor(test): inject after_each differently</title>
<updated>2024-04-10T14:53:50+00:00</updated>
<author>
<name>Lewis Russell</name>
<email>lewis6991@gmail.com</email>
</author>
<published>2024-04-09T11:26:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=81fc27124b9e1b375e0ce9605ae69c3c2a2d9222'/>
<id>81fc27124b9e1b375e0ce9605ae69c3c2a2d9222</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>test: improve test conventions</title>
<updated>2024-04-08T20:51:00+00:00</updated>
<author>
<name>dundargoc</name>
<email>gocdundar@gmail.com</email>
</author>
<published>2024-04-08T09:03:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=7035125b2b26aa68fcfb7cda39377ac79926a0f9'/>
<id>7035125b2b26aa68fcfb7cda39377ac79926a0f9</id>
<content type='text'>
Work on https://github.com/neovim/neovim/issues/27004.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Work on https://github.com/neovim/neovim/issues/27004.
</pre>
</div>
</content>
</entry>
<entry>
<title>build: enable lintlua for test/unit/ dir #26396</title>
<updated>2023-12-04T22:32:39+00:00</updated>
<author>
<name>Justin M. Keyes</name>
<email>justinkz@gmail.com</email>
</author>
<published>2023-12-04T22:32:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=c3836e40a2bffbc1d4e06531145b7825788dd818'/>
<id>c3836e40a2bffbc1d4e06531145b7825788dd818</id>
<content type='text'>
Problem:
Not all Lua code is checked by stylua. Automating code-style is an
important mechanism for reducing time spent on accidental
(non-essential) complexity.

Solution:
- Enable lintlua for `test/unit/` directory.
- TODO: only `test/functional/` remains unchecked.

previous: 45fe4d11add933df76a2ea4bf52ce8904f4a778b
previous: 517f0cc634b985057da5b95cf4ad659ee456a77e</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
Not all Lua code is checked by stylua. Automating code-style is an
important mechanism for reducing time spent on accidental
(non-essential) complexity.

Solution:
- Enable lintlua for `test/unit/` directory.
- TODO: only `test/functional/` remains unchecked.

previous: 45fe4d11add933df76a2ea4bf52ce8904f4a778b
previous: 517f0cc634b985057da5b95cf4ad659ee456a77e</pre>
</div>
</content>
</entry>
<entry>
<title>vim-patch:9.0.1856: issues with formatting positional arguments (#25013)</title>
<updated>2023-09-04T00:49:50+00:00</updated>
<author>
<name>zeertzjq</name>
<email>zeertzjq@outlook.com</email>
</author>
<published>2023-09-04T00:49:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=c431d820e7be1c511d3d16e89cdffaa21b7909fa'/>
<id>c431d820e7be1c511d3d16e89cdffaa21b7909fa</id>
<content type='text'>
Problem:  issues with formatting positional arguments
Solution: fix them, add tests and documentation

closes: vim/vim#12140
closes: vim/vim#12985

Tentatively fix message_test. Check NULL ptr.

https://github.com/vim/vim/commit/aa90d4f031f73a34aaef5746931ea746849a2231

Co-authored-by: Christ van Willegen &lt;cvwillegen@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:  issues with formatting positional arguments
Solution: fix them, add tests and documentation

closes: vim/vim#12140
closes: vim/vim#12985

Tentatively fix message_test. Check NULL ptr.

https://github.com/vim/vim/commit/aa90d4f031f73a34aaef5746931ea746849a2231

Co-authored-by: Christ van Willegen &lt;cvwillegen@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>vim-patch:9.0.1715: duplicate test in message_test.c (#24728)</title>
<updated>2023-08-15T22:11:05+00:00</updated>
<author>
<name>zeertzjq</name>
<email>zeertzjq@outlook.com</email>
</author>
<published>2023-08-15T22:11:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.josher.dev/rneovim.git/commit/?id=10c5f35a8ddf2683e0c849f71c02b81556ece902'/>
<id>10c5f35a8ddf2683e0c849f71c02b81556ece902</id>
<content type='text'>
Problem: duplicate test in message_test.c
Solution: Remove duplicate test and make functions static

closes: vim/vim#12803

https://github.com/vim/vim/commit/7772c93a3ec1ce60469e9aea9899687ae1141f34</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem: duplicate test in message_test.c
Solution: Remove duplicate test and make functions static

closes: vim/vim#12803

https://github.com/vim/vim/commit/7772c93a3ec1ce60469e9aea9899687ae1141f34</pre>
</div>
</content>
</entry>
</feed>
