• anotherandrew@lemmy.mixdown.ca
    link
    fedilink
    English
    arrow-up
    12
    ·
    7 days ago

    I mainly use it to generate unit tests and it frequently makes shit up that clearly won’t work. Like directly invoking non-exported functions that I deliberately choose not to export, because they don’t need to be exported.

    If you work where I work, their solution is to just #include "the_file.c" so they have access to all the functions/variables I painstakingly marked static specifically to prevent them from trying to unit test the internals.

    • metaldream@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      3
      ·
      6 days ago

      Lol, that’s ridiculous. At least here they aren’t requiring us to do that (yet).

      In my case, this is modular js code. Copilot doesn’t know how to test the internals of the module so it just calls them directly, which would cause an exception because the function would be undefined.

      I end up rewriting the test myself whenever it does this because there’s no reason to export those functions, it would just cause problems. Typically all this requires is changing the test inputs so the internal logic is covered by the test. It’s just too dumb to know that, because it doesn’t actually understand the code at all.