Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail for Julia 1.11 #108

Open
caleb-allen opened this issue Feb 3, 2025 · 2 comments
Open

Tests fail for Julia 1.11 #108

caleb-allen opened this issue Feb 3, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@caleb-allen
Copy link
Owner

caleb-allen commented Feb 3, 2025

1.11 was not included in the tests prior to #103, which was merged only recently despite 1.11 being released over 3 months ago. #103 wasn't merged earlier so as to identify the failure and resolve it first. However, 1.11 is out so the test should fail.

The cause of the failure requires investigation, hence this issue.

Here is a sample failure from a recent CI run:

Test Summary:    | Pass  Total  Time
find c backwards |    2      2  0.0s
bugs from github: Test Failed at /home/runner/work/VimBindings.jl/VimBindings.jl/test/command.jl:28
  Expression: run("|Hello world", "cw") == testbuf("|i| world")
   Evaluated:  VimBuffer("|i|") ==  VimBuffer("|i| world")

Stacktrace:
 [1] macro expansion
   @ /opt/hostedtoolcache/julia/1.11.3/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:679 [inlined]
 [2] macro expansion
   @ ~/work/VimBindings.jl/VimBindings.jl/test/command.jl:28 [inlined]
 [3] macro expansion
   @ /opt/hostedtoolcache/julia/1.11.3/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
 [4] top-level scope
   @ ~/work/VimBindings.jl/VimBindings.jl/test/command.jl:25
bugs from github: Test Failed at /home/runner/work/VimBindings.jl/VimBindings.jl/test/command.jl:29
  Expression: run("|Hello world", "dw") == testbuf("|world")
   Evaluated:  VimBuffer("|n|") ==  VimBuffer("|n|world")

Stacktrace:
 [1] macro expansion
   @ /opt/hostedtoolcache/julia/1.11.3/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:679 [inlined]
 [2] macro expansion
   @ ~/work/VimBindings.jl/VimBindings.jl/test/command.jl:29 [inlined]
 [3] macro expansion
   @ /opt/hostedtoolcache/julia/1.11.3/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
 [4] top-level scope
   @ ~/work/VimBindings.jl/VimBindings.jl/test/command.jl:25
bugs from github: Test Failed at /home/runner/work/VimBindings.jl/VimBindings.jl/test/command.jl:35
  Expression: run("println(|)", "o") == testbuf("println()\n|i|")
   Evaluated:  VimBuffer("println(|i|)") ==  VimBuffer("println()
|i|")

Stacktrace:
 [1] macro expansion
   @ /opt/hostedtoolcache/julia/1.11.3/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:679 [inlined]
 [2] macro expansion
   @ ~/work/VimBindings.jl/VimBindings.jl/test/command.jl:35 [inlined]
 [3] macro expansion
   @ /opt/hostedtoolcache/julia/1.11.3/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
 [4] top-level scope
   @ ~/work/VimBindings.jl/VimBindings.jl/test/command.jl:25
Test Summary:    | Pass  Fail  Total  Time
bugs from github |    3     3      6  2.2s
ERROR: LoadError: Some tests did not pass: 3 passed, 3 failed, 0 errored, 0 broken.
in expression starting at /home/runner/work/VimBindings.jl/VimBindings.jl/test/command.jl:23
in expression starting at /home/runner/work/VimBindings.jl/VimBindings.jl/test/runtests.jl:9
Package VimBindings errored during testing
Error: Process completed with exit code 1.
@caleb-allen caleb-allen added the bug Something isn't working label Feb 3, 2025
@caleb-allen caleb-allen self-assigned this Feb 3, 2025
@caleb-allen
Copy link
Owner Author

The failing tests in test/command.jl were written for issues #46 and #60

    # https://github.com/caleb-allen/VimBindings.jl/issues/46
    @test run("|Hello world", "cw") == testbuf("|i| world")
    @test run("|Hello world", "dw") == testbuf("|world")

    # https://github.com/caleb-allen/VimBindings.jl/issues/60
    @test run("println(|)", "o") == testbuf("println()\n|i|")

@caleb-allen
Copy link
Owner Author

It's odd, the above tests run operations on buffers constructed for the test, but their results are not the results observed when running those same commands with VimBindings enabled.

For example, dw:

(VimBindings) julia> run("|Hello world", "dw")
 VimBuffer("|n|")

Yet when I run the same command directly on the same string in the REPL, it applies it correctly, changing Hello world to world.

In isolating the problem I've looked at changes in the stdlib for regex, but I'm now coming to suspect the use of LineEdit.edit_splice! by VimBinding's change and delete operations. Specifically, some change in that method's behavior because of the re-implementation of IOBuffer on top of Memory in JuliaLang/julia#53192. Ultimately LineEdit methods shouldn't be expected to be stable, they're not public.

Still, this doesn't explain why the in-test result is different from the in-REPL results. I suspect it's due to the VimBuffer struct which has a hell of a lot of warts and hijacks a lot of behavior in weird ways—perhaps in the test the operation is applied to a VimBuffer, but in the REPL the operation is on an IOBuffer directly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant