Live data from Hacker News

Using `make` and `git diff` for a simple and powerful test harness

chrismorgan.info

11–20 of 48 posts

Re: Using `make` and `git diff` for a simple and powerful test harness

#11

Earlier quoted context omitted.

The code font I use is Triplicate: https://mbtype.com/fonts/triplicate/ I use the Poly variant by default, only disabling it in places where the monospacedness matters for layout purposes, e.g. the terminal recording in this article (because of Vim), and Rust compiler output in some of my other articles. The Poly variant does things like make i, l and space a little narrower, and m a little wider, which makes casual…

I think one of the best reasons to use a monospaced typeface is that it is a fairly strong and accurate signifier of code. Of course, in this case you have special highlighting for it that makes it less useful, but in general I think that it really helps. (Plus there are a couple of other, minor benefits probably not worth listing here.)

As mentioned elsewhere I've been using proportional for code and it's very nice but for a small drawback. I'd say give it a try for a couple of days and see.

Re: Using `make` and `git diff` for a simple and powerful test harness

#12

it's my friday, here's a haiku for you: this is a nice post i'm not sober on hn fixed width code font please

As with most poetry jokes, you've worked backwards from the meter to find a line that fits the style but has nothing to do with the rest of the poem.

Re: Using `make` and `git diff` for a simple and powerful test harness

#13
post #7

Earlier quoted context omitted.

In monospace that typeface looks glorious. I'd recommend continuing to use proportional for inline keywords, though.

Interesting. I’ll give the thought time to settle and probably disable Poly for all code blocks tomorrow, leaving it on only for inline code. (That’s what I did initially in the design, but then I decided to make normal code blocks Poly as well because I preferred it so, and why not? —But it seems to be disconcerting people.) Yet one of the things I really like about Poly is how it decreases width. Disabling Poly wou…

I'd gently suggest that, while the side-by-side code is a strong with the early for loops, it's not adding much as much value for the longer snippet with the Display impl.

Re: Using `make` and `git diff` for a simple and powerful test harness

#14
post #8

I went to an awful lot of trouble to apply roughly the same technique to test some code generation code [0]. Required pulling in a random dependency and hacking around for a while to make the output look right. Your solution is much slicker! [0]: https://github.com/couchand/wayfinder/blob/1dc58a1130bc17941...

What you ended up with has two major advantages: ① it integrates with the Cargo test harness, so that Rust developers’ expectations will be met; and ② it does it in one compiler invocation. The test harness I describe would be quite slow for your sort of situation.

I’m not completely sold on using a separate crate and build.rs how you have, but it looks like it’ll yield a good usable result. A couple of related things you might be interested in: compiletest_rs, trybuild.

Re: Using `make` and `git diff` for a simple and powerful test harness

#15

it's my friday, here's a haiku for you: this is a nice post i'm not sober on hn fixed width code font please

As with most poetry jokes, you've worked backwards from the meter to find a line that fits the style but has nothing to do with the rest of the poem.

  Please rip out my eyes
  I can no longer read this
  Polyspaced madness

Re: Using `make` and `git diff` for a simple and powerful test harness

#16
A bit off-topic, but I like the tty-player you're using for the demo (and apparently have created). https://tty-player.chrismorgan.info/

I haven't come across this kind of terminal playback on the web before, seems a bit more bandwidth efficient and snappier than video or gifs.

Re: Using `make` and `git diff` for a simple and powerful test harness

#17
post #16

A bit off-topic, but I like the tty-player you're using for the demo (and apparently have created). https://tty-player.chrismorgan.info/ I haven't come across this kind of terminal playback on the web before, seems a bit more bandwidth efficient and snappier than video or gifs.

Heads up: what’s shown and run at https://tty-player.chrismorgan.info is currently out of date (though https://github.com/chris-morgan/tty-player is up to date). I wrote it years back against Web Components v0 for a project that has been shelved for a few years, and more recently updated it to Web Components v1 and Shadow DOM, because I wanted it for this article. Still need to update it to xterm.js.

The most popular thing in this space nowadays is asciinema, mostly used by embedding it from asciinema.org, but I prefer my thing.

Re: Using `make` and `git diff` for a simple and powerful test harness

#19
Fun. The rwildcard function here

    rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $2,$d))
is very similar to one I wrote in 2011 (https://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-fun...):

    rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
The only difference is that I wanted to be able to use * in the pattern rather than % (hence the subst).

    $(call rwildcard,,*.c)
vs.

    $(call rwildcard,,%.c)

Re: Using `make` and `git diff` for a simple and powerful test harness

#20

Fun. The rwildcard function here rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $2,$d)) is very similar to one I wrote in 2011 ( https://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-fun... ): rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) The only difference is that I wanted to be able to use * in the pattern rather than % (hence the subst).…

I believe it is a direct descendant of yours, which I’ve used from time to time over the years. I just didn’t feel the need to support *, % was enough for me.

Thanks for all the stuff you’ve written about Make: I’ve enjoyed reading quite a lot of it!

Post reply on HN