1. 6
  1.  

  2. [Comment from banned user removed]

    1. 4

      This is what tests look like:

      https://selenic.com/hg/file/tip/tests/test-commit.t

      When you write out all the rules like that, it looks awfully complicated, but in actual use you don’t have to keep all of those rules in mind. Using globs and regexps is rare.

      There is also a tool that writes most of this for you. In practice, about the only thing that you have to remember is to put two spaces, a dollar sign, and the command. Then you run the tool which shows you how your tests have changed, and if you want to incorporate that changed output or not into your test. I actually find that this makes Mercurial tests very pleasant to write.

      Someone has thought that this idea was good enough for OCaml too:

      https://blogs.janestreet.com/testing-with-expectations/

      https://github.com/janestreet/ppx_expect

      1. 2

        This… really strongly resembles the kind of trivia of dubious value that often appears on assessments as part of formal education, but has no internal logic, meaning the only way to remember it for the test is to cram.

        (I wouldn’t consider a pun a useful contribution to the discussion normally, but I wanted to point out how arbitrary this looks when reading through it, so I figured I might as well.)