Skip to content

Comment on To Kill a Mockingtestparent

Comments

I don’t know what you’re talking about, but it isn’t function composition. Function composition consumes outputs as it produces inputs, in equal measure — in f(g(x)), the domain of f is bounded by the codomain of g, which is itself bounded by x. If g has three branches, but f always outputs a value that takes the first branch, then g will only ever follow one branch in your test; you won’t get a combinatoric explosion of possible branches taken.

You might be thinking more of testing several expressions independently, e.g. assert([f(x), g(x)] == […]). This does what you’re talking about, but I don’t think anybody (including the author of the post) was recommending this.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.