masak / bel

An interpreter for Bel, Paul Graham's Lisp language
GNU General Public License v3.0
27 stars 1 forks source link

Improve precision in 02-prims.t tests (and others) #361

Open masak opened 3 years ago

masak commented 3 years ago

In 02-prims.t, we're testing with ~~mem because we only care about "is it a member or not"? But we could restate all those tests as searches instead, and get a more meaningful number back. (The index of the element list in which we found a match.)

Also, go through the other instances of ~~ in other test files, and see if we can similarly lift them into something more meaningful. Maybe in some cases we can simply group them into a single test instead of testing things one by one.

masak commented 1 year ago

(The index of the element list in which we found a match.)

I'm not sure I like that idea, 2-and-some years later. Who cares about the index? Why make the test brittle in that particular way?

That said, I do think those tests can be rephrased. Maybe we can conditionally push the corresponding symbol to a list, do a quick diff with the expected list and test that this diff is empty?