• UndercoverUlrikHD@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 hours ago

    If you wrote the code wrong, it’s gonna assume it’s right.

    Yeah, that might be an issue if copilot base the tests on the code. I only write tests for the core (pure) functions, so it’s fairly easy to just say what the inputs and the expected output should be and let copilot have at it. Testing stateful functions is a can of worms it’s often better to design around if your toolset supports it.

    I obviously don’t have any context for what sort of project you’re working on and I’m sure it’s very different from mine, but I’m currently working on a distributed system with Erlang/Elixir, and often all I want to check is that the happy path gives the expected output. Catching strange edge cases that happens in the shell module due to unexpected state is something I’m happy to just let fail, and have the supervisor clean up and restart to a known state. It’s quite freeing to not write defensive code.

    What sort of test cases would you want to write for querying a date? Some ISO-8601 verification?

    • JackbyDev@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 hours ago

      Given a list of things (which happened at a date time), give me the one that happened on or most soon after an input date time.