• CanadaPlus
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    5 个月前

    Can’t you just add the wrapper to the test as well, if it’s easy to do in the actual code?

      • CanadaPlus
        link
        fedilink
        arrow-up
        1
        ·
        4 个月前

        Well, yeah, but I was kind of hoping you’d explain why.

        • leisesprecher@feddit.org
          link
          fedilink
          arrow-up
          1
          ·
          4 个月前

          Because you don’t know what you’ll need that wrapper beforehand, that’s my entire point.

          Unless you’re only doing trivial changes, the chances are very high that you won’t be able to design the class structure. Or, you end up essentially writing the code to be able to write the tests, which kind of defeats the purpose.

          • CanadaPlus
            link
            fedilink
            arrow-up
            1
            ·
            4 个月前

            That’s kind of the whole philosophy, though. The tests are the main way you understand what you’re doing, the working code is just an addition on top of that. Presumably, there’s a way to do that without repeating yourself - although I’m not turning up much on a quick look.