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

Add adapter for C assuming Meson build system and Criterion unit testing framework #1

Merged
merged 38 commits into from
Jun 26, 2024

Commits on Jun 25, 2024

  1. Configuration menu
    Copy the full SHA
    cb048a1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e9ed2e7 View commit details
    Browse the repository at this point in the history
  3. Basic support for running all tests from the open buffer

    This is assuming the test executable is named after the test file, so:
    test_something.c -> exe == test_something
    
    So that the command line becomes
    meson test -C build test_something
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    4844f97 View commit details
    Browse the repository at this point in the history
  4. Define name

    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    89d764c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    80d76bc View commit details
    Browse the repository at this point in the history
  6. Set proper title

    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    8e1aaab View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    8035467 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    fc1509f View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    1851c6a View commit details
    Browse the repository at this point in the history
  10. Fixup print output

    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    6afb151 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    5412dc6 View commit details
    Browse the repository at this point in the history
  12. Simplify logic when printing results

    Only print result if test is not SKIPPED
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    c6adab7 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    9d32df4 View commit details
    Browse the repository at this point in the history
  14. Properly get the name of the test executable by parsing meson target …

    …data
    
    Uses 'meson introspect --targets' to find the test executable that
    contains the source file in the currently open buffer.
    
    This fixes an issue with the existing implementation that assumed the
    name of the test executable from the name of the buffer.
    
    However this is not bullet proof. It is possible that the source file is
    used in multiple test executables, for instance to run with different
    parameters and flags.
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    aad34f9 View commit details
    Browse the repository at this point in the history
  15. Move util.build_tests to meson.compile

    Try to keep meson specific interaction in its own module for reusing
    later
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    28a8d0f View commit details
    Browse the repository at this point in the history
  16. Add a test_parser module

    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    054e857 View commit details
    Browse the repository at this point in the history
  17. Add code documentation

    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    a525c10 View commit details
    Browse the repository at this point in the history
  18. Implement M.can_run

    Use empty parameter table to signal that the test can't be run
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    ac56ebc View commit details
    Browse the repository at this point in the history
  19. Move splitstr to util

    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    119c41f View commit details
    Browse the repository at this point in the history
  20. Update handling of the json test results

    Update API for capturing JSOn
    Store result in M
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    936dc73 View commit details
    Browse the repository at this point in the history
  21. Implement M.after_run

    Locate line number with error and update diagnostics UI
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    99d4e3b View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    e975eba View commit details
    Browse the repository at this point in the history
  23. Clean up and simplify: call criterion test executable directly instea…

    …d of through `meson test`
    
    Should have done this all along. This adapter is all about criterion,
    not meson.
    
    We still use meson introspect to find the link between the source file
    and the test exectuable. The primary difference is that we now call the
    test executable directly instead of through `meson test -C build
    test_exe`.
    
    This allows for some simplifications:
    - Depend only on how the test executable behaves
    
    - Test output can be read directly instead of being captured in the
    output stream of meson (lots of text + some json + lots of text)
    
    - Simpler command line since test arguments don't have to be wrapped
    with meson's --test-args=""
    
    - Perhaps slighly easier to modify adapter later if we need to support a
    different build system
    
    delete test_parser
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    6d44ebe View commit details
    Browse the repository at this point in the history
  24. Clean up after_run

    Let util parse the results and return the error messages.
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    85f5ebc View commit details
    Browse the repository at this point in the history
  25. Rename adapter to 'criterion'

    Update diagnostics namespace
    Update adapter path
    Update adatper name
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    d76d2f6 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    a87dcd5 View commit details
    Browse the repository at this point in the history
  27. Use built-in json decoder

    Replace the external json5 decoder with the built-in vim.json module.
    
    During development I had been testing vim.fn.json_decode whichs turns
    out to be a vimscript function that cannot be used in lua loop
    callbacks. I did not know there was also a module called vim.json which
    I'm using now...
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    3a327fe View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    20d7d20 View commit details
    Browse the repository at this point in the history
  29. Use empty string instead of nil to signal not found

    The criterion and util modules return an empty string instead of nil
    value when a test exe was not found or if a test was not found in the
    buffer
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    455b872 View commit details
    Browse the repository at this point in the history
  30. Fix bug after rebasing after breaking API changes

    Realized that M.can_run is not called by quicktest, so need to call
    internally to make sure error handling still works
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    30df723 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    a9d65d2 View commit details
    Browse the repository at this point in the history
  32. Fix outdated comment

    The comment was valid when running the test through `meson test` which
    would automatically compile. Now we run the test executable directly and
    need to do compilation ourselves (which we do anyway).
    oyvindaakre committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    aa996ff View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    d33bfde View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    aadec24 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    6e79351 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    f2aa1b0 View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    04b1a96 View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    b32b337 View commit details
    Browse the repository at this point in the history